Skip to content

Test for MZ_STREAM_END - #4

Open
paul-bayleaf wants to merge 1 commit into
wkoszek:masterfrom
paul-bayleaf:test_MZ_STREAM_END
Open

Test for MZ_STREAM_END#4
paul-bayleaf wants to merge 1 commit into
wkoszek:masterfrom
paul-bayleaf:test_MZ_STREAM_END

Conversation

@paul-bayleaf

Copy link
Copy Markdown

Adds a unit test for correct decompression when the output buffer size given to mini_gz_unpack is exactly the size of the decompressed file. Also included a file test_MZ_STREAM_END.gz that currently fails this test. I have tested this against a set of 20000 .gz files, 231 of these fail -3 when decompressed with mini_gzip. PR #3 fixes it.

@paul-bayleaf

Copy link
Copy Markdown
Author

Example test run. Fails the new test. But will pass after PR #3 is applied.

paul@linux-paul:~/Documents/github/mini_gzip> make test
cp mini_gzip data
#cp /etc/services data
chmod 644 data

------------------ Compress with gzip(1), uncompress with mini_gzip

-rw-r--r-- 1 paul users 105560 Nov 20 17:47 data
gzip -c data > data.gz
./mini_gzip -d data.gz data.o
flag_c: 0 is_gzipped: 1
in_fn: data.gz out_fn: data.o level 0
uncomp_len = 105560
--- testing decompression --
out_len = 105560
ret = 105560
-rw-r--r-- 1 paul users 105560 Nov 20 17:47 data.o
diff data.o data

------------------ Uncompress test_MZ_STREAM_END.gz with mini_gzip

./mini_gzip -d test_MZ_STREAM_END.gz test_MZ_STREAM_END.o
flag_c: 0 is_gzipped: 1
in_fn: test_MZ_STREAM_END.gz out_fn: test_MZ_STREAM_END.o level 0
uncomp_len = 19200
--- testing decompression --
out_len = -3
Error: Uncompressed only -3 bytes, expected 19200, main:125
make: *** [makefile:33: test] Error 1
paul@linux-paul:~/Documents/github/mini_gzip>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant