pbcabi/test/test_binaryreader.py
Jon Michael Aanes 959ceff255
Some checks failed
Verify Python project can be installed, loaded and have version checked / Test (push) Waiting to run
Run Python tests (through Pytest) / Test (push) Has been cancelled
Ruff
2025-05-21 00:55:57 +02:00

17 lines
387 B
Python

from pbcabi.binaryreader import BinaryReader
def assert_parse(hex, value):
derp = bytes.fromhex(hex)
assert BinaryReader(derp).readSignedIntBigEndian(1) == value
def test_parse():
assert_parse('00', 0)
assert_parse('01', 1)
assert_parse('10', 0x10)
assert_parse('79', 0x79)
assert_parse('80', -0x80)
assert_parse('F0', -16)
assert_parse('FF', -1)