Add simple tests (run ./pytest).

This commit is contained in:
Elliot Nunn 2018-12-13 12:51:38 +08:00
parent ddfb909212
commit c752c70c6a

13
test_everything.py Normal file
View File

@ -0,0 +1,13 @@
from ResDecompress import GetEncoding, DecompressResource, CompressResource
def compress_then_extract(dat, encoding):
a = CompressResource(dat, encoding);
if encoding != 'UnknownCompression': assert a.startswith(b'\xA8\x9F\x65\x72')
assert GetEncoding(a) == encoding
b = DecompressResource(a)
assert b == dat
def test_all():
for enc in ['GreggyBits', 'UnknownCompression']:
compress_then_extract(bytes(100), encoding=enc)
compress_then_extract(b'The quick brown fox jumps over the lazy dog', encoding=enc)