예제 #1
0
 def test_should_return_stop_due_to_block_given_command_is_M_when_facing_restrict_point(
         self):
     mars_rover = MarsRover('1 1 E', Area(-10, 10, 10, -10, [(2, 1),
                                                             (1, 2)]))
     status = mars_rover.run('M')
     self.assertEqual(status, 'Stop due to block!')
예제 #2
0
 def test_should_return_correct_location_and_direction_given_command_is_MLMMRMMML_when_facing_N(
         self):
     mars_rover = MarsRover('0 0 N')
     status = mars_rover.run('MLMMRMMML')
     self.assertEqual(status, '-2 4 W')
예제 #3
0
 def test_should_return_exceed_area_given_command_is_M_when_location_is_10_and_10_and_facing_E(
         self):
     mars_rover = MarsRover('10 10 E', Area(-10, 10, 10, -10, []))
     status = mars_rover.run('M')
     self.assertEqual(status, 'Exceed area!')
예제 #4
0
 def test_should_return_facing_E_given_given_command_is_R_and_facing_is_N(
         self):
     mars_rover = MarsRover('0 0 N')
     status = mars_rover.run('R')
     self.assertEqual(status, '0 0 E')
예제 #5
0
 def test_should_return_init_place_given_command_is_empty(self):
     mars_rover = MarsRover()
     status = mars_rover.run()
     self.assertEqual(status, '0 0 E')
예제 #6
0
 def test_should_return_facing_S_given_given_command_is_L_and_facing_is_W(
         self):
     mars_rover = MarsRover('0 0 W')
     status = mars_rover.run('L')
     self.assertEqual(status, '0 0 S')
예제 #7
0
 def test_should_return_y_minus_1_given_given_command_is_M_and_facing_is_S(
         self):
     mars_rover = MarsRover('0 0 S')
     status = mars_rover.run('M')
     self.assertEqual(status, '0 -1 S')
예제 #8
0
 def test_should_return_x_plus_1_given_given_command_is_M_and_facing_is_E(
         self):
     mars_rover = MarsRover()
     status = mars_rover.run('M')
     self.assertEqual(status, '1 0 E')