Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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)
Exemple #5
0
 def test_incomplete(self):
     """
     Run incomplete game
     """
     self.assertEqual(
         ConnectZ("/usr/src/app/tests/incomplete.txt").run_game(), 3)
Exemple #6
0
 def test_draw(self):
     """
     Run draw game
     """
     self.assertEqual(ConnectZ("/usr/src/app/tests/draw.txt").run_game(), 0)
Exemple #7
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)
Exemple #8
0
 def test_for_missing_file(self):
     try:
         ConnectZ("/does/not/exist/file.txt")
     except Exception as e:
         self.assertEqual(e.code, 9)
Exemple #9
0
 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)