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