Browse Source

Unittest: gültige Eingabe & Spielerwechsel

remotes/origin/homan
fdai7892 11 months ago
parent
commit
c85cef412b
  1. 13
      src/test/test_duellist_spielesammlung_projekt.c

13
src/test/test_duellist_spielesammlung_projekt.c

@ -73,7 +73,20 @@ void test_diagonal_win(void) {
TEST_ASSERT_EQUAL(GAME_WIN, result); 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);
}

Loading…
Cancel
Save