From eecaa3bed65c91d839e5a740fded3eb97c26fd11 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sun, 14 Mar 2021 14:08:43 +0000 Subject: [PATCH] test-compress: Initialize byte buffer with random data --- Userland/Utilities/test-compress.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/test-compress.cpp b/Userland/Utilities/test-compress.cpp index 9752c2b7e9..d51a0f08e2 100644 --- a/Userland/Utilities/test-compress.cpp +++ b/Userland/Utilities/test-compress.cpp @@ -159,7 +159,9 @@ TEST_CASE(deflate_round_trip_compress) TEST_CASE(deflate_round_trip_compress_large) { - auto original = ByteBuffer::create_uninitialized(Compress::DeflateCompressor::block_size * 2); // Compress a buffer larger than the maximum block size to test the sliding window mechanism + auto size = Compress::DeflateCompressor::block_size * 2; + auto original = ByteBuffer::create_uninitialized(size); // Compress a buffer larger than the maximum block size to test the sliding window mechanism + fill_with_random(original.data(), size); // Since the different levels just change how much time is spent looking for better matches, just use fast here to reduce test time auto compressed = Compress::DeflateCompressor::compress_all(original, Compress::DeflateCompressor::CompressionLevel::FAST); EXPECT(compressed.has_value());