示例#1
0
def test_Field_with_UIntEncoder__decode_normal_multi_byte():
    field = Field("", byte_index=(0, 1, 2), bit_mask=0x0FFFF0, encoder=UIntEncoder())
    input_value = (0xFFF000).to_bytes(3, "big")
    expected = 0x00FF00
    actual = field.decode(input_value)
    assert actual == expected
示例#2
0
def test_Field_with_UIntEncoder__decode_normal_one_byte():
    field = Field("", bit_mask=0b11110000, encoder=UIntEncoder())
    input_value = bytes([0b00111100])
    expected = 0b00000011
    actual = field.decode(input_value)
    assert actual == expected