diff --git a/src/c/rockPaperScissors.c b/src/c/rockPaperScissors.c index 40598d7..4f482e4 100644 --- a/src/c/rockPaperScissors.c +++ b/src/c/rockPaperScissors.c @@ -35,6 +35,9 @@ int wasGameWon(roundsToWin, playerWins, computerWins){ else if (computerWins == roundsToWin){ winner = COMPUTERWINSGAME; } + else { + winner = NOTWONYET; + } return winner; } diff --git a/test/c/test_rockPaperScissors.c b/test/c/test_rockPaperScissors.c index eb74c62..49a6b99 100644 --- a/test/c/test_rockPaperScissors.c +++ b/test/c/test_rockPaperScissors.c @@ -165,6 +165,23 @@ void test_rockPaperScissors_computerGetsBestOutOf3(void) 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 /*Testcases: