From cb4f6245aaa2c86268dbd6e76e38f3d725b4df71 Mon Sep 17 00:00:00 2001 From: Kevin Ludwig Date: Wed, 7 Feb 2024 18:27:50 +0100 Subject: [PATCH] Unittest: calcBMI --- src/bmi.c | 1 + src/bmi.h | 6 ++++++ test/test_bmi.c | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/bmi.h create mode 100644 test/test_bmi.c diff --git a/src/bmi.c b/src/bmi.c index b93dbd6..b9e7129 100644 --- a/src/bmi.c +++ b/src/bmi.c @@ -1,4 +1,5 @@ #include +#include "bmi.h" float calcBMI(float a, float b){ if(a > 0 && b > 0) diff --git a/src/bmi.h b/src/bmi.h new file mode 100644 index 0000000..b1a92c8 --- /dev/null +++ b/src/bmi.h @@ -0,0 +1,6 @@ +#ifndef BMI_H +#define BMI_H + +float calcBMI(float height, float weight); + +#endif //BMI_H diff --git a/test/test_bmi.c b/test/test_bmi.c new file mode 100644 index 0000000..e0530fc --- /dev/null +++ b/test/test_bmi.c @@ -0,0 +1,22 @@ +#ifdef TEST + +#include "unity.h" + +#include "bmi.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_berechnung_BMI(void) +{ +float result = calcBMI(2, 100); +float expected = 25; +TEST_ASSERT_EQUAL(expected, result); +} + +#endif