Browse Source

implement unittest for calculatorMultiply.c

remotes/origin/feature/calculator-multiply
fdai7514 2 years ago
parent
commit
da0dd52871
  1. 1
      build-project.sh
  2. 99
      tests/test_calculatorMultiply.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

99
tests/test_calculatorMultiply.c

@ -12,9 +12,104 @@ void tearDown(void)
{ {
} }
void test_calculatorMultiply_NeedToImplement(void)
void test1_calculatorMultiply(void)
{ {
TEST_IGNORE_MESSAGE("Need to Implement calculatorMultiply");
float p, q, a, e;
p = 26.24;
q = 23.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test2_calculatorMultiply(void)
{
float p, q, a, e;
p = 56.24;
q = 233.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test3_calculatorMultiply(void)
{
float p, q, a, e;
p = 1226.24;
q = 323.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test4_calculatorMultiply(void)
{
float p, q, a, e;
p = 2623.24;
q = 2323.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test5_calculatorMultiply(void)
{
float p, q, a, e;
p = 2435.24;
q = 23423.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test6_calculatorMultiply(void)
{
float p, q, a, e;
p = 4534.24;
q = 2221.22;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test7_calculatorMultiply(void)
{
float p, q, a, e;
p = 26322.24;
q = 2332.222;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test8_calculatorMultiply(void)
{
float p, q, a, e;
p = 26132.24;
q = 2331122.222;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test9_calculatorMultiply(void)
{
float p, q, a, e;
p = 6322.24;
q = 21232.2322;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test10_calculatorMultiply(void)
{
float p, q, a, e;
p = 1234.456;
q = 654.4321;
a = calculatorMultiply(p, q);
e = p * q;
TEST_ASSERT_EQUAL_FLOAT(e, a);
} }
#endif // TEST #endif // TEST
Loading…
Cancel
Save