2011-05-26 14:04:46 +10:00
|
|
|
#!/usr/bin/env python
|
2012-02-02 10:03:18 +11:00
|
|
|
#
|
|
|
|
|
# Copyright (c) 2008-2012 WiredTiger, Inc.
|
2012-02-02 20:18:52 +00:00
|
|
|
# All rights reserved.
|
2012-02-02 10:03:18 +11:00
|
|
|
#
|
2012-02-02 20:18:52 +00:00
|
|
|
# See the file LICENSE for redistribution information.
|
2011-05-26 14:04:46 +10:00
|
|
|
|
|
|
|
|
from packing import pack, unpack
|
|
|
|
|
|
|
|
|
|
def check(fmt, *v):
|
|
|
|
|
print fmt, repr(v), ''.join('%02x' % ord(c) for c in pack(fmt, *v))
|
|
|
|
|
|
|
|
|
|
check('iii', 0, 101, -99)
|
|
|
|
|
check('3i', 0, 101, -99)
|
|
|
|
|
check('iS', 42, "forty two")
|
|
|
|
|
check('u', r"\x42" * 20)
|
|
|
|
|
check('uu', r"\x42" * 10, r"\x42" * 10)
|