From 885868f39ef9755c428b97c142e22e7d91742b66 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 19 Feb 2023 18:18:40 -0800 Subject: [PATCH] Add a test for RectangularRoom.wall_points --- test/test_map_room.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/test_map_room.py diff --git a/test/test_map_room.py b/test/test_map_room.py new file mode 100644 index 0000000..0467e27 --- /dev/null +++ b/test/test_map_room.py @@ -0,0 +1,34 @@ +# Eryn Wells + +from erynrl.geometry import Point, Rect, Size +from erynrl.map.room import RectangularRoom + + +def test_rectangular_room_wall_points(): + '''Check that RectangularRoom.wall_points returns the correct set of points''' + rect = Rect(Point(5, 5), Size(5, 5)) + room = RectangularRoom(rect) + + expected_points = set([ + Point(5, 5), + Point(6, 5), + Point(7, 5), + Point(8, 5), + Point(9, 5), + Point(9, 6), + Point(9, 7), + Point(9, 8), + Point(9, 9), + Point(8, 9), + Point(7, 9), + Point(6, 9), + Point(5, 9), + Point(5, 8), + Point(5, 7), + Point(5, 6), + ]) + + for pt in room.wall_points: + expected_points.remove(pt) + + assert len(expected_points) == 0