コード例 #1
0
def test_read_unsigned_short():
    # little endian!
    data = b"\x0c\xda\xb0"
    bs = BitStream(data)
    assert bs.read_bits(4) == 0
    assert bs.read_unsigned_short() == 0xABCD
    assert bs.read_bits(4) == 0
コード例 #2
0
def test_read_aligned_unsigned_short():
    # little endian!
    data = b"\x00\xcd\xab"
    bs = BitStream(data)
    assert bs.read_unsigned_byte() == 0
    assert bs.read_unsigned_short() == 0xABCD