mirror of
https://github.com/facebook/zstd.git
synced 2025-12-03 11:51:14 +03:00
fixed fuzzer test
This commit is contained in:
@@ -246,6 +246,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
size_t const sampleUnitSize = 8 KB;
|
size_t const sampleUnitSize = 8 KB;
|
||||||
U32 const nbSamples = (U32)(totalSampleSize / sampleUnitSize);
|
U32 const nbSamples = (U32)(totalSampleSize / sampleUnitSize);
|
||||||
size_t* const samplesSizes = (size_t*) malloc(nbSamples * sizeof(size_t));
|
size_t* const samplesSizes = (size_t*) malloc(nbSamples * sizeof(size_t));
|
||||||
|
U32 dictID;
|
||||||
|
|
||||||
if (dictBuffer==NULL || samplesSizes==NULL) {
|
if (dictBuffer==NULL || samplesSizes==NULL) {
|
||||||
free(dictBuffer);
|
free(dictBuffer);
|
||||||
@@ -261,10 +262,9 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)dictSize);
|
DISPLAYLEVEL(4, "OK, created dictionary of size %u \n", (U32)dictSize);
|
||||||
|
|
||||||
DISPLAYLEVEL(4, "test%3i : check dictID : ", testNb++);
|
DISPLAYLEVEL(4, "test%3i : check dictID : ", testNb++);
|
||||||
{ U32 const dictID = ZDICT_getDictID(dictBuffer, dictSize);
|
dictID = ZDICT_getDictID(dictBuffer, dictSize);
|
||||||
if (dictID==0) goto _output_error;
|
if (dictID==0) goto _output_error;
|
||||||
DISPLAYLEVEL(4, "OK : %u \n", dictID);
|
DISPLAYLEVEL(4, "OK : %u \n", dictID);
|
||||||
}
|
|
||||||
|
|
||||||
DISPLAYLEVEL(4, "test%3i : compress with dictionary : ", testNb++);
|
DISPLAYLEVEL(4, "test%3i : compress with dictionary : ", testNb++);
|
||||||
cSize = ZSTD_compress_usingDict(cctx, compressedBuffer, ZSTD_compressBound(CNBuffSize),
|
cSize = ZSTD_compress_usingDict(cctx, compressedBuffer, ZSTD_compressBound(CNBuffSize),
|
||||||
@@ -274,14 +274,14 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
DISPLAYLEVEL(4, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100);
|
DISPLAYLEVEL(4, "OK (%u bytes : %.2f%%)\n", (U32)cSize, (double)cSize/CNBuffSize*100);
|
||||||
|
|
||||||
DISPLAYLEVEL(4, "test%3i : retrieve dictID from dictionary : ", testNb++);
|
DISPLAYLEVEL(4, "test%3i : retrieve dictID from dictionary : ", testNb++);
|
||||||
{ U32 const dictID = ZSTD_getDictID_fromDict(dictBuffer, dictSize);
|
{ U32 const did = ZSTD_getDictID_fromDict(dictBuffer, dictSize);
|
||||||
if (dictID != 0) goto _output_error; /* non-conformant (content-only) dictionary */
|
if (did != dictID) goto _output_error; /* non-conformant (content-only) dictionary */
|
||||||
}
|
}
|
||||||
DISPLAYLEVEL(4, "OK \n");
|
DISPLAYLEVEL(4, "OK \n");
|
||||||
|
|
||||||
DISPLAYLEVEL(4, "test%3i : retrieve dictID from frame : ", testNb++);
|
DISPLAYLEVEL(4, "test%3i : retrieve dictID from frame : ", testNb++);
|
||||||
{ U32 const dictID = ZSTD_getDictID_fromFrame(compressedBuffer, cSize);
|
{ U32 const did = ZSTD_getDictID_fromFrame(compressedBuffer, cSize);
|
||||||
if (dictID != 0) goto _output_error; /* non-conformant (content-only) dictionary */
|
if (did != dictID) goto _output_error; /* non-conformant (content-only) dictionary */
|
||||||
}
|
}
|
||||||
DISPLAYLEVEL(4, "OK \n");
|
DISPLAYLEVEL(4, "OK \n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user