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

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