Files
aoc2024/day6/test.py
2024-12-07 01:36:54 +10:00

36 lines
733 B
Python

from solver import Simulation, find_good_obstacles
test_data = r"""
....#.....
.........#
..........
..#.......
.......#..
..........
.#..^.....
........#.
#.........
......#...
""".strip()
def test_visited():
print("Beginning visited test")
sim = Simulation.from_string(test_data)
sim.run()
visited = sim.total_visited()
assert visited == 41
print("Visited test passed")
def test_loop_obstacles():
print("Beginning loop inducing obstacle placement test")
sim = Simulation.from_string(test_data)
places = find_good_obstacles(sim)
assert len(places) == 6
print(f"Loop inducing obstacle placement test complete")
if __name__ == '__main__':
test_visited()
test_loop_obstacles()