Skip to content

Commit 61e2dfd

Browse files
committed
tests/extmod/uzlib_decompio: Add zlib bitstream testcases.
1 parent 1bc5cb4 commit 61e2dfd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/extmod/uzlib_decompio.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Raw DEFLATE bitstream
99
buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00')
10-
inp = zlib.DecompIO(buf)
10+
inp = zlib.DecompIO(buf, -8)
1111
print(buf.seek(0, 1))
1212
print(inp.read(1))
1313
print(buf.seek(0, 1))
@@ -17,3 +17,16 @@
1717
print(inp.read(1))
1818
print(inp.read())
1919
print(buf.seek(0, 1))
20+
21+
22+
# zlib bitstream
23+
inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1'))
24+
print(inp.read(10))
25+
print(inp.read())
26+
27+
# zlib bitstream, wrong checksum
28+
inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0'))
29+
try:
30+
print(inp.read())
31+
except OSError as e:
32+
print(repr(e))

tests/extmod/uzlib_decompio.py.exp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ b'lo'
77
b''
88
b''
99
7
10+
b'0000000000'
11+
b'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
12+
OSError(22,)

0 commit comments

Comments
 (0)