def test_execute_command_sequence_throws_exception_when_trying_to_go_out_of_bounds( self): with self.assertRaises(DangerousMoveException): rover = Rover((1, 1), "N", Zone((5, 5))) rover.save_command_sequence("MMLMM") rover.execute_command_sequence() self.fail("A DangerousMoveException should have been thrown")
def simulate_rover_movement(self): is_command_sequence_safe = True rover_sim = Rover(self.rover.position, self.rover.bearing, self.rover.safeZone) rover_sim.save_command_sequence(self.command_sequence) try: rover_sim.execute_command_sequence() except DangerousMoveException: is_command_sequence_safe = False return is_command_sequence_safe
def test_execute_command_sequence(self): rover = Rover((1, 1), "N", Zone((5, 5))) rover.save_command_sequence("MMLM") rover.execute_command_sequence() self.assertEqual(rover.position, (0, 3))