class RookTests(unittest.TestCase):
    def setUp(self):
        chess_coord_white = ChessCoord('F', '8')
        self.rook_white = Rook(chess_coord_white, white)
        chess_coord_black = ChessCoord('E', '3')
        self.rook_black = Rook(chess_coord_black, black)

    def test_constructor_white(self):
        self.failUnless(self.rook_white.letter == 'R')
        self.failUnless(self.rook_white.chess_coord == ChessCoord('F', '8'))
        self.failUnless(self.rook_white.grid_coord == GridCoord(5, 7))
        self.failUnless(self.rook_white.colour == white)
        self.failUnless(self.rook_white.symbol == '♖')
        self.failUnless(util.compare_lists(self.rook_white.move_directions,
                                           directions.move_directions_rook()))

    def test_constructor_black(self):
        self.failUnless(self.rook_black.letter == 'R')
        self.failUnless(self.rook_black.chess_coord == ChessCoord('E', '3'))
        self.failUnless(self.rook_black.grid_coord == GridCoord(4, 2))
        self.failUnless(self.rook_black.colour == black)
        self.failUnless(self.rook_black.symbol == '♜')
        self.failUnless(util.compare_lists(self.rook_black.move_directions,
                                           directions.move_directions_rook()))

    def test_white_rook_allowed_to_move_south7(self):
        pieces = []
        self.failUnless(self.rook_white.inspect_move(pieces,
                                                     ChessCoord('F', '1')).is_valid_move)

    def test_black_rook_allowed_to_move_west4(self):
        pieces = []
        self.failUnless(self.rook_black.inspect_move(pieces,
                                                     ChessCoord('A', '3')).is_valid_move)
    def test_taking_king_not_allowed_further_away(self):
        c4_rook = Rook(ChessCoord('C', '4'), black)
        c1_king = King(ChessCoord('C', '1'), white)
        pieces = [c4_rook, c1_king]
        move_inspect_result = c4_rook.inspect_move(pieces, ChessCoord('C', '1'))

        self.failUnless(move_inspect_result ==
                        MoveInspectResult(False, True,
                                          [GridCoord(2, 2),
                                           GridCoord(2, 1)], c1_king))