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

Function test_write_varint32

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

Source from the content-addressed store, hash-verified

164
165
166def test_write_varint32():
167 buf = Buffer.allocate(32)
168 for i in range(1):
169 for j in range(i):
170 buf.write_int8(1)
171 buf.read_int8()
172 check_varuint32(buf, 1, 1)
173 check_varuint32(buf, 1 << 6, 1)
174 check_varuint32(buf, 1 << 7, 2)
175 check_varuint32(buf, 1 << 13, 2)
176 check_varuint32(buf, 1 << 14, 3)
177 check_varuint32(buf, 1 << 20, 3)
178 check_varuint32(buf, 1 << 21, 4)
179 check_varuint32(buf, 1 << 27, 4)
180 check_varuint32(buf, 1 << 28, 5)
181 check_varuint32(buf, 1 << 30, 5)
182
183 check_varint32(buf, -1)
184 check_varint32(buf, -1 << 6)
185 check_varint32(buf, -1 << 7)
186 check_varint32(buf, -1 << 13)
187 check_varint32(buf, -1 << 14)
188 check_varint32(buf, -1 << 20)
189 check_varint32(buf, -1 << 21)
190 check_varint32(buf, -1 << 27)
191 check_varint32(buf, -1 << 28)
192 check_varint32(buf, -1 << 30)
193
194
195def check_varuint32(buf: Buffer, value: int, bytes_written: int):

Callers

nothing calls this directly

Calls 5

check_varuint32Function · 0.85
check_varint32Function · 0.85
allocateMethod · 0.65
write_int8Method · 0.45
read_int8Method · 0.45

Tested by

no test coverage detected