|
@ -30,4 +30,39 @@ void test_coinflip_player_o_starts(void) { |
|
|
// Assert |
|
|
// Assert |
|
|
TEST_ASSERT_EQUAL(SUCCESS, result); |
|
|
TEST_ASSERT_EQUAL(SUCCESS, result); |
|
|
TEST_ASSERT_TRUE(game.currentPlayer == PLAYER_X || game.currentPlayer == PLAYER_O); |
|
|
TEST_ASSERT_TRUE(game.currentPlayer == PLAYER_X || game.currentPlayer == PLAYER_O); |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|