Browse Source

implement unittest for calculatorSubtract.c

remotes/origin/feature/calculator-subtract
fdai7514 2 years ago
parent
commit
c19f56958b
  1. 1
      build-project.sh
  2. 100
      tests/test_calculatorSubtract.c

1
build-project.sh

@ -1,4 +1,5 @@
clear clear
ceedling test:all
cd src/ cd src/
gcc main.c -o main gcc main.c -o main
./main ./main

100
tests/test_calculatorSubtract.c

@ -12,9 +12,105 @@ void tearDown(void)
{ {
} }
void test_calculatorSubtract_NeedToImplement(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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
void test10_calculatorSubtract(void)
{ {
TEST_IGNORE_MESSAGE("Need to Implement calculatorSubtract");
float p, q, a, e;
p = 1233.811;
q = 1121.131;
e = p - q;
a = calculatorSubtract(p, q);
TEST_ASSERT_EQUAL_FLOAT(e, a);
} }
#endif // TEST #endif // TEST
Loading…
Cancel
Save