-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday12_test.py
68 lines (57 loc) · 1.03 KB
/
day12_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
Advent of Code 2024, Day 12: Garden Groups.
See: https://adventofcode.com/2024/day/12
"""
import io
import pytest
from day12 import part_one, part_two
EXAMPLE_1 = """\
AAAA
BBCD
BBCC
EEEC
"""
EXAMPLE_2 = """\
OOOOO
OXOXO
OOOOO
OXOXO
OOOOO
"""
EXAMPLE_3 = """\
RRRRIICCFF
RRRRIICCCF
VVRRRCCFFF
VVRCCCJFFF
VVVVCJJCFE
VVIVCCJJEE
VVIIICJJEE
MIIIIIJJEE
MIIISIJEEE
MMMISSJEEE
"""
@pytest.mark.parametrize(
("example", "answer"),
[
(EXAMPLE_1, 140),
(EXAMPLE_2, 772),
(EXAMPLE_3, 1930),
],
)
def test_part_one(example: str, answer: int) -> None:
"""
Test that checks if the solution for part one works on the example input.
"""
assert part_one(io.StringIO(example)) == answer
@pytest.mark.parametrize(
("example", "answer"),
[
(EXAMPLE_1, 80),
(EXAMPLE_3, 1206),
],
)
def test_part_two(example: str, answer: int) -> None:
"""
Test that checks if the solution for part two works on the example input.
"""
assert part_two(io.StringIO(example)) == answer