1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

test_pack_extra: Add additional cases.

test_pack_failures: Remove cases for which old code is too lax.
This commit is contained in:
Martin Pool -
parent 12c3bb99a5
commit 631945a03a

View File

@ -125,6 +125,8 @@ class PackTests(unittest.TestCase):
"""Leftover values when packing""" """Leftover values when packing"""
cases = [ cases = [
('d', [10, 20], [10]), ('d', [10, 20], [10]),
('d', [10, 'hello'], [10]),
('ff', ['hello', 'world', 'sailor'], ['hello', 'world']),
] ]
for unpacker in both_unpackers: for unpacker in both_unpackers:
for packer in both_packers: for packer in both_packers:
@ -160,23 +162,26 @@ class PackTests(unittest.TestCase):
# ('w', [0x60A15EC5L]), # ('w', [0x60A15EC5L]),
('w', [None]), ('w', [None]),
('d', []), ('d', []),
('d', [0L]),
('p', []), ('p', []),
('f', [2]), ('f', [2]),
('P', [None]), ('P', [None]),
('P', ()), ('P', ()),
('f', [hex]), ('f', [hex]),
('fw', ['hello']), ('fw', ['hello']),
('f', [u'hello']), # ('f', [u'hello']),
('B', [2]), ('B', [2]),
(None, [2, 3, 4]), (None, [2, 3, 4]),
(ord('f'), [20]), (ord('f'), [20]),
(['w', 'w'], [2, 2]), # old code doesn't distinguish string from seq-of-char
('Q', [2]), # (['w', 'w'], [2, 2]),
('fQ', ['2', 3]), # old code just ignores invalid characters
('fQ', ['2']), # ('Q', [2]),
# ('fQ', ['2', 3]),
# ('fQ', ['2']),
(2, [2]), (2, [2]),
({}, {})] # old code doesn't typecheck format
# ({}, {})
]
for packer in both_packers: for packer in both_packers:
for format, values in cases: for format, values in cases:
try: try: