Browse Source

multiplikation funktion minirechner inkl. unittest

remotes/origin/minirechnerdev
fdai7754 11 months ago
parent
commit
97b3a6a847
  1. 5
      src/minirechner.c
  2. 1
      src/minirechner.h
  3. 7
      test/test_minirechner.c

5
src/minirechner.c

@ -9,4 +9,9 @@ float addieren(float a, float b) {
//subtrahieren //subtrahieren
float subtrahieren(float a, float b) { float subtrahieren(float a, float b) {
return a - b; return a - b;
}
//multiplizieren
float multiplizieren(float a, float b) {
return a * b;
} }

1
src/minirechner.h

@ -3,5 +3,6 @@
float addieren(float a, float b); float addieren(float a, float b);
float subtrahieren(float a, float b); float subtrahieren(float a, float b);
float multiplizieren(float a, float b);
#endif // MINIRECHNER_H #endif // MINIRECHNER_H

7
test/test_minirechner.c

@ -62,4 +62,11 @@ void test_minitaschenrechner_4_minus_0(void)
TEST_ASSERT_EQUAL(4, result); 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 #endif // TEST
Loading…
Cancel
Save