From c85cef412bca4f86d028101ce3d6b3cc3f78fec4 Mon Sep 17 00:00:00 2001 From: fdai7892 Date: Wed, 7 Feb 2024 20:25:53 +0100 Subject: [PATCH] =?UTF-8?q?Unittest:=20g=C3=BCltige=20Eingabe=20&=20Spiele?= =?UTF-8?q?rwechsel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/test_duellist_spielesammlung_projekt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index c74dc9e..b990cfe 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -73,7 +73,20 @@ void test_diagonal_win(void) { TEST_ASSERT_EQUAL(GAME_WIN, result); } +void test_valid_move_and_switch_player(void) { + // Arrange + TicTacToeGame game = { .board = {{EMPTY, EMPTY, EMPTY}, + {EMPTY, EMPTY, EMPTY}, + {EMPTY, EMPTY, EMPTY}}, + .currentPlayer = PLAYER_X }; + // Act + GameResult moveResult = makeMove(&game, 1, 1); + + // Assert + TEST_ASSERT_EQUAL(SUCCESS, moveResult); + TEST_ASSERT_EQUAL(PLAYER_O, game.currentPlayer); +}