From d954780e2d239b4817738e1797e1215040818183 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 14:05:57 +0100 Subject: [PATCH 1/2] refactoring: standardized the test naming --- test/kgV/test_kgV.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/kgV/test_kgV.c b/test/kgV/test_kgV.c index 39d5d4b..454b7f0 100644 --- a/test/kgV/test_kgV.c +++ b/test/kgV/test_kgV.c @@ -6,7 +6,7 @@ void setUp(void){} void tearDown(void){} // Tests for common Cases: -void test_kgV8And6(void) { +void test_kgVOf8And6(void) { TEST_ASSERT_EQUAL_INT(24, kgV(8, 6)); } From fd14664ff1907e68bf579505092a565b88ae5b10 Mon Sep 17 00:00:00 2001 From: cxnnqr Date: Tue, 6 Feb 2024 14:12:34 +0100 Subject: [PATCH 2/2] refactoring: better variable naming --- src/kgV/kgV.c | 8 ++++---- src/kgV/kgV.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kgV/kgV.c b/src/kgV/kgV.c index 0bdb026..6c37f8f 100644 --- a/src/kgV/kgV.c +++ b/src/kgV/kgV.c @@ -2,16 +2,16 @@ #include #include "ggT.h" -int kgV(int a, int b){ +int kgV(int fistNumber, int secondNumber){ // Case for at least one number is Zero - if(a == 0 || b == 0) return 0; + if(fistNumber == 0 || secondNumber == 0) return 0; // Regular case of calculating the kgV - int kgV = a*b/ ggT(a, b); + int kgVResult = fistNumber*secondNumber/ ggT(fistNumber, secondNumber); // Getting the absolute value of the kgV - int absoluteKgV = abs(kgV); + int absoluteKgV = abs(kgVResult); return absoluteKgV; } \ No newline at end of file diff --git a/src/kgV/kgV.h b/src/kgV/kgV.h index 994b957..d1f51f1 100644 --- a/src/kgV/kgV.h +++ b/src/kgV/kgV.h @@ -1,6 +1,6 @@ #ifndef KGV_H #define KGV_H -int kgV(int a, int b); +int kgV(int firstNumber, int secondNumber); #endif