advent-of-code/2017-python/tests/day_18_tests.py

40 lines
733 B
Python
Raw Normal View History

2021-11-01 16:40:46 +01:00
import unittest
from solutions.day_18 import Solution
class Day18TestCase(unittest.TestCase):
def setUp(self):
self.solution = Solution()
def test_something(self):
2025-05-06 20:14:58 +02:00
puzzle_input = """
2021-11-01 16:40:46 +01:00
set a 1
add a 2
mul a a
mod a 5
snd a
set a 0
rcv a
jgz a -1
set a 1
jgz a -2
2025-05-06 20:14:58 +02:00
""".strip()
2021-11-01 16:40:46 +01:00
assert self.solution.solve(puzzle_input) == 4
def test_something_else(self):
2025-05-06 20:14:58 +02:00
puzzle_input = """
2021-11-01 16:40:46 +01:00
snd 1
snd 2
snd p
rcv a
rcv b
rcv c
rcv d
2025-05-06 20:14:58 +02:00
""".strip()
2021-11-01 16:40:46 +01:00
assert self.solution.solve_again(puzzle_input) == 3
2025-05-06 20:14:58 +02:00
if __name__ == "__main__":
2021-11-01 16:40:46 +01:00
unittest.main()