Browse Source

bugfix: Karte mit Wert 10 kann auch Koenig sein + Test

remotes/origin/stefan
fdai7472 11 months ago
parent
commit
28ff8b9ff0
  1. 2
      src/main/c/Stefan/blackjack.c
  2. 14
      src/test/c/Stefan/test_blackjack.c

2
src/main/c/Stefan/blackjack.c

@ -266,7 +266,7 @@ char generateCardAscii(int cardValue){
case(0): cardValueAsChar = 'J'; break; case(0): cardValueAsChar = 'J'; break;
case(1): cardValueAsChar = 'Q'; break; case(1): cardValueAsChar = 'Q'; break;
case(2): cardValueAsChar = 'K'; break; case(2): cardValueAsChar = 'K'; break;
case(4): cardValueAsChar = '1';
case(3): cardValueAsChar = '1';
possibleZero = '0'; break; possibleZero = '0'; break;
default: cardValueAsChar = 'E'; break; // ERROR default: cardValueAsChar = 'E'; break; // ERROR
} }

14
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); 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);
}
Loading…
Cancel
Save