Browse Source

Create test_currentCustomerAccountBalance.c

remotes/origin/feature/get-current-customer-account-balance
Shivam Chaudhary 2 years ago
parent
commit
548a152d46
  1. 46
      tests/test_currentCustomerAccountBalance.c

46
tests/test_currentCustomerAccountBalance.c

@ -0,0 +1,46 @@
#ifdef TEST
#include "unity.h"
#include "currentCustomerAccountBalance.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_fetchBalanceFromBalanceString(void)
{
char balanceString[5][100] = {
"balance=0",
"balance=100",
"balance=200",
"balance=300",
"balance=400"
};
float balance = 0;
float result[5];
float expected[5];
for (int i = 0; i < 5; i++) {
result[i] = fetchBalanceFromBalanceString(balanceString[i]);
}
for (int i = 0; i < 5; i++) {
expected[i] = balance;
balance += 100;
}
for (int i =0; i < 5; i++) {
TEST_ASSERT_EQUAL_FLOAT(expected[i],result[i]);
}
}
#endif // TEST
Loading…
Cancel
Save