Exemple #1
0
def test_uint64_split32():
    def assert_round_trip(orig):
        (high32, low32) = util.uint64_split32(orig)
        result = util.uint64_join32(high32, low32)
        assert result == orig

    for x in util.fibonacci_range(pow(2, 50)):
        assert_round_trip(x)
Exemple #2
0
def test_uint64():
    for val in util.fibonacci_range(const.POW_2_64):
        packed_bytes = tlv.uint64_pack(val)
        assert len(packed_bytes) == 12
        val_unpacked = tlv.uint64_unpack(packed_bytes)
        assert val == val_unpacked
Exemple #3
0
def test_uint32():
    for val in util.fibonacci_range(const.POW_2_32):
        packed_bytes = tlv.uint32_pack(val)
        assert len(packed_bytes) == 8
        val_unpacked = tlv.uint32_unpack(packed_bytes)
        assert val == val_unpacked