diff --git a/src/main/c/GameTic_Tac_Toe/tictactoe.h b/src/main/c/GameTic_Tac_Toe/tictactoe.h index a972d36..67f34cb 100644 --- a/src/main/c/GameTic_Tac_Toe/tictactoe.h +++ b/src/main/c/GameTic_Tac_Toe/tictactoe.h @@ -1,7 +1,9 @@ #ifndef TICTACTOE_H #define TICTACTOE_H +int isValidMove(int choice); char checkLine(char a, char b, char c); void start_tictactoe(); +char checkWinner(); #endif diff --git a/test/test_tictactoe.c b/test/test_tictactoe.c index fb2e499..d7c864b 100644 --- a/test/test_tictactoe.c +++ b/test/test_tictactoe.c @@ -46,6 +46,7 @@ void test_checkLine_horizontalerGewinner(void) { TEST_ASSERT_EQUAL_CHAR('X', result); } + void test_isValidMove_gueltigerZug(void) { /* arrangieren */ int result; @@ -57,4 +58,29 @@ void test_isValidMove_gueltigerZug(void) { /* überprüfen */ TEST_ASSERT_EQUAL_INT(1, result); } + + +void test_checkWinner_vertikalerGewinner(void) { + /* arrangieren */ + char result; + + // Initialisiere das Spielfeld + for (int i = 0; i < BOARD_SIZE; i++) { + for (int j = 0; j < BOARD_SIZE; j++) { + board[i][j] = (char)('1' + i * BOARD_SIZE + j); + } + } + + // Setze die Daten für einen vertikalen Gewinner + board[0][0] = 'O'; + board[1][0] = 'O'; + board[2][0] = 'O'; + + /* handeln */ + result = checkWinner(); + + /* überprüfen */ + TEST_ASSERT_EQUAL_CHAR('O', result); +} + #endif // TEST