|
|
@ -6,105 +6,33 @@ void setUp(void){} |
|
|
|
void tearDown(void){} |
|
|
|
|
|
|
|
void test_kgV8And6(void) { |
|
|
|
//arrange |
|
|
|
int a = 8; |
|
|
|
int b = 6; |
|
|
|
int expected = 24; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(24, kgV(8, 6)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfFirstNumberZero(){ |
|
|
|
//arrange |
|
|
|
int a = 0; |
|
|
|
int b = 5; |
|
|
|
int expected = 0; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, kgV(0, 5)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfSecondNumberZero(){ |
|
|
|
//arrange |
|
|
|
int a = 5; |
|
|
|
int b = 0; |
|
|
|
int expected = 0; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, kgV(5, 0)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfBothNumbersZero(){ |
|
|
|
//arrange |
|
|
|
int a = 0; |
|
|
|
int b = 0; |
|
|
|
int expected = 0; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, kgV(0, 0)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOf2And17(){ |
|
|
|
//arrange |
|
|
|
int a = 2; |
|
|
|
int b = 17; |
|
|
|
int expected = 34; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(34, kgV(2, 17)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfFirstNumberNegative(){ |
|
|
|
//arrange |
|
|
|
int a = -2; |
|
|
|
int b = 17; |
|
|
|
int expected = 34; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(34, kgV(-2, 17)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfSecondNumberNegative(){ |
|
|
|
//arrange |
|
|
|
int a = 2; |
|
|
|
int b = -17; |
|
|
|
int expected = 34; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(34, kgV(2, -17)); |
|
|
|
} |
|
|
|
|
|
|
|
void test_kgVOfBothNumbersNegative(){ |
|
|
|
//arrange |
|
|
|
int a = -2; |
|
|
|
int b = -17; |
|
|
|
int expected = 34; |
|
|
|
|
|
|
|
//act |
|
|
|
int result = kgV(a, b); |
|
|
|
|
|
|
|
//assert |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
TEST_ASSERT_EQUAL_INT(34, kgV(-2, -17)); |
|
|
|
} |