Browse Source

implement unittest for calculatorFactorial.c

remotes/origin/feature/calculator-factorial
fdai7514 2 years ago
parent
commit
23472c84f4
  1. 1
      build-project.sh
  2. 63
      tests/test_calculatorFactorial.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

63
tests/test_calculatorFactorial.c

@ -12,9 +12,68 @@ void tearDown(void)
{ {
} }
void test_calculatorFactorial_NeedToImplement(void)
void test1_calculatorFactorial(void)
{ {
TEST_IGNORE_MESSAGE("Need to Implement calculatorFactorial");
int p, a, e;
p = 1;
e = 1;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
} }
void test2_calculatorFactorial(void)
{
int p, a, e;
p = 0;
e = 1;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
void test3_calculatorFactorial(void)
{
int p, a, e;
p = 3;
e = 6;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
void test4_calculatorFactorial(void)
{
int p, a, e;
p = 5;
e = 120;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
void test5_calculatorFactorial(void)
{
int p, a, e;
p = 8;
e = 40320;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
void test6_calculatorFactorial(void)
{
int p, a, e;
p = 11;
e = 39916800;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
void test7_calculatorFactorial(void)
{
int p, a, e;
p = 10;
e = 3628800;
a = calculatorFactorial(p);
TEST_ASSERT_EQUAL_INT(e, a);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save