test-compress: Initialize byte buffer with random data

This commit is contained in:
Brendan Coles 2021-03-14 14:08:43 +00:00 committed by Andreas Kling
parent 81cbb2676e
commit eecaa3bed6
Notes: sideshowbarker 2024-07-18 21:21:55 +09:00

View File

@ -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());