mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Implement day 22 part 1
This commit is contained in:
43
2019/tests/test_day22.py
Normal file
43
2019/tests/test_day22.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import pytest
|
||||
|
||||
from aoc2019.day22 import shuffle
|
||||
|
||||
SAMPLE_INSTRUCTIONS = [
|
||||
"""deal with increment 7
|
||||
deal into new stack
|
||||
deal into new stack""",
|
||||
"""cut 6
|
||||
deal with increment 7
|
||||
deal into new stack""",
|
||||
"""deal with increment 7
|
||||
deal with increment 9
|
||||
cut -2""",
|
||||
"""deal into new stack
|
||||
cut -2
|
||||
deal with increment 7
|
||||
cut 8
|
||||
cut -4
|
||||
deal with increment 7
|
||||
cut 3
|
||||
deal with increment 9
|
||||
deal with increment 3
|
||||
cut -1""",
|
||||
]
|
||||
|
||||
CORRECT_SHUFFLES = [
|
||||
"0 3 6 9 2 5 8 1 4 7",
|
||||
"3 0 7 4 1 8 5 2 9 6",
|
||||
"6 3 0 7 4 1 8 5 2 9",
|
||||
"9 2 5 8 1 4 7 0 3 6",
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('instructions,correct', zip(SAMPLE_INSTRUCTIONS, CORRECT_SHUFFLES))
|
||||
def test_shuffle(instructions, correct):
|
||||
instructions = [line.strip() for line in instructions.splitlines()]
|
||||
|
||||
correct = [int(i) for i in correct.split(" ")]
|
||||
|
||||
result = shuffle(instructions, 10)
|
||||
|
||||
assert result == correct
|
||||
Reference in New Issue
Block a user