def test_move_on_robot_placed(input_params, x, y, direction): robot = Robot() robot.place(input_params) robot.move() assert robot.x_coordinate == x assert robot.y_coordinate == y assert robot.facing == direction
def test_robot_move(self): subject = Robot() subject.move() self.assertEqual(subject.x, 0) self.assertEqual(subject.y, 1) self.assertEqual(subject.facing, 'NORTH')
def test_move_on_robot_not_placed(): with pytest.raises(MissingPlaceCommandException) as e: robot = Robot() robot.move() assert str(e.value) == 'Robot not placed.' assert robot.x_coordinate is None assert robot.y_coordinate is None assert robot.facing is None
def test_robot_move_east_from_place_2_2_east(self): subject = Robot() subject.place('2,2,EAST') subject.move() self.assertEqual(subject.x, 3) self.assertEqual(subject.y, 2) self.assertEqual(subject.facing, 'EAST')
def test_robot_move_south_from_place_2_2_south(self): subject = Robot() subject.place('2,2,SOUTH') subject.move() self.assertEqual(subject.x, 2) self.assertEqual(subject.y, 1) self.assertEqual(subject.facing, 'SOUTH')
def test_robot_move_west_from_origin(self): subject = Robot() subject.left() subject.move() self.assertEqual(subject.x, 0) self.assertEqual(subject.y, 0) self.assertEqual(subject.facing, 'WEST')
def test_robot_move_east_from_origin(self): subject = Robot() subject.right() subject.move() self.assertEqual(subject.x, 1) self.assertEqual(subject.y, 0) self.assertEqual(subject.facing, 'EAST')
def test_robot_move_north_from_place_2_2_north(self): subject = Robot() subject.place('2,2,NORTH') subject.move() self.assertEqual(subject.x, 2) self.assertEqual(subject.y, 3) self.assertEqual(subject.facing, 'NORTH')
def test_robot_move_west_from_place_2_2_west(self): subject = Robot() subject.place('2,2,WEST') subject.move() self.assertEqual(subject.x, 1) self.assertEqual(subject.y, 2) self.assertEqual(subject.facing, 'WEST')
def test_move_for_robot_out_of_bounds(input_params, x, y, direction): with pytest.raises(MoveOutOfBoundsException) as e: robot = Robot() robot.place(input_params) robot.move() assert str(e.value) == 'Cannot move robot. Coordinates out of bound.' assert robot.x_coordinate == x assert robot.y_coordinate == y assert robot.facing == direction
def test_robot_move_south_from_origin(self): subject = Robot() subject.left() subject.left() subject.move() self.assertEqual(subject.x, 0) self.assertEqual(subject.y, 0) self.assertEqual(subject.facing, 'SOUTH')