You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdventOfCode19/days/test_day02.py

28 lines
633 B

import os
from . import OpcodeComputer
inputfile = os.path.join(os.path.dirname(__file__), "input/day02_input")
def test_day2a():
comp = OpcodeComputer(inputfile)
comp.memory[1] = 12
comp.memory[2] = 2
assert comp.process_all() == 5098658
def test_day2b():
comp = OpcodeComputer(inputfile)
a: int = 0
b: int = 0
for a, b in [(x, y) for x in range(100) for y in range(100)]:
comp.reset()
comp.memory[1] = a
comp.memory[2] = b
result = comp.process_all()
if result == 19690720:
break
assert 100 * a + b == 5064