Browse Source

Add test for withdrawSpecificAmount for failure

remotes/origin/feature/loan-eligibility
Shivam Chaudhary 2 years ago
parent
commit
f9e48c96da
  1. 22
      tests/test_withdrawMoney.c

22
tests/test_withdrawMoney.c

@ -63,6 +63,28 @@ void test_withdrawSpecificAmountSuccess(void) {
} }
void test_withdrawSpecificAmountFailure(void) {
/* Arrange */
int user_id[3] = {12034, 13027, 16606}; // Random wrong user_ids
bool result[3];
/* Act */
for (int i = 0; i < 3; i++) {
result[i] = withdrawSpecificAmount(user_id[i], 50);
}
/* Assert */
for (int i = 0; i < 3; i++) {
TEST_ASSERT_FALSE(result[i]); // Pass if withdrawal fails and function returns false
}
}

Loading…
Cancel
Save