MCPcopy Index your code
hub / github.com/apache/fory / test_write_var_uint64

Function test_write_var_uint64

python/pyfory/tests/test_buffer.py:232–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230
231
232def test_write_var_uint64():
233 buf = Buffer.allocate(32)
234 check_varuint64(buf, -1, 9)
235 for i in range(32):
236 for j in range(i):
237 buf.write_int8(1)
238 buf.read_int8()
239 check_varuint64(buf, -1, 9)
240 check_varuint64(buf, 1, 1)
241 check_varuint64(buf, 1 << 6, 1)
242 check_varuint64(buf, 1 << 7, 2)
243 check_varuint64(buf, -(2**6), 9)
244 check_varuint64(buf, -(2**7), 9)
245 check_varuint64(buf, 1 << 13, 2)
246 check_varuint64(buf, 1 << 14, 3)
247 check_varuint64(buf, -(2**13), 9)
248 check_varuint64(buf, -(2**14), 9)
249 check_varuint64(buf, 1 << 20, 3)
250 check_varuint64(buf, 1 << 21, 4)
251 check_varuint64(buf, -(2**20), 9)
252 check_varuint64(buf, -(2**21), 9)
253 check_varuint64(buf, 1 << 27, 4)
254 check_varuint64(buf, 1 << 28, 5)
255 check_varuint64(buf, -(2**27), 9)
256 check_varuint64(buf, -(2**28), 9)
257 check_varuint64(buf, 1 << 30, 5)
258 check_varuint64(buf, -(2**30), 9)
259 check_varuint64(buf, 1 << 31, 5)
260 check_varuint64(buf, -(2**31), 9)
261 check_varuint64(buf, 1 << 32, 5)
262 check_varuint64(buf, -(2**32), 9)
263 check_varuint64(buf, 1 << 34, 5)
264 check_varuint64(buf, -(2**34), 9)
265 check_varuint64(buf, 1 << 35, 6)
266 check_varuint64(buf, -(2**35), 9)
267 check_varuint64(buf, 1 << 41, 6)
268 check_varuint64(buf, -(2**41), 9)
269 check_varuint64(buf, 1 << 42, 7)
270 check_varuint64(buf, -(2**42), 9)
271 check_varuint64(buf, 1 << 48, 7)
272 check_varuint64(buf, -(2**48), 9)
273 check_varuint64(buf, 1 << 49, 8)
274 check_varuint64(buf, -(2**49), 9)
275 check_varuint64(buf, 1 << 55, 8)
276 check_varuint64(buf, -(2**55), 9)
277 check_varuint64(buf, 1 << 56, 9)
278 check_varuint64(buf, -(2**56), 9)
279 check_varuint64(buf, 1 << 62, 9)
280 check_varuint64(buf, -(2**62), 9)
281 check_varuint64(buf, 1 << 63 - 1, 9)
282 check_varuint64(buf, -(2**63), 9)
283
284
285def check_varuint64(buf: Buffer, value: int, bytes_written: int):

Callers

nothing calls this directly

Calls 4

check_varuint64Function · 0.85
allocateMethod · 0.65
write_int8Method · 0.45
read_int8Method · 0.45

Tested by

no test coverage detected