From 058e352336d9bc37e045c2111282382bc431cb35 Mon Sep 17 00:00:00 2001 From: fdai7892 Date: Wed, 7 Feb 2024 20:19:07 +0100 Subject: [PATCH] Unittest: vertikal gewinnt --- .../test_duellist_spielesammlung_projekt.c | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index 31107bf..dc12cd1 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -30,4 +30,39 @@ void test_coinflip_player_o_starts(void) { // Assert TEST_ASSERT_EQUAL(SUCCESS, result); TEST_ASSERT_TRUE(game.currentPlayer == PLAYER_X || game.currentPlayer == PLAYER_O); -} \ No newline at end of file +} + +void test_vertical_win(void) { + // Arrange + TicTacToeGame game = { .board = {{PLAYER_X, EMPTY, EMPTY}, + {PLAYER_X, EMPTY, EMPTY}, + {PLAYER_X, EMPTY, EMPTY}}, + .currentPlayer = PLAYER_O }; + + // Act + GameResult result = checkGameResult(&game); + + // Assert + TEST_ASSERT_EQUAL(GAME_WIN, result); +} + + + + + + + + + + + + + + + + + + + + +