def test_player_one_win_diagonal_down(self): """ Run player 1 wins with diagonal scenario """ self.assertEqual( ConnectZ( "/usr/src/app/tests/player_one_win_decline.txt").run_game(), 1)
def test_illegal_row(self): """ Run illegal row """ try: ConnectZ("/usr/src/app/tests/illegal_row.txt").run_game() except Exception as e: self.assertEqual(e.code, 5)
def test_illegal_continue(self): """ Run illegal continue game """ try: ConnectZ("/usr/src/app/tests/illegal_continue.txt").run_game() except Exception as e: self.assertEqual(e.code, 4)
def test_invalid_file(self): """ Test an invalid file """ try: ConnectZ("/usr/src/app/tests/invalid_file.txt").run_game() except Exception as e: self.assertEqual(e.code, 8)
def test_incomplete(self): """ Run incomplete game """ self.assertEqual( ConnectZ("/usr/src/app/tests/incomplete.txt").run_game(), 3)
def test_draw(self): """ Run draw game """ self.assertEqual(ConnectZ("/usr/src/app/tests/draw.txt").run_game(), 0)
def test_classic_connect(self): """ Run classic connect four game where players alternate columns """ self.assertEqual( ConnectZ("/usr/src/app/tests/classic.txt").run_game(), 1)
def test_for_missing_file(self): try: ConnectZ("/does/not/exist/file.txt") except Exception as e: self.assertEqual(e.code, 9)
def test_player_two_win(self): """ Run player 2 wins scenario """ self.assertEqual( ConnectZ("/usr/src/app/tests/player_two_win.txt").run_game(), 2)