intcode: cleanup

This commit is contained in:
thib8956 committed 2026-11-15 15:30:32 +01:00
1 parent 06956da329
commit a9d4619cac
3 files changed
+41 -25

No files matched your search

+5 -1
View File
@@ -2,7 +2,7 @@
from intcode import *
def run_test(program, expected_mem=None, stdin=[], expected_out=None):
def run_test(program, expected_mem=None, stdin=None, expected_out=None):
mem = program[::]
out = interpret_intcode(mem, stdin=stdin)
if expected_mem is not None:
@@ -22,6 +22,10 @@ def test_day2():
run_test(program, expected)
def test_input_output():
run_test([3,0,4,0,99], stdin=[42], expected_out=[42])
def test_day5_basic():
# Using position mode, consider whether the input is equal to 8; output 1
# (if it is) or 0 (if it is not).