From 6ef9c9e436dd4f963145197e9b5e8806b17f5dd5 Mon Sep 17 00:00:00 2001 From: Aimee Reincke Date: Sun, 15 Jan 2023 17:11:55 +0100 Subject: [PATCH] game was not won yet --- src/c/rockPaperScissors.c | 3 +++ test/c/test_rockPaperScissors.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) 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: