|
|
@ -89,8 +89,33 @@ void test_valid_move_and_switch_player(void) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_invalid_input(void) { |
|
|
|
// Arrange |
|
|
|
TicTacToeGame game = { .board = {{PLAYER_X, EMPTY, EMPTY}, |
|
|
|
{EMPTY, EMPTY, EMPTY}, |
|
|
|
{EMPTY, EMPTY, EMPTY}}, |
|
|
|
.currentPlayer = PLAYER_O }; |
|
|
|
|
|
|
|
// Act |
|
|
|
GameResult result = makeMove(&game, 0, 0); |
|
|
|
|
|
|
|
// Assert |
|
|
|
TEST_ASSERT_EQUAL(INVALID_MOVE, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_valid_input(void) { |
|
|
|
// Arrange |
|
|
|
TicTacToeGame game = { .board = {{EMPTY, EMPTY, EMPTY}, |
|
|
|
{EMPTY, EMPTY, EMPTY}, |
|
|
|
{EMPTY, EMPTY, EMPTY}}, |
|
|
|
.currentPlayer = PLAYER_X }; |
|
|
|
|
|
|
|
// Act |
|
|
|
GameResult result = makeMove(&game, 1, 1); |
|
|
|
|
|
|
|
// Assert |
|
|
|
TEST_ASSERT_EQUAL(SUCCESS, result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|