diff options
Diffstat (limited to 'day12/test_init.py')
| -rw-r--r-- | day12/test_init.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/day12/test_init.py b/day12/test_init.py new file mode 100644 index 0000000..f721d56 --- /dev/null +++ b/day12/test_init.py | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | from day12 import Map | ||
| 3 | |||
| 4 | |||
| 5 | class TestMap: | ||
| 6 | def test_neighbours(self): | ||
| 7 | |||
| 8 | map_input = ["".join([str(i) for i in range(8)]) for _ in range(5)] | ||
| 9 | |||
| 10 | map = Map(map=map_input) | ||
| 11 | |||
| 12 | assert set(map.neighbours(0, 0)) == { | ||
| 13 | (0, 1), | ||
| 14 | (1, 0), | ||
| 15 | } | ||
| 16 | |||
| 17 | assert set(map.neighbours(0, 4)) == { | ||
| 18 | (0, 3), | ||
| 19 | (1, 4), | ||
| 20 | } | ||
| 21 | |||
| 22 | assert set(map.neighbours(1, 1)) == { | ||
| 23 | (0, 1), | ||
| 24 | (1, 0), | ||
| 25 | (1, 2), | ||
| 26 | (2, 1), | ||
| 27 | } | ||
