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.

25 lines
1010 B

  1. #include <unity.h>
  2. #include "../src/customerMenu.c"
  3. #include "../src/requestLoan.c"
  4. void test_customerChoiceForMenuEntry()
  5. {
  6. int decision = 1;
  7. /*customer choses to send money, return 1*/
  8. TEST_ASSERT_EQUAL_INT(1, customerChoiceForMenuItem(decision));
  9. /*customer choses to withdraw money, return 2*/
  10. decision = 2;
  11. TEST_ASSERT_EQUAL_INT(2, customerChoiceForMenuItem(decision));
  12. /*customer choses to deposit money, return 3*/
  13. decision = 3;
  14. TEST_ASSERT_EQUAL_INT(3, customerChoiceForMenuItem(decision));
  15. /*customer choses to request a loan, return 4*/
  16. decision = 4;
  17. TEST_ASSERT_EQUAL_INT(4, customerChoiceForMenuItem(decision));
  18. /*invalid input values, the return value should always be -1*/
  19. int arrayOfInvalidValues[] = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,0, 123,3247,6839,38593,3033,55055};
  20. int length = sizeof(arrayOfInvalidValues)/sizeof(int);
  21. for(int i=0;i<length;++i){
  22. TEST_ASSERT_EQUAL_INT(-1, customerChoiceForMenuItem(arrayOfInvalidValues[i]));
  23. }
  24. }