diff --git a/src/minirechner.c b/src/minirechner.c index b5bf37b..036ebbe 100644 --- a/src/minirechner.c +++ b/src/minirechner.c @@ -4,4 +4,9 @@ //addieren float addieren(float a, float b) { return a + b; +} + +//subtrahieren +float subtrahieren(float a, float b) { + return a - b; } \ No newline at end of file diff --git a/src/minirechner.h b/src/minirechner.h index 63695c7..0a61c42 100644 --- a/src/minirechner.h +++ b/src/minirechner.h @@ -2,5 +2,6 @@ #define MINIRECHNER_H float addieren(float a, float b); +float subtrahieren(float a, float b); #endif // MINIRECHNER_H diff --git a/test/test_minirechner.c b/test/test_minirechner.c index cacd21b..cba19de 100644 --- a/test/test_minirechner.c +++ b/test/test_minirechner.c @@ -36,4 +36,12 @@ void test_minitaschenrechner_0_plus_2(void) float result = addieren(0, 2); TEST_ASSERT_EQUAL(2, result); } + +// test subtraktion +void test_minitaschenrechner_5_minus_2(void) +{ + float result = subtrahieren(5, 2); + TEST_ASSERT_EQUAL(3, result); +} + #endif // TEST