예제 #1
0
def test_loads_and_dumps_are_consistent():
    for i in chain(
        xrange(2 ** 18),
        xrange(2 ** 20, 2 ** 26, 33333),
        xrange(2 ** 26, 2 ** 32, 777777),
    ):
        byte_dump = uleb128_encode(i)
        eq_(uleb128_decode(byte_dump), (i, len(byte_dump)))
예제 #2
0
def test_loads_and_dumps_are_consistent():
    for i in chain(
            xrange(2**18),
            xrange(2**20, 2**26, 33333),
            xrange(2**26, 2**32, 777777),
    ):
        byte_dump = uleb128_encode(i)
        eq_(uleb128_decode(byte_dump), (i, len(byte_dump)))
예제 #3
0
def test_uleb128_decode_fails_on_invalid_input():
    byte_array = uleb128_encode(12345678)

    for i in xrange(len(byte_array)):
        yield check_uleb128_decode_fails_on_invalid_input, byte_array[:i]
예제 #4
0
def test_uleb128_encode_fails_on_negative_number():
    uleb128_encode(-1)
예제 #5
0
def check_dumps(value, string):
    eq_(uleb128_encode(value), string)
예제 #6
0
def test_uleb128_decode_fails_on_invalid_input():
    byte_array = uleb128_encode(12345678)

    for i in xrange(len(byte_array)):
        yield check_uleb128_decode_fails_on_invalid_input, byte_array[:i]
예제 #7
0
def test_uleb128_encode_fails_on_negative_number():
    uleb128_encode(-1)
예제 #8
0
def check_dumps(value, string):
    eq_(uleb128_encode(value), string)
예제 #9
0
def test_uleb128_decode_fails_on_invalid_input():
    data = uleb128_encode(12345678)

    for i in xrange(len(data)):
        yield check_uleb128_decode_fails_on_invalid_input, data[:i]