From 29e5c6d74055ff623490e5d334c3d6b0b855faec Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Thu, 5 Dec 2019 19:48:19 +0100 Subject: [PATCH] add day5 (part 1) --- python/5/test_day5.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 python/5/test_day5.py diff --git a/python/5/test_day5.py b/python/5/test_day5.py new file mode 100644 index 0000000..ec1ef59 --- /dev/null +++ b/python/5/test_day5.py @@ -0,0 +1,21 @@ +from day5 import run_intcode, decode_code, part1 + + +def test_new_opcodes(): + assert run_intcode([3, 0, 4, 0, 99], input=33) == ([33, 0, 4, 0, 99], [33]) + + +def test_parameter_mode(): + assert run_intcode([1002, 4, 3, 4, 33], input=None) == ([1002, 4, 3, 4, 99], []) + + +def test_negative_case(): + assert run_intcode([1101, 100, -1, 4, 0], input=42) == ([1101, 100, -1, 4, 99], []) + + +def test_decode_code(): + assert decode_code(1002) == (10, 2) + + +def test_part1(): + assert part1() == [0, 0, 0, 0, 0, 0, 0, 0, 0, 7286649]