diff --git a/src/c/funktionen.c b/src/c/funktionen.c index 3f3f3c4..20d82c8 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -87,7 +87,13 @@ int o_wins_02_12_22(char board[][3]) { } } -int stringCharacterCounter(char string[]) { +int o_wins_00_01_02(char board[][3]) { + if (board[0][0] == 'O' && board[0][1] == 'O' && board[0][2] == 'O') { + return 1; + } +} + +int string_character_counter(char string[]) { int stringLength = 0; for (int i = 0; string[i] != '\0'; i++) { diff --git a/src/c/funktionen.h b/src/c/funktionen.h index 6247c37..bed723d 100644 --- a/src/c/funktionen.h +++ b/src/c/funktionen.h @@ -56,6 +56,9 @@ int o_wins_01_11_21(char board[][3]); int o_wins_02_12_22(char board[][3]); // prüft, ob O bei Index 02, 12, 22 ist. +int o_wins_00_01_02(char board[][3]); +// prüft, ob O bei Index 00, 01, 02 ist. + int string_character_counter(char string[]); diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 719bc23..e218424 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -320,6 +320,21 @@ void test_o_wins_onIndex_02_12_22(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_o_wins_onIndex_00_01_02(void) +{ + /* arrange */ + int actual; + int expected = 1; + + char board[][3] = {{'O','O','O'}, {' ',' ',' '}, {' ',' ',' '}}; + + /* act */ + actual = o_wins_00_01_02(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} + void test_stringLaenge_von_Kokosnuss(void) { /* arrange */