From 618db4e739ed06b8b02e5a390cd41f9a90a46807 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 6 Nov 2002 01:50:31 +0000 Subject: Add another test case for repeated-unpack ('$') (This used to be commit 2a492c4854d4c6469d8c7d21aa187fef6303b641) --- source3/python/examples/tdbpack/test_tdbpack.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3') diff --git a/source3/python/examples/tdbpack/test_tdbpack.py b/source3/python/examples/tdbpack/test_tdbpack.py index 2bad93dbc3..83282e745e 100755 --- a/source3/python/examples/tdbpack/test_tdbpack.py +++ b/source3/python/examples/tdbpack/test_tdbpack.py @@ -239,6 +239,15 @@ class PackTests(unittest.TestCase): raise AssertionError("didn't get exception: format %s, values %s, unpacker %s" % (`format`, `values`, `unpacker`)) + def test_unpack_repeated(self): + cases = [(('df$', + '\x00\x00\x00\x00HP C LaserJet 4500-PS\x00Windows 4.0\x00\\print$\\WIN40\\0\\PSCRIPT.DRV\x00\\print$\\WIN40\\0\\PSCRIPT.DRV\x00\\print$\\WIN40\\0\\PSCRIPT.DRV\x00\\print$\\WIN40\\0\\PSCRIPT.HLP\x00\x00RAW\x00\\print$\\WIN40\\0\\readme.wri\x00\\print$\\WIN40\\0\\pscript.drv\x00\\print$\\WIN40\\0\\pscript.hlp\x00'), + ([0L, 'HP C LaserJet 4500-PS', 'Windows 4.0', '\\print$\\WIN40\\0\\PSCRIPT.DRV', '\\print$\\WIN40\\0\\PSCRIPT.DRV', '\\print$\\WIN40\\0\\PSCRIPT.DRV', '\\print$\\WIN40\\0\\PSCRIPT.HLP', '', 'RAW', '\\print$\\WIN40\\0\\readme.wri', '\\print$\\WIN40\\0\\pscript.drv', '\\print$\\WIN40\\0\\pscript.hlp'], ''))] + for unpacker in both_unpackers: + for input, expected in cases: + result = apply(unpacker, input) + if result != expected: + raise AssertionError("%s:\n input: %s\n output: %s\n expected: %s" % (`unpacker`, `input`, `result`, `expected`)) if __name__ == '__main__': -- cgit