From: Sen Huang Date: Fri, 15 Nov 2019 17:26:48 +0000 (-0500) Subject: Modified existing RLE test to take compressed size into account X-Git-Tag: v1.4.5^2~154^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75c34684c0e8fedf3b6afffe91f2ad5321835860;p=thirdparty%2Fzstd.git Modified existing RLE test to take compressed size into account --- diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 88f3b83f8..e757daaba 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1999,14 +1999,14 @@ static int basicUnitTests(U32 const seed, double compressibility) /* long rle test */ { size_t sampleSize = 0; + size_t expectedCompressedSize = 39; /* two RLE blocks, zstd 1.4.4 */ DISPLAYLEVEL(3, "test%3i : Long RLE test : ", testNb++); - RDG_genBuffer(CNBuffer, sampleSize, compressibility, 0., seed+1); memset((char*)CNBuffer+sampleSize, 'B', 256 KB - 1); sampleSize += 256 KB - 1; - RDG_genBuffer((char*)CNBuffer+sampleSize, 96 KB, compressibility, 0., seed+2); + memset((char*)CNBuffer+sampleSize, 'A', 96 KB); sampleSize += 96 KB; cSize = ZSTD_compress(compressedBuffer, ZSTD_compressBound(sampleSize), CNBuffer, sampleSize, 1); - if (ZSTD_isError(cSize)) goto _output_error; + if (ZSTD_isError(cSize) || cSize > expectedCompressedSize * 1.1) goto _output_error; { CHECK_NEWV(regenSize, ZSTD_decompress(decodedBuffer, sampleSize, compressedBuffer, cSize)); if (regenSize!=sampleSize) goto _output_error; } DISPLAYLEVEL(3, "OK \n");