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.

116 lines
1.9 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "calculatorSubtract.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test1_calculatorSubtract(void)
  11. {
  12. float p, q, a, e;
  13. p = 123.211;
  14. q = 112.21;
  15. e = p - q;
  16. a = calculatorSubtract(p, q);
  17. TEST_ASSERT_EQUAL_FLOAT(e, a);
  18. }
  19. void test2_calculatorSubtract(void)
  20. {
  21. float p, q, a, e;
  22. p = 13.21;
  23. q = 112.21;
  24. e = p - q;
  25. a = calculatorSubtract(p, q);
  26. TEST_ASSERT_EQUAL_FLOAT(e, a);
  27. }
  28. void test3_calculatorSubtract(void)
  29. {
  30. float p, q, a, e;
  31. p = 12231.211;
  32. q = 1122.21;
  33. e = p - q;
  34. a = calculatorSubtract(p, q);
  35. TEST_ASSERT_EQUAL_FLOAT(e, a);
  36. }
  37. void test4_calculatorSubtract(void)
  38. {
  39. float p, q, a, e;
  40. p = 113453.211;
  41. q = 11254.21;
  42. e = p - q;
  43. a = calculatorSubtract(p, q);
  44. TEST_ASSERT_EQUAL_FLOAT(e, a);
  45. }
  46. void test5_calculatorSubtract(void)
  47. {
  48. float p, q, a, e;
  49. p = 12133.211;
  50. q = 112.231;
  51. e = p - q;
  52. a = calculatorSubtract(p, q);
  53. TEST_ASSERT_EQUAL_FLOAT(e, a);
  54. }
  55. void test6_calculatorSubtract(void)
  56. {
  57. float p, q, a, e;
  58. p = 1133.201;
  59. q = 11221.21;
  60. e = p - q;
  61. a = calculatorSubtract(p, q);
  62. TEST_ASSERT_EQUAL_FLOAT(e, a);
  63. }
  64. void test7_calculatorSubtract(void)
  65. {
  66. float p, q, a, e;
  67. p = 12213.2211;
  68. q = 111.21;
  69. e = p - q;
  70. a = calculatorSubtract(p, q);
  71. TEST_ASSERT_EQUAL_FLOAT(e, a);
  72. }
  73. void test8_calculatorSubtract(void)
  74. {
  75. float p, q, a, e;
  76. p = 16213.711;
  77. q = 1214.2251;
  78. e = p - q;
  79. a = calculatorSubtract(p, q);
  80. TEST_ASSERT_EQUAL_FLOAT(e, a);
  81. }
  82. void test9_calculatorSubtract(void)
  83. {
  84. float p, q, a, e;
  85. p = 1933.611;
  86. q = 1432.21;
  87. e = p - q;
  88. a = calculatorSubtract(p, q);
  89. TEST_ASSERT_EQUAL_FLOAT(e, a);
  90. }
  91. void test10_calculatorSubtract(void)
  92. {
  93. float p, q, a, e;
  94. p = 1233.811;
  95. q = 1121.131;
  96. e = p - q;
  97. a = calculatorSubtract(p, q);
  98. TEST_ASSERT_EQUAL_FLOAT(e, a);
  99. }
  100. #endif // TEST