From b9a28f43b3c42e78e35d26467688d5ccee4c6e09 Mon Sep 17 00:00:00 2001 From: Shivam Chaudhary Date: Fri, 10 Feb 2023 12:37:32 +0100 Subject: [PATCH] Add failure test for loan eligibility --- tests/test_checkLoanEligibility.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_checkLoanEligibility.c b/tests/test_checkLoanEligibility.c index b14ca3d..4107a62 100644 --- a/tests/test_checkLoanEligibility.c +++ b/tests/test_checkLoanEligibility.c @@ -32,5 +32,26 @@ void test_checkLoanEligibilitySuccess(void) { } } +void test_checkLoanEligibilityFailure(void) { + + /* Arrange */ + + int user_id[3] = {12314, 127, 166}; // Random wrong user_ids + + 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_FALSE(result[i]); // Pass if the returned result is false + } +} + #endif // TEST \ No newline at end of file