Browse Source

implement unittest for calculatorAdd.c

remotes/origin/feature/calculator-add
fdai7514 2 years ago
parent
commit
22c4f86636
  1. 1
      build-project.sh
  2. 101
      tests/test_calculatorAdd.c

1
build-project.sh

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

101
tests/test_calculatorAdd.c

@ -2,7 +2,7 @@
#include "unity.h"
#include "calculatorAdd.h"
#include "calculatorAdd.c"
void setUp(void)
{
@ -12,9 +12,104 @@ void tearDown(void)
{
}
void test_calculatorAdd_NeedToImplement(void)
void test1_calculatorAdd(void)
{
TEST_IGNORE_MESSAGE("Need to Implement calculatorAdd");
float x, y, a ,e;
x = 26.24;
y = 23.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test2_calculatorAdd(void)
{
float x, y, a ,e;
x = 56.24;
y = 233.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test3_calculatorAdd(void)
{
float x, y, a ,e;
x = 1226.24;
y = 323.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test4_calculatorAdd(void)
{
float x, y, a ,e;
x = 2623.24;
y = 2323.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test5_calculatorAdd(void)
{
float x, y, a ,e;
x = 2435.24;
y = 23423.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test6_calculatorAdd(void)
{
float x, y, a ,e;
x = 4534.24;
y = 2221.22;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test7_calculatorAdd(void)
{
float x, y, a ,e;
x = 26322.24;
y = 2332.222;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test8_calculatorAdd(void)
{
float x, y, a ,e;
x = 26132.24;
y = 2331122.222;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test9_calculatorAdd(void)
{
float x, y, a ,e;
x = 6322.24;
y = 21232.2322;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
void test10_calculatorAdd(void)
{
float x, y, a ,e;
x = 1234.456;
y = 654.4321;
a = calculatorAdd(x, y);
e = x + y;
TEST_ASSERT_EQUAL_FLOAT(e, a);
}
#endif // TEST
Loading…
Cancel
Save