from io import StringIO from textwrap import dedent import pytest from aoc2019.day10 import part1, part2 LARGE_SAMPLE = """\ .#..##.###...####### ##.############..##. .#.######.########.# .###.#######.####.#. #####.##.#.##.###.## ..#####..#.######### #################### #.####....###.#.#.## ##.################# #####.##.###..####.. ..######..##.####### ####.##.####...##..# .#####..#.######.### ##...#.##########... #.##########.####### .####.#.###.###.#.## ....##.##.###..##### .#.#.###########.### #.#.#.#####.####.### ###.##.####.##.#..## """ @pytest.mark.parametrize('visible,field', [ (8, dedent("""\ .#..# ..... ##### ....# ...## """)), (33, dedent("""\ ......#.#. #..#.#.... ..#######. .#.#.###.. .#..#..... ..#....#.# #..#....#. .##.#..### ##...#..#. .#....#### """)), (35, dedent("""\ #.#...#.#. .###....#. .#....#... ##.#.#.#.# ....#.#.#. .##..###.# ..#...##.. ..##....## ......#... .####.###. """)), (41, dedent("""\ .#..#..### ####.###.# ....###.#. ..###.##.# ##.##.#.#. ....###..# ..#.#..#.# #..#.#.### .##...##.# .....#.#.. """)), (210, LARGE_SAMPLE), ]) def test_samples_part1(visible: int, field: str) -> None: data = StringIO(field.strip()) assert part1(data) == visible def test_samples_part2(): data = StringIO(LARGE_SAMPLE.strip()) assert part2(data) == 802