Пример #1
0
            rover.orders = 'brb'
            rover.run_orders()
            print(rover.position)
            the(is_same_dictionary(rover.position, {'x': 0, 'y': 0})).should.be(True)
            the(rover.orientation).should.be('N')

            rover.orders = 'flflflfl'
            rover.run_orders()
            print(rover.position)
            the(is_same_dictionary(rover.position, {'x': 0, 'y': 0})).should.be(True)
            the(rover.orientation).should.be('N')

    with when.supplied_with_a_navigator:
        navigator = Navigator()
        MAP_SIZE = 3
        navigator.map_size = MAP_SIZE
        rover = Rover(starting_point, initial_direction, navigator)

        with then.the_rover_should_wrap_from_the_upper_edge:
            rover.orders = 'ffff'
            rover.run_orders()
            print(rover.position)
            the(is_same_dictionary(rover.position, {'x': 0, 'y': -MAP_SIZE})).should.be(True)

        with and_.the_rover_should_wrap_from_the_lower_edge:
            rover.orders = 'b'
            rover.run_orders()
            print(rover.position)
            the(is_same_dictionary(rover.position, {'x': 0, 'y': MAP_SIZE})).should.be(True)

        with and_.the_rover_should_wrap_from_the_left_edge: