|
|
@ -134,25 +134,23 @@ void test_validChoiceInput(void) |
|
|
|
|
|
|
|
int validInput[4]; |
|
|
|
|
|
|
|
bool validInputResult[4]; |
|
|
|
bool validInputExpected = true; |
|
|
|
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
for(int i = 0; i < 4; i++) |
|
|
|
{ |
|
|
|
validInput[i] = i + 1; |
|
|
|
} |
|
|
|
|
|
|
|
/*Act and Asssert*/ |
|
|
|
|
|
|
|
for(int i = 0; i < 4; i++) |
|
|
|
{ |
|
|
|
validInputResult[i] = chooseOption(validInput[i]); |
|
|
|
} |
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
bool validInputResult = chooseOption(validInput[i]); |
|
|
|
|
|
|
|
for(int i = 0; i < 4; i++) |
|
|
|
{ |
|
|
|
TEST_ASSERT_TRUE(validInputResult[i]); |
|
|
|
TEST_ASSERT_EQUAL(validInputExpected,validInputResult); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -165,25 +163,24 @@ void test_invalidChoiceInput_firstCase(void) |
|
|
|
|
|
|
|
int invalidInput[100]; |
|
|
|
|
|
|
|
bool invalidInputResult[100]; |
|
|
|
bool invalidInputExpected = false; |
|
|
|
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
for(int i = -100; i < 0; i++) |
|
|
|
for(int i = -100; i < 1; i++) |
|
|
|
{ |
|
|
|
invalidInput[i+100] = i; |
|
|
|
} |
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
for(int i = 0; i < 100; i++) |
|
|
|
{ |
|
|
|
invalidInputResult[i] = chooseOption(invalidInput[i]); |
|
|
|
} |
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
bool invalidInputResult = chooseOption(invalidInput[i]); |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL(invalidInputExpected,invalidInputResult); |
|
|
|
|
|
|
|
for(int i = 0; i < 100; i++) |
|
|
|
{ |
|
|
|
TEST_ASSERT_FALSE(invalidInputResult[i]); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -196,27 +193,23 @@ void test_invalidChoiceInput_secondCase(void) |
|
|
|
|
|
|
|
int invalidInput[100]; |
|
|
|
|
|
|
|
bool invalidInputResult[100]; |
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
bool invalidInputExpected = false; |
|
|
|
|
|
|
|
for(int i = 0; i < 100; i++) |
|
|
|
{ |
|
|
|
invalidInput[i] = i + 5; |
|
|
|
} |
|
|
|
|
|
|
|
for(int i = 0; i < 100; i++) |
|
|
|
{ |
|
|
|
invalidInputResult[i] = chooseOption(invalidInput[i]); |
|
|
|
} |
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
for(int i = 0; i < 100; i++) |
|
|
|
{ |
|
|
|
TEST_ASSERT_FALSE(invalidInputResult[i]); |
|
|
|
bool invalidInputResult = chooseOption(invalidInput[i]); |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL(invalidInputExpected,invalidInputResult); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|