From 9e1bef93f1f4cf1fd13fe2048ff9055a3a302b83 Mon Sep 17 00:00:00 2001 From: fdai7754 Date: Sat, 3 Feb 2024 17:22:37 +0100 Subject: [PATCH] addition funktion minirechner inkl. unittest --- src/minirechner.c | 6 ++++++ src/minirechner.h | 1 + test/test_minirechner.c | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/minirechner.c b/src/minirechner.c index 2ee4fd7..b5bf37b 100644 --- a/src/minirechner.c +++ b/src/minirechner.c @@ -1 +1,7 @@ +#include #include "minirechner.h" + +//addieren +float addieren(float a, float b) { + return a + b; +} \ No newline at end of file diff --git a/src/minirechner.h b/src/minirechner.h index 7be865b..63695c7 100644 --- a/src/minirechner.h +++ b/src/minirechner.h @@ -1,5 +1,6 @@ #ifndef MINIRECHNER_H #define MINIRECHNER_H +float addieren(float a, float b); #endif // MINIRECHNER_H diff --git a/test/test_minirechner.c b/test/test_minirechner.c index 30b6a4c..cce14b7 100644 --- a/test/test_minirechner.c +++ b/test/test_minirechner.c @@ -12,9 +12,11 @@ void tearDown(void) { } -void test_minirechner_NeedToImplement(void) +// test addition +void test_minitaschenrechner_3_plus_4(void) { - TEST_IGNORE_MESSAGE("Need to Implement minirechner"); + float result = addieren(3, 4); + TEST_ASSERT_EQUAL(7, result); } #endif // TEST