Browse Source

Rover can now accept landing coordinates and direct

But these are still not used ...
Oz N Tiram 4 years ago
parent
commit
37655a33fb
2 changed files with 5 additions and 1 deletions
  1. 1 1
      src/rover/rover.py
  2. 4 0
      tests/test_rover.py

+ 1 - 1
src/rover/rover.py

@@ -11,7 +11,7 @@ class Location:
 
 class Rover:
 
-    def __init__(self):
+    def __init__(self, x=None, y=None, direction=None):
         self.location = Location(2, 7, 'E')
         self.location.x = 2
         self.location.y = 7

+ 4 - 0
tests/test_rover.py

@@ -10,3 +10,7 @@ def test_has_location_and_direction():
     assert isinstance(rover.location.x, int)
     assert isinstance(rover.location.y, int)
     assert rover.location.direction in DIRECTIONS
+
+def test_can_land_at_specified_location():
+    rover = Rover(x=1, y=2, direction='E')
+    assert rover.location.x == 1