|
|
@ -73,6 +73,48 @@ void test_rockPaperScissors_differentResultsPlayerWins(void) |
|
|
|
TEST_ASSERT_EQUAL_INT('p', result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_rockPaperScissors_differentResultsPlayerLoses(void) |
|
|
|
{ |
|
|
|
/* arrange */ |
|
|
|
//Hier die Werte eingeben |
|
|
|
char result; //p=player, c=computer, n=none |
|
|
|
int inputPlayer = ROCK; |
|
|
|
int inputComputer = PAPER; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
//Die Funktion wird ausgeführt |
|
|
|
result = findWinner(inputPlayer, inputComputer); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
//Vergleichen |
|
|
|
TEST_ASSERT_EQUAL_INT('c', result); |
|
|
|
|
|
|
|
/* arrange */ |
|
|
|
//Hier die Werte eingeben |
|
|
|
inputPlayer = PAPER; |
|
|
|
inputComputer = SCISSORS; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
//Die Funktion wird ausgeführt |
|
|
|
result = findWinner(inputPlayer, inputComputer); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
//Vergleichen |
|
|
|
TEST_ASSERT_EQUAL_INT('c', result); |
|
|
|
|
|
|
|
/* arrange */ |
|
|
|
//Hier die Werte eingeben |
|
|
|
inputPlayer = SCISSORS; |
|
|
|
inputComputer = ROCK; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
//Die Funktion wird ausgeführt |
|
|
|
result = findWinner(inputPlayer, inputComputer); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
//Vergleichen |
|
|
|
TEST_ASSERT_EQUAL_INT('c', result); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |
|
|
|
|
|
|
@ -83,4 +125,5 @@ rockPaperScissors_differentResultsPlayerLoses |
|
|
|
rockPaperScissors_playerGetsBestOutOf3 |
|
|
|
rockPaperScissors_computerGetsBestOutOf3 |
|
|
|
rockPaperScissors_outputResult |
|
|
|
rockPaperScissors_invalidInput |
|
|
|
*/ |