33 lines
926 B
Python
Executable File
33 lines
926 B
Python
Executable File
#!/usr/bin/env python3.11
|
|
|
|
import logging
|
|
from unittest import TestCase, main
|
|
from common import *
|
|
from part1 import part1
|
|
from part2 import part2
|
|
|
|
|
|
class Day12Tests(TestCase):
|
|
def test_parsing(self):
|
|
parsed_spring = parse("example_input.txt")
|
|
spring: Spring = [
|
|
SpringLine("???.###", (1, 1, 3)),
|
|
SpringLine(".??..??...?##.", (1, 1, 3)),
|
|
SpringLine("?#?#?#?#?#?#?#?", (1, 3, 1, 6)),
|
|
SpringLine("????.#...#...", (4, 1, 1)),
|
|
SpringLine("????.######..#####.", (1, 6, 5)),
|
|
SpringLine("?###????????", (3, 2, 1)),
|
|
]
|
|
self.assertEqual(parsed_spring, spring)
|
|
|
|
def test_part1(self):
|
|
self.assertEqual(part1("example_input.txt"), 21)
|
|
|
|
def test_part2(self):
|
|
self.assertEqual(part2("example_input.txt"), 525152)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
main(verbosity=2)
|