예제 #1
0
 def test_check_horizontal_x_doesnt_will_only_1_x_each_side(self):
     """Xs doesn't win -> 1 X to lhs, and 1 X to the rhs."""
     test_board = [
         [Game.Xs], [Game.Xs], [Game.Xs], [Game.Os],
         [Game.EMPTY], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 1, 0)
     self.assertFalse(has_won)
예제 #2
0
 def test_check_horizontal_x_doesnt_win_place_at_end_4_across(self):
     """Xs doesn't win -> Noting to rhs, and 3 Xs to the left."""
     test_board = [
         [Game.Os], [Game.Os], [Game.Xs], [Game.Os],
         [Game.EMPTY], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 8, 0)
     self.assertFalse(has_won)
예제 #3
0
 def test_check_horizontal_x_doesnt_win_place_in_middle_4_across(self):
     """Xs doesn't win -> 1 X to the rhs & 2 Xs to the lhs."""
     test_board = [
         [Game.Os], [Game.Os], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs],
         [Game.Os], [Game.Os], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 4, 0)
     self.assertFalse(has_won)
예제 #4
0
 def test_check_horizontal_x_wins_5_across_place_disc_in_middle(self):
     """Xs wins -> 5 in a row horizontally accross top (left and right)"""
     test_board = [
         [Game.Os], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs],
         [Game.Os], [Game.Os], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 3, 0)
     self.assertTrue(has_won)
예제 #5
0
 def test_check_horizontal_bug_x_wins_5_across_to_left_place_at_end(self):
     """Xs wins -> 5 in a row (left): Off by one error."""
     test_board = [
         [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs],
         [Game.Os], [Game.Os], [Game.Os], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 4, 0)
     self.assertTrue(has_won)
예제 #6
0
 def test_check_horizontal_x_wins_5_across_to_left(self):
     """Xs wins -> 5 in a row horizontally accross top of board (left)."""
     test_board = [
         [Game.Os], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs], [Game.Xs],
         [Game.Os], [Game.Os], [Game.Xs]
     ]
     has_won = Game.check_horizontal(test_board, Game.Xs, 5, 0)
     self.assertTrue(has_won)