Day 9 Completed

put example_input.txt back in repos, for unittest purposes
This commit is contained in:
2023-12-09 09:35:56 +01:00
parent 7b73d8402a
commit f641fbac07
10 changed files with 167 additions and 2 deletions

17
day9/test.py Normal file
View File

@@ -0,0 +1,17 @@
import unittest
from common import OASISLine
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__":
unittest.main()