From 95b4763e5b2d29ca6a2f724b62248284a15c403f Mon Sep 17 00:00:00 2001 From: fdai7514 Date: Fri, 10 Feb 2023 21:44:43 +0100 Subject: [PATCH] implement unittest for calculatorCube.c --- build-project.sh | 1 + tests/test_calculatorCube.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/build-project.sh b/build-project.sh index 43a0588..51cf723 100755 --- a/build-project.sh +++ b/build-project.sh @@ -1,4 +1,5 @@ clear +ceedling test:all cd src/ gcc main.c -o main ./main diff --git a/tests/test_calculatorCube.c b/tests/test_calculatorCube.c index 4942ef3..485b8ea 100644 --- a/tests/test_calculatorCube.c +++ b/tests/test_calculatorCube.c @@ -2,7 +2,7 @@ #include "unity.h" -#include "calculatorCube.h" +#include "calculatorCube.c" void setUp(void) { @@ -12,9 +12,24 @@ void tearDown(void) { } -void test_calculatorCube_NeedToImplement(void) +void test1_calculatorCube(void) { - TEST_IGNORE_MESSAGE("Need to Implement calculatorCube"); + float p, a, e; + p = 5; + a = calculatorCube(p); + e = p * p * p; + TEST_ASSERT_EQUAL_FLOAT(e, a); } + +void test2_calculatorCube(void) +{ + float p, a, e; + p = 6; + a = calculatorCube(p); + e = p * p * p; + TEST_ASSERT_EQUAL_FLOAT(e, a); +} + + #endif // TEST