Super messy 2019 day 10

I accidentally inverted my y-axis and I'm not fixing it.
This commit is contained in:
2021-01-24 13:54:48 +01:00
parent 2907726363
commit dd039e9276
2 changed files with 179 additions and 0 deletions

86
2019/tests/test_day10.py Normal file
View File

@@ -0,0 +1,86 @@
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