예제 #1
0
 def test_turn_right(self):
     ship = Ship(17, 3, 0)
     ship.turn_right(90)
     ship.go_forward(11)
     self.assertEqual(ship.x, 17)
     self.assertEqual(ship.y, -8)
     self.assertEqual(ship.compute_distance(), 25)
예제 #2
0
 def test_rotate_waypoint(self):
     ship = Ship(170, 38)
     ship.turnon_waypoint(10, 4)
     ship.turn_right(90)
     self.assertEqual(ship.x, 170)
     self.assertEqual(ship.y, 38)
     self.assertEqual(ship.wp_x, 4)
     self.assertEqual(ship.wp_y, -10)
     ship.go_forward(11)
     self.assertEqual(ship.x, 214)
     self.assertEqual(ship.y, -72)
     self.assertEqual(ship.compute_distance(), 286)