|
@ -4,6 +4,11 @@ |
|
|
|
|
|
|
|
|
#include "calculatorDivide.h" |
|
|
#include "calculatorDivide.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) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
@ -14,103 +19,104 @@ void tearDown(void) |
|
|
|
|
|
|
|
|
void test1_calculatorDivide(void) |
|
|
void test1_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 26.24; |
|
|
|
|
|
q = 23.22; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 26.24; |
|
|
|
|
|
num2 = 23.22; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test2_calculatorDivide(void) |
|
|
void test2_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 2236.24; |
|
|
|
|
|
q = 2123.22; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 2236.24; |
|
|
|
|
|
num2 = 2123.22; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test3_calculatorDivide(void) |
|
|
void test3_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 623.2; |
|
|
|
|
|
q = 23.22; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 623.2; |
|
|
|
|
|
num2 = 23.22; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test4_calculatorDivide(void) |
|
|
void test4_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 234.7; |
|
|
|
|
|
q = 124.2; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 234.7; |
|
|
|
|
|
num2 = 124.2; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test5_calculatorDivide(void) |
|
|
void test5_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 26207.2; |
|
|
|
|
|
q = 278.23; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 26207.2; |
|
|
|
|
|
num2 = 278.23; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test6_calculatorDivide(void) |
|
|
void test6_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 111; |
|
|
|
|
|
q = 21; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 111; |
|
|
|
|
|
num2 = 21; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test7_calculatorDivide(void) |
|
|
void test7_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 167; |
|
|
|
|
|
q = 23.22; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 167; |
|
|
|
|
|
num2 = 23.22; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test8_calculatorDivide(void) |
|
|
void test8_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 26124; |
|
|
|
|
|
q = 23022; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 26124; |
|
|
|
|
|
num2 = 23022; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test9_calculatorDivide(void) |
|
|
void test9_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 1234; |
|
|
|
|
|
q = 4321; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 1234; |
|
|
|
|
|
num2 = 4321; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test10_calculatorDivide(void) |
|
|
void test10_calculatorDivide(void) |
|
|
{ |
|
|
{ |
|
|
float p, q, a, e; |
|
|
|
|
|
p = 2345; |
|
|
|
|
|
q = 123.7; |
|
|
|
|
|
a = calculatorDivide(p, q); |
|
|
|
|
|
e = p/q; |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a); |
|
|
|
|
|
|
|
|
float num1, num2, actual, expected; //Arrange |
|
|
|
|
|
num1 = 2345; |
|
|
|
|
|
num2 = 123.7; |
|
|
|
|
|
expected = num1 / num2; |
|
|
|
|
|
actual = calculatorDivide(num1, num2); //Act |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |