From eb5fe068b8078daecaf5658c2717147e0626f875 Mon Sep 17 00:00:00 2001 From: Shivam Chaudhary Date: Fri, 10 Feb 2023 12:34:39 +0100 Subject: [PATCH] Add success test for loan eligibility --- tests/test_checkLoanEligibility.c | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/test_checkLoanEligibility.c diff --git a/tests/test_checkLoanEligibility.c b/tests/test_checkLoanEligibility.c new file mode 100644 index 0000000..b14ca3d --- /dev/null +++ b/tests/test_checkLoanEligibility.c @@ -0,0 +1,36 @@ +#ifdef TEST + +#include "unity.h" +#include "checkLoanEligibility.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_checkLoanEligibilitySuccess(void) { + + /* Arrange */ + + int user_id[3] = {1234, 1327, 1666}; // user_ids from file for testing + + bool result[3]; + + /* Act */ + + for (int i = 0; i < 3; i++) { + result[i] = checkLoanEligibility(user_id[i]); + } + + /* Assert */ + + for (int i = 0; i < 3; i++) { + TEST_ASSERT_TRUE(result[i]); // Pass if user_id is found in the file + } +} + + +#endif // TEST \ No newline at end of file