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.

37 lines
692 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "withdrawMoney.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_initiateWithdraw(void) {
  11. float amountToWithdraw[] = {200.5, 340, 244.5, 340};
  12. float availableAccountBalance[] = {2000, 3400, 2445, 3400};
  13. float expectedValue[4];
  14. float result[4];
  15. for (int i = 0; i < 4; i++) {
  16. expectedValue[i] = ( availableAccountBalance[i] - amountToWithdraw[i] );
  17. }
  18. for (int i = 0; i < 4; i++) {
  19. result[i] = initiateWithdraw( amountToWithdraw[i], availableAccountBalance[i] );
  20. }
  21. for (int i = 0; i < 4; i++) {
  22. TEST_ASSERT_EQUAL_FLOAT(expectedValue[i],result[i]);
  23. }
  24. }
  25. #endif // TEST