-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_day13.py
More file actions
24 lines (19 loc) · 735 Bytes
/
Copy pathtest_day13.py
File metadata and controls
24 lines (19 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from day13 import Packets
filename = 'inputs/2022/day13-test.txt'
def test_packets_init():
packets = Packets(filename)
assert packets.data
assert len(packets.potentials) == 8
def test_packets_compare():
assert Packets.compare([1,1,3,1,1], [1,1,5,1,1])
assert Packets.compare([[1],[2,3,4]], [[1],4])
assert not Packets.compare([9], [[8,7,6]])
assert Packets.compare([[4,4],4,4], [[4,4],4,4,4])
assert not Packets.compare([1, 1, 3, 1, 1], [])
assert Packets.compare([], [1, 1, 3, 1, 1])
def test_packets_right_indexes():
packets = Packets(filename)
assert list(packets.correct_indexes) == [1, 2, 4, 6]
def test_packets_key_indices_prod():
packets = Packets(filename)
assert packets.key_indices_prod == 140