def testRotateAndForward(self): the_ship = Ship2() the_ship.perform_action({"type": "L", "value": 180}) the_ship.perform_action({"type": "F", "value": 10}) self.assertEqual(-100, the_ship.loc_x) self.assertEqual(-10, the_ship.loc_y)
def testTurnRight90Deg(self): the_ship = Ship2() the_ship.perform_action({"type": "R", "value": 90}) self.assertEqual(-10, the_ship.waypoint_y) self.assertEqual(1, the_ship.waypoint_x)
def testMoveSouth(self): the_ship = Ship2() the_ship.perform_action({"type": "S", "value": 3}) self.assertEqual(-2, the_ship.waypoint_y) self.assertEqual(10, the_ship.waypoint_x)
def testMoveEast(self): the_ship = Ship2() the_ship.perform_action({"type": "E", "value": 3}) self.assertEqual(1, the_ship.waypoint_y) self.assertEqual(13, the_ship.waypoint_x)
def testTurnLeft270Deg(self): the_ship = Ship2() the_ship.perform_action({"type": "L", "value": 270}) self.assertEqual(-10, the_ship.waypoint_y) self.assertEqual(1, the_ship.waypoint_x)