|
@ -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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|