From 14a59e865e271f400c9084eb534fd94acecf74f6 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 13:44:20 +0100 Subject: [PATCH 1/2] refactoring: added comments --- src/ggT/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ggT/main.c b/src/ggT/main.c index e9bc365..e32be86 100644 --- a/src/ggT/main.c +++ b/src/ggT/main.c @@ -3,10 +3,16 @@ #include int main(){ + + // Getting user input for the two numbers printf("Please add the two numbers you want the ggT of:\n"); int firstNum = usergetd("first number: ", 0, NULL); int secondNum = usergetd("second number: ", 0, NULL); + + // Calculating the ggT of those two numbers int result = ggT(firstNum, secondNum); + + // Print the result printf("The ggT of %d and %d is: %d\n", firstNum, secondNum, result); return 0; From 3bf80b712704a8420f4d224e267e578eac651514 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 13:46:17 +0100 Subject: [PATCH 2/2] refactoring: added comments --- test/ggT/test_ggT.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ggT/test_ggT.c b/test/ggT/test_ggT.c index 7e4beec..3f76bcd 100644 --- a/test/ggT/test_ggT.c +++ b/test/ggT/test_ggT.c @@ -4,10 +4,15 @@ void setUp(){} void tearDown(){} + +// Test for Common Case void test_ggTOf5And10(){ TEST_ASSERT_EQUAL_INT(5, ggT(5, 10)); } + + +// Tests for Cases with Zero in input void test_ggTOfFirstNumberZero(){ TEST_ASSERT_EQUAL_INT(5, ggT(0, 5)); } @@ -20,6 +25,9 @@ void test_ggTOfBothNumbersZero(){ TEST_ASSERT_EQUAL_INT(0, ggT(0, 0)); } + + +// Test for edge Case - Coprime Numbers void test_ggTOfCoprimes(){ TEST_ASSERT_EQUAL_INT(1, ggT(13, 27)); } \ No newline at end of file