Browse Source

Add success test for withdrawSpecificAmount function

remotes/origin/feature/loan-eligibility
Shivam Chaudhary 2 years ago
parent
commit
c548a56865
  1. 6
      src/CustomerData.txt
  2. 22
      tests/test_withdrawMoney.c

6
src/CustomerData.txt

@ -3,18 +3,18 @@ ID=1234
forename=Max forename=Max
Surname=Mustermann Surname=Mustermann
password=example password=example
balance=2390
balance=2340
1327=example 1327=example
ID=1327 ID=1327
forename=Max forename=Max
Surname=Mustermann Surname=Mustermann
password=example password=example
balance=70
balance=20
1666=example 1666=example
ID=1666 ID=1666
forename=Max forename=Max
Surname=Mustermann Surname=Mustermann
password=example password=example
balance=240
balance=190

22
tests/test_withdrawMoney.c

@ -41,6 +41,28 @@ void test_initiateWithdraw(void) {
} }
void test_withdrawSpecificAmountSuccess(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] = withdrawSpecificAmount(user_id[i], 50);
}
/* Assert */
for (int i = 0; i < 3; i++) {
TEST_ASSERT_TRUE(result[i]); // Pass if withdrawal is successful
}
}

Loading…
Cancel
Save