Refactor and simplify compression tests

The current compression tests contains a lot of copy and pasted source code. We should unify that to ensure that all the compression backends are tested at different compression levels.