test: unpacker simple ints

This commit is contained in:
ChillerDragon 2024-06-17 12:43:09 +08:00
parent ad2ec9f46a
commit 406e5ab633

View file

@ -3,6 +3,13 @@ from twnet_parser.packer import \
from twnet_parser.packer import \ from twnet_parser.packer import \
NO_SANITIZE, SANITIZE, SANITIZE_CC, SKIP_START_WHITESPACES NO_SANITIZE, SANITIZE, SANITIZE_CC, SKIP_START_WHITESPACES
def test_unpack_simple_ints() -> None:
u = Unpacker(b'\x01\x02\x03\x0F')
assert u.get_int() == 1
assert u.get_int() == 2
assert u.get_int() == 3
assert u.get_int() == 15
def test_unpack_eol() -> None: def test_unpack_eol() -> None:
u = Unpacker(b'\x01\x02\x03\x01foo\x00bar\x00') u = Unpacker(b'\x01\x02\x03\x01foo\x00bar\x00')
assert u.get_int() == 1 assert u.get_int() == 1