1
0
pbcabi/test/test_binaryreader.py

19 lines
445 B
Python
Raw Normal View History

2024-05-03 08:18:54 +00:00
import pytest
from pathlib import Path
from pbcabi.binaryreader import BinaryReader
import pbcabi.model
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)