def test_uint64(self):
if sys.maxsize != (1 << 63)-1:
pytest.skip('64 bit only')
if IS_PYPY and sys.pypy_version_info < (5, 6):
pytest.skip('Broken on PyPy<5.6')
#
buf = struct.pack('QQ', sys.maxsize, sys.maxsize+1)
s = BaseSegment(buf)
#
val = s.read_uint64_magic(0)
assert val == sys.maxsize == s.read_uint64(0)
assert type(val) is int
#
val = s.read_primitive(0, ord('Q'))
assert val == sys.maxsize == s.read_uint64(0)
assert type(val) is int
#
val = s.read_uint64_magic(8)
assert val == sys.maxsize+1 == s.read_uint64(8)
if PY3:
assert type(val) is int
else:
assert type(val) is long
评论列表
文章目录