68 lines
1.2 KiB

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 "temperatur.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_temperaturRechner_CzuF(void)
  11. {
  12. float result = CzuF(25);
  13. float expected = 77;
  14. TEST_ASSERT_EQUAL(expected, result);
  15. }
  16. void test_temperaturRechner_CzuK(void)
  17. {
  18. float result = CzuK(25);
  19. float expected = 298.15;
  20. TEST_ASSERT_EQUAL(expected, result);
  21. }
  22. void test_temperaturRechner_FzuC(void)
  23. {
  24. float result = FzuC(77);
  25. float expected = 25;
  26. TEST_ASSERT_EQUAL(expected, result);
  27. }
  28. void test_temperaturRechner_FzuK(void)
  29. {
  30. float result = FzuK(77);
  31. float expected = 298.15;
  32. TEST_ASSERT_EQUAL(expected, result);
  33. }
  34. void test_temperaturRechner_KzuC(void)
  35. {
  36. float result = KzuC(298.15);
  37. float expected = 25;
  38. TEST_ASSERT_EQUAL(expected, result);
  39. }
  40. void test_temperaturRechner_KzuF(void)
  41. {
  42. float result = KzuF(298.15);
  43. float expected = 77;
  44. TEST_ASSERT_EQUAL(expected, result);
  45. }
  46. void test_returnUnit_first(void)
  47. {
  48. const char *result = getFirstUnit(1);
  49. char expected[] = "Celsius";
  50. TEST_ASSERT_EQUAL_STRING(expected, result);
  51. }
  52. void test_returnUnit_second(void)
  53. {
  54. const char *result = getSecondUnit(2);
  55. char expected[] = " Kelvin";
  56. TEST_ASSERT_EQUAL_STRING(expected, result);
  57. }
  58. #endif