diff options
author | Yann Collet <cyan@fb.com> | 2017-04-09 08:41:36 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-04-09 08:41:36 (GMT) |
commit | e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1 (patch) | |
tree | c713ab373bca1e02a55036432a90fe8782e31197 /tests | |
parent | 7eecd32c079cdf1afda8c00bba83dd3a1fee3f62 (diff) | |
download | lz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.zip lz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.tar.gz lz4-e2c9b19122a19fa8a46a253e4ce556a5b75fa8b1.tar.bz2 |
lz4frame : Added negative compression levels
Diffstat (limited to 'tests')
-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); |