1
0
pbcabi/test/test_binaryreader.py
Jon Michael Aanes b212b0136d
Some checks failed
Python Package / Package (push) Failing after 25s
Fixed parsing of AvlTree
2024-05-03 10:18:54 +02:00

19 lines
445 B
Python

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)