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.
30 lines
844 B
30 lines
844 B
import unittest
|
|
import os
|
|
from . import comp
|
|
|
|
|
|
class Day5(unittest.TestCase):
|
|
def get_code(self):
|
|
inputfile = os.path.join(os.path.dirname(__file__), "input/day5_input")
|
|
with open(inputfile) as fp:
|
|
return [int(k) for k in fp.readline().split(',')]
|
|
|
|
def test_day5a(self):
|
|
output_val = []
|
|
|
|
sut = comp.OpcodeComputer()
|
|
comp.input = lambda: 1
|
|
comp.print = lambda s: output_val.append(s)
|
|
|
|
sut.process_op(self.get_code())
|
|
self.assertEqual(int(output_val[-1]), 8332629)
|
|
|
|
def test_day5b(self):
|
|
output_val = []
|
|
|
|
sut = comp.OpcodeComputer()
|
|
comp.input = lambda: 5
|
|
comp.print = lambda s: output_val.append(s)
|
|
|
|
sut.process_op(self.get_code())
|
|
self.assertEqual(int(output_val[-1]), 8805067)
|
|
|