def test_is_legal_move_for_rook_negative_test(self): from board import Board b = Board() b._board = ChessTest.board2 #Diagnoal self.assertFalse(b._isLegalMoveForRook([1, 2, 0, 3])) #Path blocked by friendly piece self.assertFalse(b._isLegalMoveForRook([7, 7, 0, 7])) #Path blocked by enemy piece self.assertFalse(b._isLegalMoveForRook([7, 7, 7, 0]))
def test_is_legal_move_for_rook(self): from board import Board b = Board() b._board = ChessTest.board2 #Left self.assertTrue(b._isLegalMoveForRook([1, 2, 0, 2])) #Right self.assertTrue(b._isLegalMoveForRook([1, 2, 3, 2])) #Up self.assertTrue(b._isLegalMoveForRook([1, 2, 1, 6])) #Down self.assertTrue(b._isLegalMoveForRook([7, 7, 7, 3])) #Legal kill self.assertTrue(b._isLegalMoveForRook([1, 2, 1, 7]))