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
3.5 KiB

  1. #include "unity.h"
  2. #include "../src/calculatorDivide.c"
  3. // Note:
  4. /* This Function may or may not be implemented in actual program, even if it is merged to the main branch.
  5. If it is temporarily not included in the main Program, then this has a role in future Development of the Project */
  6. void setUp(void)
  7. {
  8. }
  9. void tearDown(void)
  10. {
  11. }
  12. void test1_calculatorDivide(void)
  13. {
  14. float num1, num2, actual, expected; //Arrange
  15. num1 = 26.24;
  16. num2 = 23.22;
  17. expected = num1 / num2;
  18. actual = calculatorDivide(num1, num2); //Act
  19. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  20. }
  21. void test2_calculatorDivide(void)
  22. {
  23. float num1, num2, actual, expected; //Arrange
  24. num1 = 2236.24;
  25. num2 = 2123.22;
  26. expected = num1 / num2;
  27. actual = calculatorDivide(num1, num2); //Act
  28. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  29. }
  30. void test3_calculatorDivide(void)
  31. {
  32. float num1, num2, actual, expected; //Arrange
  33. num1 = 623.2;
  34. num2 = 23.22;
  35. expected = num1 / num2;
  36. actual = calculatorDivide(num1, num2); //Act
  37. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  38. }
  39. void test4_calculatorDivide(void)
  40. {
  41. float num1, num2, actual, expected; //Arrange
  42. num1 = 234.7;
  43. num2 = 124.2;
  44. expected = num1 / num2;
  45. actual = calculatorDivide(num1, num2); //Act
  46. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  47. }
  48. void test5_calculatorDivide(void)
  49. {
  50. float num1, num2, actual, expected; //Arrange
  51. num1 = 26207.2;
  52. num2 = 278.23;
  53. expected = num1 / num2;
  54. actual = calculatorDivide(num1, num2); //Act
  55. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  56. }
  57. void test6_calculatorDivide(void)
  58. {
  59. float num1, num2, actual, expected; //Arrange
  60. num1 = 111;
  61. num2 = 21;
  62. expected = num1 / num2;
  63. actual = calculatorDivide(num1, num2); //Act
  64. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  65. }
  66. void test7_calculatorDivide(void)
  67. {
  68. float num1, num2, actual, expected; //Arrange
  69. num1 = 167;
  70. num2 = 23.22;
  71. expected = num1 / num2;
  72. actual = calculatorDivide(num1, num2); //Act
  73. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  74. }
  75. void test8_calculatorDivide(void)
  76. {
  77. float num1, num2, actual, expected; //Arrange
  78. num1 = 26124;
  79. num2 = 23022;
  80. expected = num1 / num2;
  81. actual = calculatorDivide(num1, num2); //Act
  82. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  83. }
  84. void test9_calculatorDivide(void)
  85. {
  86. float num1, num2, actual, expected; //Arrange
  87. num1 = 1234;
  88. num2 = 4321;
  89. expected = num1 / num2;
  90. actual = calculatorDivide(num1, num2); //Act
  91. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  92. }
  93. void test10_calculatorDivide(void)
  94. {
  95. float num1, num2, actual, expected; //Arrange
  96. num1 = 2345;
  97. num2 = 123.7;
  98. expected = num1 / num2;
  99. actual = calculatorDivide(num1, num2); //Act
  100. TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert
  101. }