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.

115 lines
1.8 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "calculatorAdd.c"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test1_calculatorAdd(void)
  11. {
  12. float x, y, a ,e;
  13. x = 26.24;
  14. y = 23.22;
  15. a = calculatorAdd(x, y);
  16. e = x + y;
  17. TEST_ASSERT_EQUAL_FLOAT(e, a);
  18. }
  19. void test2_calculatorAdd(void)
  20. {
  21. float x, y, a ,e;
  22. x = 56.24;
  23. y = 233.22;
  24. a = calculatorAdd(x, y);
  25. e = x + y;
  26. TEST_ASSERT_EQUAL_FLOAT(e, a);
  27. }
  28. void test3_calculatorAdd(void)
  29. {
  30. float x, y, a ,e;
  31. x = 1226.24;
  32. y = 323.22;
  33. a = calculatorAdd(x, y);
  34. e = x + y;
  35. TEST_ASSERT_EQUAL_FLOAT(e, a);
  36. }
  37. void test4_calculatorAdd(void)
  38. {
  39. float x, y, a ,e;
  40. x = 2623.24;
  41. y = 2323.22;
  42. a = calculatorAdd(x, y);
  43. e = x + y;
  44. TEST_ASSERT_EQUAL_FLOAT(e, a);
  45. }
  46. void test5_calculatorAdd(void)
  47. {
  48. float x, y, a ,e;
  49. x = 2435.24;
  50. y = 23423.22;
  51. a = calculatorAdd(x, y);
  52. e = x + y;
  53. TEST_ASSERT_EQUAL_FLOAT(e, a);
  54. }
  55. void test6_calculatorAdd(void)
  56. {
  57. float x, y, a ,e;
  58. x = 4534.24;
  59. y = 2221.22;
  60. a = calculatorAdd(x, y);
  61. e = x + y;
  62. TEST_ASSERT_EQUAL_FLOAT(e, a);
  63. }
  64. void test7_calculatorAdd(void)
  65. {
  66. float x, y, a ,e;
  67. x = 26322.24;
  68. y = 2332.222;
  69. a = calculatorAdd(x, y);
  70. e = x + y;
  71. TEST_ASSERT_EQUAL_FLOAT(e, a);
  72. }
  73. void test8_calculatorAdd(void)
  74. {
  75. float x, y, a ,e;
  76. x = 26132.24;
  77. y = 2331122.222;
  78. a = calculatorAdd(x, y);
  79. e = x + y;
  80. TEST_ASSERT_EQUAL_FLOAT(e, a);
  81. }
  82. void test9_calculatorAdd(void)
  83. {
  84. float x, y, a ,e;
  85. x = 6322.24;
  86. y = 21232.2322;
  87. a = calculatorAdd(x, y);
  88. e = x + y;
  89. TEST_ASSERT_EQUAL_FLOAT(e, a);
  90. }
  91. void test10_calculatorAdd(void)
  92. {
  93. float x, y, a ,e;
  94. x = 1234.456;
  95. y = 654.4321;
  96. a = calculatorAdd(x, y);
  97. e = x + y;
  98. TEST_ASSERT_EQUAL_FLOAT(e, a);
  99. }
  100. #endif // TEST