|
|
@ -0,0 +1,70 @@ |
|
|
|
#include "unity.h" |
|
|
|
#include "ggT.h" |
|
|
|
|
|
|
|
void setUp(){} |
|
|
|
void tearDown(){} |
|
|
|
|
|
|
|
void test_ggTOf5And10(){ |
|
|
|
//arrange |
|
|
|
int a = 5; |
|
|
|
int b = 10; |
|
|
|
int expected = 5; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = ggT(a,b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_ggTOfFirstNumberZero(){ |
|
|
|
//arrange |
|
|
|
int a = 0; |
|
|
|
int b = 5; |
|
|
|
int expected = 5; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = ggT(a,b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_ggTOfSecondNumberZero(){ |
|
|
|
//arrange |
|
|
|
int a = 10; |
|
|
|
int b = 0; |
|
|
|
int expected = 10; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = ggT(a,b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_ggTOfBothNumbersZero(){ |
|
|
|
//arrange |
|
|
|
int a = 0; |
|
|
|
int b = 0; |
|
|
|
int expected = 0; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = ggT(a,b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected,result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_ggTOfCoprimes(){ |
|
|
|
//arrange |
|
|
|
int a = 13; |
|
|
|
int b = 27; |
|
|
|
int expected = 1; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = ggT(a,b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected,result); |
|
|
|
} |