You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
722 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "currentCustomerAccountBalance.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_fetchBalanceFromBalanceString(void)
  11. {
  12. char balanceString[5][100] = {
  13. "balance=0",
  14. "balance=100",
  15. "balance=200",
  16. "balance=300",
  17. "balance=400"
  18. };
  19. float balance = 0;
  20. float result[5];
  21. float expected[5];
  22. for (int i = 0; i < 5; i++) {
  23. result[i] = fetchBalanceFromBalanceString(balanceString[i]);
  24. }
  25. for (int i = 0; i < 5; i++) {
  26. expected[i] = balance;
  27. balance += 100;
  28. }
  29. for (int i =0; i < 5; i++) {
  30. TEST_ASSERT_EQUAL_FLOAT(expected[i],result[i]);
  31. }
  32. }
  33. #endif // TEST