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.

58 lines
1.0 KiB

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "updateCustomerAccountBalance.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_updateAvailableAccountBalanceSuccess(void){
  11. /*
  12. int id1 = 1234;
  13. int id2 = 1327;
  14. int id3 = 1666;
  15. int newBalance1=500;
  16. int newBalance2=800;
  17. int newBalance3=700;
  18. bool results1=updateAvailableAccountBalance(id1,newBalance1);
  19. bool results2=updateAvailableAccountBalance(id2,newBalance2);
  20. bool results3=updateAvailableAccountBalance(id3,newBalance3);
  21. TEST_ASSERT_TRUE(results1);
  22. TEST_ASSERT_TRUE(results2);
  23. TEST_ASSERT_TRUE(results3);
  24. */
  25. /* Arrange */
  26. int length = 5;
  27. float amountToUpdate[] = {200.5, 340, 244.5, 340, 1200};
  28. int userIDs[] = {1234,1235,1236,1237,1238};
  29. float expectedValue[length];
  30. bool result[length];
  31. /* Act */
  32. for (int i = 0; i < length; i++) {
  33. result[i] = updateAvailableAccountBalance(userIDs[i],amountToUpdate[i]);
  34. }
  35. /* Assert */
  36. for (int i = 0; i < length; i++) {
  37. TEST_ASSERT_TRUE(result[i]);
  38. }
  39. }
  40. #endif