|
@ -4,6 +4,11 @@ |
|
|
|
|
|
|
|
|
#include "calculatorSubtract.h" |
|
|
#include "calculatorSubtract.h" |
|
|
|
|
|
|
|
|
|
|
|
// 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 setUp(void) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
@ -15,102 +20,102 @@ void tearDown(void) |
|
|
|
|
|
|
|
|
void test1_calculatorSubtract(void) |
|
|
void test1_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 123.211; |
|
|
|
|
|
q = 112.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test2_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 13.21; |
|
|
|
|
|
q = 112.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test3_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 12231.211; |
|
|
|
|
|
q = 1122.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test4_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 113453.211; |
|
|
|
|
|
q = 11254.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test5_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 12133.211; |
|
|
|
|
|
q = 112.231; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test6_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 1133.201; |
|
|
|
|
|
q = 11221.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test7_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 12213.2211; |
|
|
|
|
|
q = 111.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test8_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 16213.711; |
|
|
|
|
|
q = 1214.2251; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test9_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 1933.611; |
|
|
|
|
|
q = 1432.21; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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) |
|
|
void test10_calculatorSubtract(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 1233.811; |
|
|
|
|
|
q = 1121.131; |
|
|
|
|
|
e = p - q; |
|
|
|
|
|
a = calculatorSubtract(p, q); |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
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 |
|
|
#endif // TEST |