2023/day10/test.py
Fedaya 64a270ee39 Day 10 completed
completed with the help of shapely python module

other minors changes in day5
2023-12-10 17:34:02 +01:00

33 lines
948 B
Python
Executable File

#!/usr/bin/env python3.11
import logging
from unittest import TestCase, main
from part1 import farthest_length
from part2 import inside_points
from common import parse, Point
class Day10Tests(TestCase):
def test_parsing(self):
labyrinth = parse("example_input_part1.txt")
self.assertEqual(labyrinth.start, Point(0, 2, "S"))
self.assertEqual(labyrinth.first_points, (Point(0, 3, "|"), Point(1, 2, "J")))
def test_part1(self):
self.assertEqual(8, farthest_length(parse("example_input_part1.txt")))
def test_part2(self):
self.assertEqual(
[
Point(x=2, y=6, c="."),
Point(x=3, y=6, c="."),
Point(x=7, y=6, c="."),
Point(x=8, y=6, c="."),
],
inside_points(parse("example_input_part2.txt")),
)
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
main(verbosity=2)