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.

97 lines
1.5 KiB

  1. #include "unity.h"
  2. #include "kgV.h"
  3. #include "ggT.h"
  4. void setUp(void){}
  5. void tearDown(void){}
  6. void test_kgV8And6(void) {
  7. //arrange
  8. int a = 8;
  9. int b = 6;
  10. int expected = 24;
  11. //act
  12. int result = kgV(a, b);
  13. //assert
  14. TEST_ASSERT_EQUAL_INT(expected, result);
  15. }
  16. void test_kgVOfFirstNumberZero(){
  17. //arrange
  18. int a = 0;
  19. int b = 5;
  20. int expected = 0;
  21. //act
  22. int result = kgV(a, b);
  23. //assert
  24. TEST_ASSERT_EQUAL_INT(expected, result);
  25. }
  26. void test_kgVOfSecondNumberZero(){
  27. //arrange
  28. int a = 5;
  29. int b = 0;
  30. int expected = 0;
  31. //act
  32. int result = kgV(a, b);
  33. //assert
  34. TEST_ASSERT_EQUAL_INT(expected, result);
  35. }
  36. void test_kgVOfBothNumbersZero(){
  37. //arrange
  38. int a = 0;
  39. int b = 0;
  40. int expected = 0;
  41. //act
  42. int result = kgV(a, b);
  43. //assert
  44. TEST_ASSERT_EQUAL_INT(expected, result);
  45. }
  46. void test_kgVOf2And17(){
  47. //arrange
  48. int a = 2;
  49. int b = 17;
  50. int expected = 34;
  51. //act
  52. int result = kgV(a, b);
  53. //assert
  54. TEST_ASSERT_EQUAL_INT(expected, result);
  55. }
  56. void test_kgVOfFirstNumberNegative(){
  57. //arrange
  58. int a = -2;
  59. int b = 17;
  60. int expected = 34;
  61. //act
  62. int result = kgV(a, b);
  63. //assert
  64. TEST_ASSERT_EQUAL_INT(expected, result);
  65. }
  66. void test_kgVOfSecondNumberNegative(){
  67. //arrange
  68. int a = 2;
  69. int b = -17;
  70. int expected = 34;
  71. //act
  72. int result = kgV(a, b);
  73. //assert
  74. TEST_ASSERT_EQUAL_INT(expected, result);
  75. }