From 97b3a6a84791e20eb794f6d82a130e5887b4dc35 Mon Sep 17 00:00:00 2001 From: fdai7754 Date: Sat, 3 Feb 2024 18:17:54 +0100 Subject: [PATCH] multiplikation funktion minirechner inkl. unittest --- src/minirechner.c | 5 +++++ src/minirechner.h | 1 + test/test_minirechner.c | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/src/minirechner.c b/src/minirechner.c index 036ebbe..37fa823 100644 --- a/src/minirechner.c +++ b/src/minirechner.c @@ -9,4 +9,9 @@ float addieren(float a, float b) { //subtrahieren float subtrahieren(float a, float b) { return a - b; +} + +//multiplizieren +float multiplizieren(float a, float b) { + return a * b; } \ No newline at end of file diff --git a/src/minirechner.h b/src/minirechner.h index 0a61c42..569a7b7 100644 --- a/src/minirechner.h +++ b/src/minirechner.h @@ -3,5 +3,6 @@ float addieren(float a, float b); float subtrahieren(float a, float b); +float multiplizieren(float a, float b); #endif // MINIRECHNER_H diff --git a/test/test_minirechner.c b/test/test_minirechner.c index b7703ee..b0b992b 100644 --- a/test/test_minirechner.c +++ b/test/test_minirechner.c @@ -62,4 +62,11 @@ void test_minitaschenrechner_4_minus_0(void) TEST_ASSERT_EQUAL(4, result); } +// test multiplikation +void test_minitaschenrechner_8_mal_3(void) +{ + float result = multiplizieren(8, 3); + TEST_ASSERT_EQUAL(24, result); +} + #endif // TEST