Ejemplo n.º 1
0
def test_black_rook(test_board):
    starting_file = "a"
    starting_rank = 8
    starting_space = test_board.get_space(starting_file, starting_rank)
    test_rook = Rook(PieceColor.BLACK)
    test_rook.place(starting_space)
    return test_rook
Ejemplo n.º 2
0
def test_white_rook(test_board):
    starting_file = "a"
    starting_rank = 1
    starting_space = test_board.get_space(starting_file, starting_rank)
    test_rook = Rook(PieceColor.WHITE)
    test_rook.place(starting_space)
    return test_rook
Ejemplo n.º 3
0
def test_white_rook(test_board):
    assert test_board
    test_white_rook = Rook(PieceColor.WHITE)
    starting_space = test_board.get_space("a", 1)
    test_white_rook.place(starting_space)

    return test_white_rook
Ejemplo n.º 4
0
    def test_create_white_rook(self, test_board):
        test_rook = Rook(PieceColor.WHITE)
        starting_file = "a"
        starting_rank = 1
        starting_space = test_board.get_space(starting_file, starting_rank)
        test_rook.place(starting_space)

        assert test_rook.current_space is starting_space
Ejemplo n.º 5
0
    def bad_rook_move_vertical(self, test_board, test_black_rook):
        assert test_board
        assert test_black_rook
        assert test_black_rook.current_space
        assert test_black_rook.current_space.rank - 1 > MIN_RANK

        target_space = test_board.get_space(test_black_rook.current_space.file,
                                            MIN_RANK)
        obstacle_space = test_board.get_space(
            test_black_rook.current_space.file, MIN_RANK + 1)
        obstacle_piece = Rook(PieceColor.WHITE)
        obstacle_piece.place(obstacle_space)

        test_black_rook.move(test_board, target_space)
Ejemplo n.º 6
0
    def bad_rook_move_horizontal(self, test_board, test_white_rook):
        assert test_board
        assert test_white_rook
        assert test_white_rook.current_space
        assert ord(test_white_rook.current_space.file) + 1 < ord(MAX_FILE)

        target_space = test_board.get_space(MAX_FILE,
                                            test_white_rook.current_space.rank)
        obstacle_space = test_board.get_space(
            chr(ord(MAX_FILE) - 1), test_white_rook.current_space.rank)
        obstacle_piece = Rook(PieceColor.BLACK)
        obstacle_piece.place(obstacle_space)

        test_white_rook.move(test_board, target_space)