[fuzzer] Check ZSTD_initStaticCDict() for every level

This commit is contained in:
Nick Terrell 2018-01-31 11:12:54 -08:00
parent ab3346af07
commit 9c8c69e41a

View File

@ -763,7 +763,10 @@ static int basicUnitTests(U32 seed, double compressibility)
DISPLAYLEVEL(3, "OK \n");
DISPLAYLEVEL(3, "test%3i : compress with static CDict : ", testNb++);
{ ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBuffSize, dictSize);
{ int const maxLevel = ZSTD_maxCLevel();
int level;
for (level = 1; level <= maxLevel; ++level) {
ZSTD_compressionParameters const cParams = ZSTD_getCParams(level, CNBuffSize, dictSize);
size_t const cdictSize = ZSTD_estimateCDictSize_advanced(dictSize, cParams, ZSTD_dlm_byCopy);
void* const cdictBuffer = malloc(cdictSize);
if (cdictBuffer==NULL) goto _output_error;
@ -778,13 +781,13 @@ static int basicUnitTests(U32 seed, double compressibility)
}
cSize = ZSTD_compress_usingCDict(cctx,
compressedBuffer, compressedBufferSize,
CNBuffer, CNBuffSize, cdict);
CNBuffer, MIN(10 KB, CNBuffSize), cdict);
if (ZSTD_isError(cSize)) {
DISPLAY("ZSTD_compress_usingCDict failed ");
goto _output_error;
} }
free(cdictBuffer);
}
} }
DISPLAYLEVEL(3, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100);
DISPLAYLEVEL(3, "test%3i : ZSTD_compress_usingCDict_advanced, no contentSize, no dictID : ", testNb++);