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

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "calculatorDivide.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test1_calculatorDivide(void)
  11. {
  12. float p, q, a, e;
  13. p = 26.24;
  14. q = 23.22;
  15. a = calculatorDivide(p, q);
  16. e = p/q;
  17. TEST_ASSERT_EQUAL_FLOAT(e, a);
  18. }
  19. void test2_calculatorDivide(void)
  20. {
  21. float p, q, a, e;
  22. p = 2236.24;
  23. q = 2123.22;
  24. a = calculatorDivide(p, q);
  25. e = p/q;
  26. TEST_ASSERT_EQUAL_FLOAT(e, a);
  27. }
  28. void test3_calculatorDivide(void)
  29. {
  30. float p, q, a, e;
  31. p = 623.2;
  32. q = 23.22;
  33. a = calculatorDivide(p, q);
  34. e = p/q;
  35. TEST_ASSERT_EQUAL_FLOAT(e, a);
  36. }
  37. void test4_calculatorDivide(void)
  38. {
  39. float p, q, a, e;
  40. p = 234.7;
  41. q = 124.2;
  42. a = calculatorDivide(p, q);
  43. e = p/q;
  44. TEST_ASSERT_EQUAL_FLOAT(e, a);
  45. }
  46. void test5_calculatorDivide(void)
  47. {
  48. float p, q, a, e;
  49. p = 26207.2;
  50. q = 278.23;
  51. a = calculatorDivide(p, q);
  52. e = p/q;
  53. TEST_ASSERT_EQUAL_FLOAT(e, a);
  54. }
  55. void test6_calculatorDivide(void)
  56. {
  57. float p, q, a, e;
  58. p = 111;
  59. q = 21;
  60. a = calculatorDivide(p, q);
  61. e = p/q;
  62. TEST_ASSERT_EQUAL_FLOAT(e, a);
  63. }
  64. void test7_calculatorDivide(void)
  65. {
  66. float p, q, a, e;
  67. p = 167;
  68. q = 23.22;
  69. a = calculatorDivide(p, q);
  70. e = p/q;
  71. TEST_ASSERT_EQUAL_FLOAT(e, a);
  72. }
  73. void test8_calculatorDivide(void)
  74. {
  75. float p, q, a, e;
  76. p = 26124;
  77. q = 23022;
  78. a = calculatorDivide(p, q);
  79. e = p/q;
  80. TEST_ASSERT_EQUAL_FLOAT(e, a);
  81. }
  82. void test9_calculatorDivide(void)
  83. {
  84. float p, q, a, e;
  85. p = 1234;
  86. q = 4321;
  87. a = calculatorDivide(p, q);
  88. e = p/q;
  89. TEST_ASSERT_EQUAL_FLOAT(e, a);
  90. }
  91. void test10_calculatorDivide(void)
  92. {
  93. float p, q, a, e;
  94. p = 2345;
  95. q = 123.7;
  96. a = calculatorDivide(p, q);
  97. e = p/q;
  98. TEST_ASSERT_EQUAL_FLOAT(e, a);
  99. }
  100. #endif // TEST