Browse Source

rest funktion minirechner inkl. unittest

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

5
src/minirechner.c

@ -26,3 +26,8 @@ float dividieren(float a, float b) {
return a / b; return a / b;
} }
} }
//rest
float rest(float a, float b) {
return fmod(a, b);
}

1
src/minirechner.h

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

7
test/test_minirechner.c

@ -100,4 +100,11 @@ void test_minitaschenrechner_0_durch_5(void)
TEST_ASSERT_EQUAL(0, result); TEST_ASSERT_EQUAL(0, result);
} }
// test rest
void test_minitaschenrechner_14_rest_5(void)
{
float result = rest(14, 5);
TEST_ASSERT_EQUAL(4, result);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save