def test_rover_position_empty():
    rover = Rover()
    rover.position.x = 10
    rover.move()
    assert (rover.position.x == 0)
    assert (rover.position.y == 0)
    assert (rover.position.orientation == RoverOrientation.NORTH)
    def test_that_it_rolls_backward_when_it_receives_b_commmand_and_is_oriented_est(
            self):
        # given
        rover = Rover(5, 5, Direction.EST)
        command_list = [Command.BACKWARD]

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (4, 5)
    def test_that_it_rolls_backward_when_it_receives_b_commmand_and_is_oriented_south(
            self):
        # given
        rover = Rover(5, 5, Direction.SOUTH)
        command_list = []
        command_list.append(Command.BACKWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (5, 6)
    def test_that_it_rolls_forward_when_it_receives_f_commmand_and_is_oriented_est(
            self):
        # given
        rover = Rover(5, 5, Direction.EST)
        command_list = []
        command_list.append(Command.FORWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (6, 5)
    def test_that_should_stop_after_encountering_an_obstacle(self):
        # given
        rover = Rover(0, 9, Direction.EST)

        command_list = []
        command_list.append(Command.BACKWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getWorking() == False
    def test_that_it_turns_right_when_it_receives_r_commmand_and_is_oriented_south(
            self):
        # given
        rover = Rover(5, 5, Direction.SOUTH)
        command_list = []
        command_list.append(Command.RIGHT)

        # when
        rover.move(command_list)

        # then
        assert rover.getOrientation() == (Direction.WEST)
    def test_that_it_turns_left_when_it_receives_l_commmand_and_is_oriented_est(
            self):
        # given
        rover = Rover(5, 5, Direction.EST)
        command_list = []
        command_list.append(Command.LEFT)

        # when
        rover.move(command_list)

        # then
        assert rover.getOrientation() == (Direction.NORTH)
    def test_that_dont_move_backward_oriented_est_when_there_is_an_obstacle(
            self):
        # given
        rover = Rover(0, 9, Direction.EST)

        command_list = []
        command_list.append(Command.BACKWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (0, 9)
    def test_that_dont_move_forward_oriented_south_when_there_is_an_obstacle(
            self):
        # given
        rover = Rover(9, 0, Direction.SOUTH)

        command_list = []
        command_list.append(Command.FORWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (9, 0)
    def test_that_it_can_roll_over_backward_from_one_edge_of_the_grid_to_another_and_is_oriented_est(
            self):
        # given
        rover = Rover(0, 5, Direction.EST)

        command_list = []
        command_list.append(Command.BACKWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (9, 5)
    def test_that_it_can_roll_over_forward_from_one_edge_of_the_grid_to_another_and_is_oriented_sud(
            self):
        # given
        rover = Rover(5, 0, Direction.SOUTH)

        command_list = []
        command_list.append(Command.FORWARD)

        # when
        rover.move(command_list)

        # then
        assert rover.getPosition() == (5, 9)
from app.rover import Rover
from app.commands import Command

rover = Rover(5, 5, 'E')
command_list = []
command_list.append(Command.FORWARD)
command_list.append(Command.FORWARD)
command_list.append(Command.FORWARD)
command_list.append(Command.FORWARD)
rover.move(command_list)
def test_rover_turns_right():
    rover = Rover()
    rover.move('r')
    assert (rover.position.x == 0)
    assert (rover.position.y == 0)
    assert (rover.position.orientation == RoverOrientation.EAST)