class TestDiagonalVictory(unittest.TestCase): def setUp(self): self.example_ticTacToe_game = TicTacToe(4) self.example_ticTacToe_game.make_move((0, 0)) self.example_ticTacToe_game.make_move((3, 0)) self.example_ticTacToe_game.make_move((1, 1)) self.example_ticTacToe_game.make_move((3, 1)) self.example_ticTacToe_game.make_move((2, 2)) self.example_ticTacToe_game.make_move((3, 2)) def test_diagonal_victory_top_left_to_bottom_right(self): self.example_ticTacToe_game.make_move((3, 3)) self.assertTrue(self.example_ticTacToe_game.is_diagonal_victory()) def test_digital_victory_top_right_to_bottom_left(self): example_tictactoe = TicTacToe(4) example_tictactoe.make_move((0, 3)) example_tictactoe.make_move((0, 0)) example_tictactoe.make_move((1, 2)) example_tictactoe.make_move((1, 0)) example_tictactoe.make_move((2, 1)) example_tictactoe.make_move((2, 0)) example_tictactoe.make_move((3, 0)) self.assertTrue(example_tictactoe.is_diagonal_victory()) def test_no_digital_victory(self): self.assertFalse(self.example_ticTacToe_game.is_vertical_victory())
class TestVerticalVictory(unittest.TestCase): def setUp(self): self.example_ticTacToe_game = TicTacToe(4) self.example_ticTacToe_game.make_move((0, 0)) self.example_ticTacToe_game.make_move((3, 3)) self.example_ticTacToe_game.make_move((1, 0)) self.example_ticTacToe_game.make_move((2, 3)) self.example_ticTacToe_game.make_move((2, 0)) self.example_ticTacToe_game.make_move((1, 3)) def test_vertical_victory(self): self.example_ticTacToe_game.make_move((3, 0)) self.assertTrue(self.example_ticTacToe_game.is_vertical_victory()) def test_no_vertical_victory(self): self.assertFalse(self.example_ticTacToe_game.is_vertical_victory())