diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2017-04-11 21:43:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-11 21:43:11 (GMT) |
commit | 31e9ed612bfafade0a8589fb71b6f1f43bd439c2 (patch) | |
tree | c713ab373bca1e02a55036432a90fe8782e31197 /tests/frametest.c | |
parent | e2827775ee80d2ef985858727575df31fc60f1f3 (diff) | |
parent | e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1 (diff) | |
download | lz4-31e9ed612bfafade0a8589fb71b6f1f43bd439c2.zip lz4-31e9ed612bfafade0a8589fb71b6f1f43bd439c2.tar.gz lz4-31e9ed612bfafade0a8589fb71b6f1f43bd439c2.tar.bz2 |
Merge pull request #347 from lz4/negativeCLevels
Negative Compression levels
Diffstat (limited to 'tests/frametest.c')
-rw-r--r-- | tests/frametest.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index ae8416b..a4c548e 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -218,6 +218,16 @@ int basicTests(U32 seed, double compressibility) /* test one-pass frame compression */ testSize = COMPRESSIBLE_NOISE_LENGTH; + + DISPLAYLEVEL(3, "LZ4F_compressFrame, using fast level -3 : "); + { LZ4F_preferences_t fastCompressPrefs; + memset(&fastCompressPrefs, 0, sizeof(fastCompressPrefs)); + fastCompressPrefs.compressionLevel = -3; + cSize = LZ4F_compressFrame(compressedBuffer, LZ4F_compressFrameBound(testSize, NULL), CNBuffer, testSize, &fastCompressPrefs); + if (LZ4F_isError(cSize)) goto _output_error; + DISPLAYLEVEL(3, "Compressed %u bytes into a %u bytes frame \n", (U32)testSize, (U32)cSize); + } + DISPLAYLEVEL(3, "LZ4F_compressFrame, using default preferences : "); cSize = LZ4F_compressFrame(compressedBuffer, LZ4F_compressFrameBound(testSize, NULL), CNBuffer, testSize, NULL); if (LZ4F_isError(cSize)) goto _output_error; @@ -618,7 +628,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi prefs.frameInfo.contentChecksumFlag = (LZ4F_contentChecksum_t)(FUZ_rand(&randState) & 1); prefs.frameInfo.contentSize = ((FUZ_rand(&randState) & 0xF) == 1) ? srcSize : 0; prefs.autoFlush = neverFlush ? 0 : (FUZ_rand(&randState) & 7) == 2; - prefs.compressionLevel = FUZ_rand(&randState) % 5; + prefs.compressionLevel = -5 + (int)(FUZ_rand(&randState) % 11); if ((FUZ_rand(&randState) & 0xF) == 1) prefsPtr = NULL; DISPLAYUPDATE(2, "\r%5u ", testNb); |