diff options
author | Martin Pool <mbp@samba.org> | 2002-11-05 02:52:01 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2002-11-05 02:52:01 +0000 |
commit | 97d34f85c71acf52ea8ef5d04939eda0cbc47850 (patch) | |
tree | ca2d2dd0eb89601b798cc6ba52c9f876f24167f4 | |
parent | 48e10c116d2ae79ef2e56aab89a706a76948a171 (diff) | |
download | samba-97d34f85c71acf52ea8ef5d04939eda0cbc47850.tar.gz |
Update test cases.
(This used to be commit db2c393dd488dad2ce95f3b3cf0297d5b0159ae7)
-rwxr-xr-x | source3/python/examples/tdbpack/test_tdbpack.py | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/source3/python/examples/tdbpack/test_tdbpack.py b/source3/python/examples/tdbpack/test_tdbpack.py index a88c92f2037..2bad93dbc3c 100755 --- a/source3/python/examples/tdbpack/test_tdbpack.py +++ b/source3/python/examples/tdbpack/test_tdbpack.py @@ -22,34 +22,10 @@ import samba.tdbpack both_unpackers = (samba.tdbpack.unpack, oldtdbutil.unpack) both_packers = (samba.tdbpack.pack, oldtdbutil.pack) - -class PackTests(unittest.TestCase): - symm_cases = [ - ('w', [42], '\x2a\0'), - ('www', [42, 2, 69], '\x2a\0\x02\0\x45\0'), - ('wd', [42, 256], '\x2a\0\0\x01\0\0'), - ('w', [0], '\0\0'), - ('w', [255], '\xff\0'), - ('w', [256], '\0\x01'), - ('w', [0xdead], '\xad\xde'), - ('w', [0xffff], '\xff\xff'), - ('p', [0], '\0\0\0\0'), - ('p', [1], '\x01\0\0\0'), - ('d', [0x01020304], '\x04\x03\x02\x01'), - ('d', [0x7fffffff], '\xff\xff\xff\x7f'), - ('d', [0x80000000L], '\x00\x00\x00\x80'), - ('d', [0x80000069L], '\x69\x00\x00\x80'), -# ('d', [-1], '\xff\xff\xff\xff'), -# ('d', [-255], '\x01\xff\xff\xff'), -# ('d', [-256], '\x00\xff\xff\xff'), -# ('ddd', [1, 10, 50], '\x01\0\0\0\x0a\0\0\0\x32\0\0\0'), -# ('ff', ['hello', 'world'], 'hello\0world\0'), -# ('fP', ['hello', 'world'], 'hello\0world\0'), -# ('PP', ['hello', 'world'], 'hello\0world\0'), -# ('B', [0, ''], '\0\0\0\0'), -# ('B', [5, 'hello'], '\x05\0\0\0hello'), + + + # # ('B', [10, 'hello'], '\x0a\0\0\0hello'), -# # ('B', [2, 'hello'], '\x0a\0\0\0hello'), # ('BB', [11, 'hello\0world', 3, 'now'], # '\x0b\0\0\0hello\0world\x03\0\0\0now'), # ('pd', [1, 10], '\x01\0\0\0\x0a\0\0\0'), @@ -76,12 +52,40 @@ class PackTests(unittest.TestCase): # ('BB', [(5 * 40000), 'hello' * 40000, # (5 * 50000), 'world' * 50000], # '\x40\x0d\x03\0' + 'hello' * 40000 + '\x90\xd0\x03\x00' + 'world' * 50000), + + +class PackTests(unittest.TestCase): + symm_cases = [ + ('w', [42], '\x2a\0'), + ('www', [42, 2, 69], '\x2a\0\x02\0\x45\0'), + ('wd', [42, 256], '\x2a\0\0\x01\0\0'), + ('w', [0], '\0\0'), + ('w', [255], '\xff\0'), + ('w', [256], '\0\x01'), + ('w', [0xdead], '\xad\xde'), + ('w', [0xffff], '\xff\xff'), + ('p', [0], '\0\0\0\0'), + ('p', [1], '\x01\0\0\0'), + ('d', [0x01020304], '\x04\x03\x02\x01'), + ('d', [0x7fffffff], '\xff\xff\xff\x7f'), + ('d', [0x80000000L], '\x00\x00\x00\x80'), + ('d', [0x80000069L], '\x69\x00\x00\x80'), + ('d', [0xffffffffL], '\xff\xff\xff\xff'), + ('d', [0xffffff00L], '\x00\xff\xff\xff'), + ('ddd', [1, 10, 50], '\x01\0\0\0\x0a\0\0\0\x32\0\0\0'), + ('ff', ['hello', 'world'], 'hello\0world\0'), + ('fP', ['hello', 'world'], 'hello\0world\0'), + ('PP', ['hello', 'world'], 'hello\0world\0'), + ('B', [0, ''], '\0\0\0\0'), +# old implementation is wierd when string is not the right length +# ('B', [2, 'hello'], '\x0a\0\0\0hello'), + ('B', [5, 'hello'], '\x05\0\0\0hello'), ] def test_symmetric(self): """Cookbook of symmetric pack/unpack tests """ - for packer in both_packers: + for packer in [samba.tdbpack.pack]: # both_packers: for unpacker in both_unpackers: for format, values, expected in self.symm_cases: out_packed = packer(format, values) |