Esempio n. 1
0
 def test_collision(self):
     h1 = Hover(0, 0, North)
     h2 = Hover(0, 1, North)
     obstacles = [h1, h2]
     h1.set_obstacles(obstacles)
     h2.set_obstacles(obstacles)
     self.assertRaises(CollisionDetected, h1.move)
     h2.turn_left()
     h2.turn_left()
     self.assertRaises(CollisionDetected, h2.move)
Esempio n. 2
0
 def test_moxed_move_second_hover(self):
     p = Plateau(5, 5)
     h = Hover(3, 3, East)
     h.move()
     h.move()
     h.turn_right()
     h.move()
     h.move()
     h.turn_right()
     h.move()
     h.turn_right()
     h.turn_right()
     h.move()
     self.expect_at(h, 5, 1, East)
Esempio n. 3
0
 def test_plateau_boundaries(self):
     plateau = Plateau(5, 5)
     h = Hover(0, 0, North, plateau)
     h.move()
     h.move()
     h.move()
     h.move()
     h.move()
     self.assertRaises(BoundaryReached, h.move)
     h2 = Hover(0, 0, North, plateau)
     h2.turn_right()
     h2.move()
     h2.move()
     h2.move()
     h2.move()
     h2.move()
     self.assertRaises(BoundaryReached, h.move)