Browse Source

game was not won yet

remotes/origin/SchereSteinPapier
Aimee Reincke 2 years ago
parent
commit
6ef9c9e436
  1. 3
      src/c/rockPaperScissors.c
  2. 17
      test/c/test_rockPaperScissors.c

3
src/c/rockPaperScissors.c

@ -35,6 +35,9 @@ int wasGameWon(roundsToWin, playerWins, computerWins){
else if (computerWins == roundsToWin){ else if (computerWins == roundsToWin){
winner = COMPUTERWINSGAME; winner = COMPUTERWINSGAME;
} }
else {
winner = NOTWONYET;
}
return winner; return winner;
} }

17
test/c/test_rockPaperScissors.c

@ -165,6 +165,23 @@ void test_rockPaperScissors_computerGetsBestOutOf3(void)
TEST_ASSERT_EQUAL_INT(COMPUTERWINSGAME, result); TEST_ASSERT_EQUAL_INT(COMPUTERWINSGAME, result);
} }
void test_rockPaperScissors_gameWasNotWon(void)
{
/* arrange */
//Hier die Werte eingeben
int result;
int roundsToWin = 2;
int playerWins = 1, computerWins = 1;
/* act */
//Die Funktion wird ausgeführt
result = wasGameWon(roundsToWin, playerWins, computerWins);
/* assert */
//Vergleichen
TEST_ASSERT_EQUAL_INT(NOTWONYET, result);
}
#endif // TEST #endif // TEST
/*Testcases: /*Testcases:

Loading…
Cancel
Save