From b796599129a05667e4436601ecd4e23a017e39f1 Mon Sep 17 00:00:00 2001 From: fdai7514 Date: Tue, 7 Feb 2023 16:47:02 +0100 Subject: [PATCH] refactoring: change variable names and attach descriptive comments in calculatorGetUserInputFactorial.c --- src/calculatorGetUserInputFactorial.c | 14 +++++++++----- src/calculatorGetUserInputFactorial.h | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/calculatorGetUserInputFactorial.c b/src/calculatorGetUserInputFactorial.c index 661e1ec..0f556e8 100644 --- a/src/calculatorGetUserInputFactorial.c +++ b/src/calculatorGetUserInputFactorial.c @@ -1,16 +1,20 @@ #include "calculatorGetUserInputFactorial.h" -int allowWhen() +// Note: +/* This Function may or may not be implemented in actual program, even if it is merged to the main branch. + If it is temporarily not included in the main Program, then this has a role in future Development of the Project */ + +int allowWhen()// int allowWhen() is helpful for indirectly unittesting void calculatorGetUserInputFactorial() { - if(q == 1) + if(utc == 1) return 1; } -void calculatorGetUserInputFactorial(int *z) +void calculatorGetUserInputFactorial(int *num) { - if(allowWhen() == 1) + if(allowWhen() == 1)//Only when int allowWhen() returns 1, void calculatorGetUserInputFactorial() will display desired Output { printf("num: "); - scanf("%d", z); + scanf("%d", num); } } diff --git a/src/calculatorGetUserInputFactorial.h b/src/calculatorGetUserInputFactorial.h index 272bb52..d8da77c 100644 --- a/src/calculatorGetUserInputFactorial.h +++ b/src/calculatorGetUserInputFactorial.h @@ -3,8 +3,8 @@ #include #include int allowWhen(); -const int q = 1; -void calculatorGetUserInputFactorial(int *z); +const int utc = 1; //ufc is unitTestConstant, which has a role in unittesting void calculatorGetUserInputFactorial() +void calculatorGetUserInputFactorial(int *num); #endif // CALCULATORGETUSERINPUTFACTORIAL_H