You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
780 B

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "minirechner.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. // test addition
  11. void test_minitaschenrechner_3_plus_4(void)
  12. {
  13. float result = addieren(3, 4);
  14. TEST_ASSERT_EQUAL(7, result);
  15. }
  16. void test_minitaschenrechner_float_plus_float(void)
  17. {
  18. float result = addieren(3.1, 4.2);
  19. TEST_ASSERT_EQUAL(7.3, result);
  20. }
  21. void test_minitaschenrechner_minus1_plus_minus3(void)
  22. {
  23. float result = addieren(-1, -3);
  24. TEST_ASSERT_EQUAL(-4, result);
  25. }
  26. void test_minitaschenrechner_0_plus_2(void)
  27. {
  28. float result = addieren(0, 2);
  29. TEST_ASSERT_EQUAL(2, result);
  30. }
  31. // test subtraktion
  32. void test_minitaschenrechner_5_minus_2(void)
  33. {
  34. float result = subtrahieren(5, 2);
  35. TEST_ASSERT_EQUAL(3, result);
  36. }
  37. #endif // TEST