diff --git a/src/c/funktionen.c b/src/c/funktionen.c index c6a3ec1..9ac25d1 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -73,6 +73,12 @@ int x_wins_10_11_12(char board[][3]) { } } +int x_wins_20_21_22(char board[][3]) { + if (board[2][0] == 'X' && board[2][1] == 'X' && board[2][2] == 'X') { + return 1; + } +} + int string_character_counter(char string[]) { int stringLength = 0; diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 06baa5b..640ac1b 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -151,6 +151,21 @@ void test_x_wins_onIndex_10_11_12(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_x_wins_onIndex_20_21_22(void) +{ + /* arrange */ + int actual; + int expected = 1; + + char board[][3] = {{' ',' ',' '}, {' ',' ',' '}, {'X','X','X'}}; + + /* act */ + actual = x_wins_20_21_22(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} + void test_stringLaenge_von_Kokosnuss(void) { /* arrange */