Given an implementation of the gzip specification, how to test if it is compressing accordingly to the specification, i.e. a valid gzip file?
My unitary test compresses an input and then decompresses it, comparing the input with decompressed output. I dont think that is sufficient to guarantee it is satisfying the specification.
Anyone know a valid strategy to test a gzip compression function?
Simply use zlib‘s inflate to test the output. inflate is very careful to reject invalid deflate data, for security reasons.
Note however that that will only test the streams you run through it. You’ll need to craft many tests to make sure that you exercise all of the possible sorts of output that your deflator can produce.