Ejemplo n.º 1
0
    def test_is_full(self):
        # Test for boards of size 4 and 8 that are completely full
        board = Board(4)
        board.white_tiles = 9
        board.black_tiles = 7
        self.assertTrue(board.is_full())
        board = Board(8)
        board.white_tiles = 40
        board.black_tiles = 24
        self.assertTrue(board.is_full())

        # Test for boards of size 4 and 8 that have an open space
        board = Board(4)
        board.white_tiles = 8
        board.black_tiles = 7
        self.assertFalse(board.is_full())
        board = Board(8)
        board.white_tiles = 39
        board.black_tiles = 24
        self.assertFalse(board.is_full())
Ejemplo n.º 2
0
    def test_eq(self):
        # Set up test boards with different attributes
        board_one = Board(4)
        board_two = Board(4)
        board_three = Board(8)
        board_four = Board(4)
        board_four.center = Point(3, 3)
        board_five = Board(4)
        board_five.positions = INITIALIZED_8X8_BOARD
        board_six = Board(4)
        board_six.black_tiles = 10
        board_seven = Board(4)
        board_seven.white_tiles = 10

        # Test for equality or lack thereof
        self.assertEqual(board_one, board_two)
        self.assertNotEqual(board_one, board_three)
        self.assertNotEqual(board_one, board_four)
        self.assertNotEqual(board_one, board_five)
        self.assertNotEqual(board_one, board_six)
        self.assertNotEqual(board_one, board_seven)