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.

74 lines
1.1 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "kleiner_groessergleich.h"
  4. #include "kleiner_groessergleich.c"
  5. void setUp(void)
  6. {
  7. }
  8. void tearDown(void)
  9. {
  10. }
  11. // Test 1
  12. void test_gleich(void)
  13. {
  14. int result, expected = 3;
  15. result = vergleicheZahlen_int(1,1);
  16. TEST_ASSERT_EQUAL_INT(expected, result);
  17. }
  18. //Test 2
  19. void test_kleiner(void)
  20. {
  21. int result, expected = 1;
  22. result = vergleicheZahlen_int(1,2);
  23. TEST_ASSERT_EQUAL_INT(expected, result);
  24. }
  25. //Test 3
  26. void test_groesser(void)
  27. {
  28. int result, expected = 2;
  29. result = vergleicheZahlen_int(2,1);
  30. TEST_ASSERT_EQUAL_INT(expected, result);
  31. }
  32. //Test4
  33. void test_groesser_d(void)
  34. {
  35. int result, expected = 2.0;
  36. result = vergleicheZahlen_d(2.0,1.0);
  37. TEST_ASSERT_EQUAL_DOUBLE(expected, result);
  38. }
  39. //Test 5
  40. void test_kleiner_d(void)
  41. {
  42. int result, expected = 1.0;
  43. result = vergleicheZahlen_d(1.0,2.0);
  44. TEST_ASSERT_EQUAL_DOUBLE(expected, result);
  45. }
  46. //Test 6
  47. void test_gleich_d(void)
  48. {
  49. int result, expected = 3.0;
  50. result = vergleicheZahlen_d(1.0,1.0);
  51. TEST_ASSERT_EQUAL_DOUBLE(expected, result);
  52. }
  53. #endif //TEST