예제 #1
0
 def test_two_nine_tile_rooms(self):
     """Corridor is chosen randomly out of possible options."""
     room_a, room_b = Room(width=3, height=3), Room(width=3, height=3)
     room_a.x, room_a.y, room_b.x, room_b.y = 0, 0, 4, 1
     self.assertIn(
         _get_corridor_coordinates(room_a, room_b),
         set([((3, 1), ((2, 1), (0, 0)), (1, 0)),
              ((3, 2), ((2, 2), (0, 1)), (1, 0))]))
예제 #2
0
 def test_two_one_tile_rooms_from_north(self):
     room_a, room_b = Room(width=1, height=1), Room(width=1, height=1)
     room_a.x, room_a.y, room_b.x, room_b.y = 0, 2, 0, 0
     self.assertEqual(_get_corridor_coordinates(room_a, room_b),
                      ((0, -1), ((0, 0), (0, 0)), (0, -1)))
예제 #3
0
 def test_rooms_are_too_far_away(self):
     room_a, room_b = Room(width=1, height=1), Room(width=1, height=1)
     room_a.x, room_a.y, room_b.x, room_b.y = 0, 0, 9, 9
     self.assertEqual(_get_corridor_coordinates(room_a, room_b),
                      (None, (None, None), None))