forked from arti/vt1200
14 lines
405 B
Python
14 lines
405 B
Python
from tools.send_movie import pack_packet, parse_ack
|
|
|
|
|
|
def test_pack_packet_header():
|
|
pkt = pack_packet(0x1234, 1, b"abc")
|
|
assert pkt[0:4] == (0x1234).to_bytes(4, "little")
|
|
assert pkt[4:6] == (3).to_bytes(2, "little")
|
|
assert pkt[6:8] == (1).to_bytes(2, "little")
|
|
assert pkt[10:] == b"abc"
|
|
|
|
|
|
def test_parse_ack():
|
|
assert parse_ack(b"BAK1" + (0x1000).to_bytes(4, "little")) == 0x1000
|