From d5ef26db7fce0686efd3f58ebe8d60c179b70f01 Mon Sep 17 00:00:00 2001 From: fdai7775 Date: Fri, 2 Feb 2024 12:29:40 +0000 Subject: [PATCH] =?UTF-8?q?=C3=A4nderungen=20an=20Test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_tictactoe.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/test/test_tictactoe.c b/test/test_tictactoe.c index fdca226..31de0c1 100644 --- a/test/test_tictactoe.c +++ b/test/test_tictactoe.c @@ -50,19 +50,11 @@ void test_isValidMove_gueltigerZug(void) { void test_checkWinner_vertikalerGewinner(void) { /* arrangieren */ char result; - char board[3][3]; - - // 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'; + makeMove(1); + makeMove(4); + makeMove(7); /* handeln */ result = checkWinner(); @@ -74,19 +66,10 @@ void test_checkWinner_vertikalerGewinner(void) { void test_checkWinner_horizontalerGewinner(void) { /* arrangieren */ char result; - char board[3][3]; - - // 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 horizontalen Gewinner - board[0][0] = 'X'; - board[0][1] = 'X'; - board[0][2] = 'X'; + + makeMove(1); + makeMove(2); + makeMove(3); /* handeln */ result = checkWinner();