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.

122 lines
3.3 KiB

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