From 28ff8b9ff058e4b3bf42bd475b394d673e607388 Mon Sep 17 00:00:00 2001 From: fdai7472 Date: Tue, 6 Feb 2024 14:43:34 +0100 Subject: [PATCH] bugfix: Karte mit Wert 10 kann auch Koenig sein + Test --- src/main/c/Stefan/blackjack.c | 2 +- src/test/c/Stefan/test_blackjack.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/c/Stefan/blackjack.c b/src/main/c/Stefan/blackjack.c index c358caf..0b376f2 100644 --- a/src/main/c/Stefan/blackjack.c +++ b/src/main/c/Stefan/blackjack.c @@ -266,7 +266,7 @@ char generateCardAscii(int cardValue){ case(0): cardValueAsChar = 'J'; break; case(1): cardValueAsChar = 'Q'; break; case(2): cardValueAsChar = 'K'; break; - case(4): cardValueAsChar = '1'; + case(3): cardValueAsChar = '1'; possibleZero = '0'; break; default: cardValueAsChar = 'E'; break; // ERROR } diff --git a/src/test/c/Stefan/test_blackjack.c b/src/test/c/Stefan/test_blackjack.c index f65013b..9497d5e 100644 --- a/src/test/c/Stefan/test_blackjack.c +++ b/src/test/c/Stefan/test_blackjack.c @@ -227,3 +227,17 @@ void test_generate_char_for_card_9() { TEST_ASSERT_EQUAL_CHAR(expected_result, actual_result); } + +void test_generate_char_for_card_5() { + + //arrange + int cardValue = 5; + char expected_result = '5'; + + //act + char actual_result = generateCardAscii(cardValue); + + //assert + TEST_ASSERT_EQUAL_CHAR(expected_result, actual_result); + +} \ No newline at end of file