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.

121 lines
3.2 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "calculatorSubtract.h"
  4. // Note:
  5. /* This Function may or may not be implemented in actual program, even if it is merged to the main branch.
  6. If it is temporarily not included in the main Program, then this has a role in future Development of the Project */
  7. void setUp(void)
  8. {
  9. }
  10. void tearDown(void)
  11. {
  12. }
  13. void test1_calculatorSubtract(void)
  14. {
  15. float num1, num2, actual, expected; //Arrange
  16. num1 = 123.211;
  17. num2 = 112.21;
  18. expected = num1 - num2;
  19. actual = calculatorSubtract(num1, num2); //Act
  20. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  21. }
  22. void test2_calculatorSubtract(void)
  23. {
  24. float num1, num2, actual, expected; //Arrange
  25. num1 = 13.21;
  26. num2 = 112.21;
  27. expected = num1 - num2;
  28. actual = calculatorSubtract(num1, num2); //Act
  29. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  30. }
  31. void test3_calculatorSubtract(void)
  32. {
  33. float num1, num2, actual, expected; //Arrange
  34. num1 = 12231.211;
  35. num2 = 1122.21;
  36. expected = num1 - num2;
  37. actual = calculatorSubtract(num1, num2); //Act
  38. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  39. }
  40. void test4_calculatorSubtract(void)
  41. {
  42. float num1, num2, actual, expected; //Arrange
  43. num1 = 113453.211;
  44. num2 = 11254.21;
  45. expected = num1 - num2;
  46. actual = calculatorSubtract(num1, num2); //Act
  47. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  48. }
  49. void test5_calculatorSubtract(void)
  50. {
  51. float num1, num2, actual, expected; //Arrange
  52. num1 = 12133.211;
  53. num2 = 112.231;
  54. expected = num1 - num2;
  55. actual = calculatorSubtract(num1, num2); //Act
  56. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  57. }
  58. void test6_calculatorSubtract(void)
  59. {
  60. float num1, num2, actual, expected; //Arrange
  61. num1 = 1133.201;
  62. num2 = 11221.21;
  63. expected = num1 - num2;
  64. actual = calculatorSubtract(num1, num2); //Act
  65. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  66. }
  67. void test7_calculatorSubtract(void)
  68. {
  69. float num1, num2, actual, expected; //Arrange
  70. num1 = 12213.2211;
  71. num2 = 111.21;
  72. expected = num1 - num2;
  73. actual = calculatorSubtract(num1, num2); //Act
  74. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  75. }
  76. void test8_calculatorSubtract(void)
  77. {
  78. float num1, num2, actual, expected; //Arrange
  79. num1 = 16213.711;
  80. num2 = 1214.2251;
  81. expected = num1 - num2;
  82. actual = calculatorSubtract(num1, num2); //Act
  83. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  84. }
  85. void test9_calculatorSubtract(void)
  86. {
  87. float num1, num2, actual, expected; //Arrange
  88. num1 = 1933.611;
  89. num2 = 1432.21;
  90. expected = num1 - num2;
  91. actual = calculatorSubtract(num1, num2); //Act
  92. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  93. }
  94. void test10_calculatorSubtract(void)
  95. {
  96. float num1, num2, actual, expected; //Arrange
  97. num1 = 1233.811;
  98. num2 = 1121.131;
  99. expected = num1 - num2;
  100. actual = calculatorSubtract(num1, num2); //Act
  101. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  102. }
  103. #endif // TEST