22 lines
645 B
Python
Executable File
22 lines
645 B
Python
Executable File
#!/usr/bin/env python3.11
|
|
import unittest
|
|
from common import OASISLine
|
|
import logging
|
|
|
|
|
|
class Day9Tests(unittest.TestCase):
|
|
def test_part1(self):
|
|
analysis = OASISLine.parse("example_input.txt")
|
|
extrapolation = map(lambda o: o.reduce().extrapolate(), analysis)
|
|
self.assertEqual(sum(extrapolation), 114)
|
|
|
|
def test_part2(self):
|
|
analysis = OASISLine.parse("example_input.txt")
|
|
extrapolation = map(lambda o: o.reduce().extrapolate_back(), analysis)
|
|
self.assertEqual(sum(extrapolation), 2)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
unittest.main(verbosity=2)
|