19 lines
445 B
Python
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)
|
|
|