You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
3.2 KiB
121 lines
3.2 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "../src/calculatorSubtract.c"
|
|
|
|
// Note:
|
|
/* This Function may or may not be implemented in actual program, even if it is merged to the main branch.
|
|
If it is temporarily not included in the main Program, then this has a role in future Development of the Project */
|
|
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
|
|
void test1_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 123.211;
|
|
num2 = 112.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test2_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 13.21;
|
|
num2 = 112.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test3_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 12231.211;
|
|
num2 = 1122.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test4_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 113453.211;
|
|
num2 = 11254.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test5_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 12133.211;
|
|
num2 = 112.231;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test6_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 1133.201;
|
|
num2 = 11221.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test7_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 12213.2211;
|
|
num2 = 111.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test8_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 16213.711;
|
|
num2 = 1214.2251;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test9_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 1933.611;
|
|
num2 = 1432.21;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
void test10_calculatorSubtract(void)
|
|
{
|
|
float num1, num2, actual, expected; //Arrange
|
|
num1 = 1233.811;
|
|
num2 = 1121.131;
|
|
expected = num1 - num2;
|
|
actual = calculatorSubtract(num1, num2); //Act
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
|
|
}
|
|
|
|
#endif // TEST
|