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)))
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)))
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]
def test_uleb128_encode_fails_on_negative_number(): uleb128_encode(-1)
def check_dumps(value, string): eq_(uleb128_encode(value), string)
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]