class RoverTestCase(unittest.TestCase): def setUp(self): self.x = 9 self.y = 5 self.compassPoint = CompassPoint.W self.rover = Rover(self.x, self.y, self.compassPoint) def test_position(self): self.assertEqual(self.rover.getPosition(), "9 5 W") def test_move(self): self.rover.moveOneStep() self.assertEqual(self.rover.getPosition(), "8 5 W") def test_turnRight(self): self.rover.turn("R") self.assertEqual(self.rover.getPosition(), "9 5 N") def test_turnLeft(self): self.rover.turn("L") self.assertEqual(self.rover.getPosition(), "9 5 S")
from rover import Rover if __name__ == "__main__": while True: #Menu print('\t\t\tMenu') print('\t\t1. Add Rover') print('\t\t2. Exit') choice = int(input("\tEnter Your Choice: ")) if choice == 1: xCord, yCord, direction = input("\n\tEnter Details: ").split() roverObject = Rover(xCord, yCord, direction) instructions = list(input("\tEnter Instructions: ")) roverObject.move(instructions) roverObject.getPosition() else: print("\n\t\tThank You!") break