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.

24 lines
978 B

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