From 512431a228b0eee072f3f3475089aa4db2d52edf Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 13 Mar 2021 01:29:22 +0200 Subject: [PATCH] test-compress: Add GZip compression tests --- Userland/Utilities/test-compress.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Userland/Utilities/test-compress.cpp b/Userland/Utilities/test-compress.cpp index 766345e7d7..4c7f4fc798 100644 --- a/Userland/Utilities/test-compress.cpp +++ b/Userland/Utilities/test-compress.cpp @@ -258,4 +258,15 @@ TEST_CASE(gzip_decompress_repeat_around_buffer) EXPECT(uncompressed == decompressed.value().bytes()); } +TEST_CASE(gzip_round_trip) +{ + auto original = ByteBuffer::create_uninitialized(1024); + fill_with_random(original.data(), 1024); + auto compressed = Compress::GzipCompressor::compress_all(original); + EXPECT(compressed.has_value()); + auto uncompressed = Compress::GzipDecompressor::decompress_all(compressed.value()); + EXPECT(uncompressed.has_value()); + EXPECT(uncompressed.value() == original); +} + TEST_MAIN(Compress)