diff --git a/test/test_CustomerMenu.c b/test/test_CustomerMenu.c new file mode 100644 index 0000000..4ba1f23 --- /dev/null +++ b/test/test_CustomerMenu.c @@ -0,0 +1,24 @@ +#include +#include "../src/customerMenu.c" + +void test_customerChoiceForMenuEntry() +{ + int decision = 1; + /*customer choses to send money, return 1*/ + TEST_ASSERT_EQUAL_INT(1, customerChoiceForMenuItem(decision)); + /*customer choses to withdraw money, return 2*/ + decision = 2; + TEST_ASSERT_EQUAL_INT(2, customerChoiceForMenuItem(decision)); + /*customer choses to deposit money, return 3*/ + decision = 3; + TEST_ASSERT_EQUAL_INT(3, customerChoiceForMenuItem(decision)); + /*customer choses to request a loan, return 4*/ + decision = 4; + TEST_ASSERT_EQUAL_INT(4, customerChoiceForMenuItem(decision)); + /*invalid input values, the return value should always be -1*/ + 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}; + int length = sizeof(arrayOfInvalidValues)/sizeof(int); + for(int i=0;i