From 7b82e04292b59bcaa1ed93f97cc63d11aa17a943 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 12:54:28 +0100 Subject: [PATCH] refactoring: summarized tests --- test/ggT/test_ggT.c | 55 +++++---------------------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/test/ggT/test_ggT.c b/test/ggT/test_ggT.c index 6c14258..7e4beec 100644 --- a/test/ggT/test_ggT.c +++ b/test/ggT/test_ggT.c @@ -5,66 +5,21 @@ 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); + TEST_ASSERT_EQUAL_INT(5, ggT(5, 10)); } 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); + TEST_ASSERT_EQUAL_INT(5, ggT(0, 5)); } 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); + TEST_ASSERT_EQUAL_INT(10, ggT(10, 0)); } 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); + TEST_ASSERT_EQUAL_INT(0, ggT(0, 0)); } 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); + TEST_ASSERT_EQUAL_INT(1, ggT(13, 27)); } \ No newline at end of file