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.

69 lines
1.0 KiB

  1. #include "unity.h"
  2. #include "ggT.h"
  3. void setUp(){}
  4. void tearDown(){}
  5. void test_ggTOf5And10(){
  6. //arrange
  7. int a = 5;
  8. int b = 10;
  9. int expected = 5;
  10. //act
  11. int result = ggT(a,b);
  12. //assert
  13. TEST_ASSERT_EQUAL_INT(expected, result);
  14. }
  15. void test_ggTOf0AndPositiveNumber(){
  16. //arrange
  17. int a = 0;
  18. int b = 5;
  19. int expected = 5;
  20. //act
  21. int result = ggT(a,b);
  22. //assert
  23. TEST_ASSERT_EQUAL_INT(expected, result);
  24. }
  25. void test_ggTOfPositiveAnd0(){
  26. //arrange
  27. int a = 10;
  28. int b = 0;
  29. int expected = 10;
  30. //act
  31. int result = ggT(a,b);
  32. //assert
  33. TEST_ASSERT_EQUAL_INT(expected, result);
  34. }
  35. void test_ggTOfBoth0(){
  36. //arrange
  37. int a = 0;
  38. int b = 0;
  39. int expected = 0;
  40. //act
  41. int result = ggT(a,b);
  42. //assert
  43. TEST_ASSERT_EQUAL_INT(expected,result);
  44. }
  45. void test_ggTOfCoprimes(){
  46. //arrange
  47. int a = 13;
  48. int b = 27;
  49. int expected = 1;
  50. //act
  51. int result = ggT(a,b);
  52. //assert
  53. TEST_ASSERT_EQUAL_INT(expected,result);
  54. }