Browse Source

implement unittest for calculatorDivide.c

remotes/origin/feature/calculator-divide
fdai7514 2 years ago
parent
commit
b0acd83da2
  1. 1
      build-project.sh
  2. 100
      tests/test_calculatorDivide.c

1
build-project.sh

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

100
tests/test_calculatorDivide.c

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