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.3 KiB

11 months ago
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_CzuFnegativ(void)
  17. {
  18. float result = CzuF(-5);
  19. float expected = 23;
  20. TEST_ASSERT_EQUAL(expected, result);
  21. }
  22. void test_temperaturRechner_CzuK(void)
  23. {
  24. float result = CzuK(25);
  25. float expected = 298.15;
  26. TEST_ASSERT_EQUAL(expected, result);
  27. }
  28. void test_temperaturRechner_FzuC(void)
  29. {
  30. float result = FzuC(77);
  31. float expected = 25;
  32. TEST_ASSERT_EQUAL(expected, result);
  33. }
  34. void test_temperaturRechner_FzuK(void)
  35. {
  36. float result = FzuK(77);
  37. float expected = 298.15;
  38. TEST_ASSERT_EQUAL(expected, result);
  39. }
  40. void test_temperaturRechner_KzuC(void)
  41. {
  42. float result = KzuC(298.15);
  43. float expected = 25;
  44. TEST_ASSERT_EQUAL(expected, result);
  45. }
  46. void test_temperaturRechner_KzuF(void)
  47. {
  48. float result = KzuF(298.15);
  49. float expected = 77;
  50. TEST_ASSERT_EQUAL(expected, result);
  51. }
  52. void test_returnUnit_first(void)
  53. {
  54. const char *result = getFirstUnit(1);
  55. char expected[] = "Celsius";
  56. TEST_ASSERT_EQUAL_STRING(expected, result);
  57. }
  58. void test_returnUnit_second(void)
  59. {
  60. const char *result = getSecondUnit(2);
  61. char expected[] = " Kelvin";
  62. TEST_ASSERT_EQUAL_STRING(expected, result);
  63. }
  64. #endif