advent-of-code/2015-python/tests/test_day_14.py

31 lines
885 B
Python
Raw Normal View History

2023-10-26 18:25:07 +02:00
import unittest
from solutions.day_14 import Solution
class Day14TestCase(unittest.TestCase):
def setUp(self):
self.solution = Solution()
self.puzzle_input = self.solution.parse_input(
"""
Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.
Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.
"""
)
def test_parse_puzzle_input(self):
data = """
Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds.
"""
assert self.solution.parse_input(data) == [(14, 10, 127)]
def test_solve_first_part(self):
assert self.solution.solve(self.puzzle_input, 1000) == 1120
def test_solve_second_part(self):
assert self.solution.solve_again(self.puzzle_input, 1000) == 689
if __name__ == "__main__":
unittest.main()