From dc9396d7ed7ffd6970bd630c1943a96d8c79d07d Mon Sep 17 00:00:00 2001 From: Ronja Awe Date: Mon, 23 Jan 2023 19:23:17 +0100 Subject: [PATCH] =?UTF-8?q?if=20schleife=20verloren=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/raetselronja.c | 4 ++++ test/c/test_raetselronja.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/c/raetselronja.c b/src/c/raetselronja.c index 40ff2e8..6a3f5e3 100644 --- a/src/c/raetselronja.c +++ b/src/c/raetselronja.c @@ -143,6 +143,10 @@ int blackjack(int spieler, int geber, int janein){ printf("Geber hat gewonnen."); return 2; } + if (geber > 21 && spieler > 21) { + printf("Verloren"); + return 0; + } } } diff --git a/test/c/test_raetselronja.c b/test/c/test_raetselronja.c index 2d3bc55..a65fba2 100644 --- a/test/c/test_raetselronja.c +++ b/test/c/test_raetselronja.c @@ -181,5 +181,24 @@ void test_runRaetselTestBJifende2(void){ } +void test_runRaetselTestBJifende3(void){ + + int spieler = 0; + int geber = 0; + int janein = 0; + + userInput_ExpectAndReturn(1); + randnum_ExpectAndReturn(10); + randnum_ExpectAndReturn(10); + userInput_ExpectAndReturn(1); + randnum_ExpectAndReturn(10); + randnum_ExpectAndReturn(10); + userInput_ExpectAndReturn(1); + + + int result = blackjack(spieler, geber, janein); + TEST_ASSERT_EQUAL_INT(0, result); + +} #endif // TEST \ No newline at end of file