Browse Source

implement unittest for calculatorSquare.c

remotes/origin/feature/calculator-square
fdai7514 2 years ago
parent
commit
74527de98f
  1. 1
      build-project.sh
  2. 20
      tests/test_calculatorSquare.c

1
build-project.sh

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

20
tests/test_calculatorSquare.c

@ -2,7 +2,7 @@
#include "unity.h"
#include "calculatorSquare.h"
#include "calculatorSquare.c"
void setUp(void)
{
@ -12,9 +12,23 @@ void tearDown(void)
{
}
void test_calculatorSquare_NeedToImplement(void)
void test1_calculatorMultiply(void)
{
TEST_IGNORE_MESSAGE("Need to Implement calculatorSquare");
float p, a, e;
p = 26.24;
a = calculatorSquare(p);
e = p * p;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test2_calculatorMultiply(void)
{
float p, a, e;
p = 5;
a = calculatorSquare(p);
e = p * p;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
#endif // TEST
Loading…
Cancel
Save