From dd1d602be5f62ed01e67684fbc88d872c039a082 Mon Sep 17 00:00:00 2001 From: fdai7892 Date: Wed, 7 Feb 2024 20:22:32 +0100 Subject: [PATCH] Unittest: diagonal gewinnt --- src/test/test_duellist_spielesammlung_projekt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index f6a6664..c74dc9e 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -59,7 +59,19 @@ void test_horizontal_win(void) { // Assert TEST_ASSERT_EQUAL(GAME_WIN, result); } +void test_diagonal_win(void) { + // Arrange + TicTacToeGame game = { .board = {{PLAYER_X, EMPTY, EMPTY}, + {EMPTY, PLAYER_X, EMPTY}, + {EMPTY, EMPTY, PLAYER_X}}, + .currentPlayer = PLAYER_O }; + // Act + GameResult result = checkGameResult(&game); + + // Assert + TEST_ASSERT_EQUAL(GAME_WIN, result); +}