summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2021-03-14 14:08:43 +0000
committerAndreas Kling <kling@serenityos.org>2021-03-14 21:37:29 +0100
commiteecaa3bed65c91d839e5a740fded3eb97c26fd11 (patch)
tree6b442cb0d02ff35bea777616fc9282b855dab416
parent81cbb2676e20bcb5a358bdc1ba672d47e5c90241 (diff)
downloadserenity-eecaa3bed65c91d839e5a740fded3eb97c26fd11.zip
test-compress: Initialize byte buffer with random data
-rw-r--r--Userland/Utilities/test-compress.cpp4
1 files changed, 3 insertions, 1 deletions
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());