tests/extmod/uzlib_decompio: Add zlib bitstream testcases.
This commit is contained in:
parent
1bc5cb4312
commit
61e2dfd97d
@ -7,7 +7,7 @@ import uio as io
|
|||||||
|
|
||||||
# Raw DEFLATE bitstream
|
# Raw DEFLATE bitstream
|
||||||
buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00')
|
buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00')
|
||||||
inp = zlib.DecompIO(buf)
|
inp = zlib.DecompIO(buf, -8)
|
||||||
print(buf.seek(0, 1))
|
print(buf.seek(0, 1))
|
||||||
print(inp.read(1))
|
print(inp.read(1))
|
||||||
print(buf.seek(0, 1))
|
print(buf.seek(0, 1))
|
||||||
@ -17,3 +17,16 @@ print(buf.seek(0, 1))
|
|||||||
print(inp.read(1))
|
print(inp.read(1))
|
||||||
print(inp.read())
|
print(inp.read())
|
||||||
print(buf.seek(0, 1))
|
print(buf.seek(0, 1))
|
||||||
|
|
||||||
|
|
||||||
|
# zlib bitstream
|
||||||
|
inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1'))
|
||||||
|
print(inp.read(10))
|
||||||
|
print(inp.read())
|
||||||
|
|
||||||
|
# zlib bitstream, wrong checksum
|
||||||
|
inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0'))
|
||||||
|
try:
|
||||||
|
print(inp.read())
|
||||||
|
except OSError as e:
|
||||||
|
print(repr(e))
|
||||||
|
@ -7,3 +7,6 @@ b'lo'
|
|||||||
b''
|
b''
|
||||||
b''
|
b''
|
||||||
7
|
7
|
||||||
|
b'0000000000'
|
||||||
|
b'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
||||||
|
OSError(22,)
|
||||||
|
Loading…
Reference in New Issue
Block a user