summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-11-04 20:30:09 +0000
committerMartin Pool <mbp@samba.org>2002-11-04 20:30:09 +0000
commitf10a55e3bee1ecf0dc3a5050660e6977bbe67cd9 (patch)
treec13925d69732c1d98ec5ddd9f90c1205b2b8b03e /source3/python
parentc56f478ded33e58f2f5733d56e8ed27d7eb15e4b (diff)
downloadsamba-f10a55e3bee1ecf0dc3a5050660e6977bbe67cd9.tar.gz
samba-f10a55e3bee1ecf0dc3a5050660e6977bbe67cd9.tar.bz2
samba-f10a55e3bee1ecf0dc3a5050660e6977bbe67cd9.zip
test_pack_failures: The old code does not complain when there are too
many data values for the format, so we don't test that here. test_large: New test case for packing/unpack a thousand values. (This used to be commit 04cad599f40faf234b40090806bcd1ac0473470f)
Diffstat (limited to 'source3/python')
-rwxr-xr-xsource3/python/examples/tdbpack/test_tdbpack.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/source3/python/examples/tdbpack/test_tdbpack.py b/source3/python/examples/tdbpack/test_tdbpack.py
index c3e582abb6..ba0b26342a 100755
--- a/source3/python/examples/tdbpack/test_tdbpack.py
+++ b/source3/python/examples/tdbpack/test_tdbpack.py
@@ -84,8 +84,19 @@ class PackTests(unittest.TestCase):
out, rest = unpacker(format, expected)
self.assertEquals(rest, '')
self.assertEquals(list(values), list(out))
-
-
+
+ def test_large(self):
+ """Test large pack/unpack strings"""
+ large_cases = [('w' * 1000, xrange(1000)), ]
+ for packer in both_packers:
+ for unpacker in both_unpackers:
+ for format, values in large_cases:
+ packed = packer(format, values)
+ out, rest = unpacker(format, packed)
+ self.assertEquals(rest, '')
+ self.assertEquals(list(values), list(out))
+
+
def test_pack(self):
"""Cookbook of expected pack values
@@ -130,13 +141,10 @@ class PackTests(unittest.TestCase):
('w', {}),
('ww', [2]),
('w', 2),
- ('', [1, 2, 3]),
('w', None),
('wwwwwwwwwwww', []),
- ('w', [2, 3]),
- ('w', [0x60A15EC5L]),
+# ('w', [0x60A15EC5L]),
('w', [None]),
- ('w', xrange(10000)),
('d', []),
('d', [0L]),
('p', []),