mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Merge c514f1f434 into 82d322c497
This commit is contained in:
commit
08c080afb4
2 changed files with 22 additions and 2 deletions
|
|
@ -638,9 +638,10 @@ static size_t COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer,
|
|||
const size_t testSamplesSize = splitPoint < 1.0 ? COVER_sum(samplesSizes + nbTrainSamples, nbTestSamples) : totalSamplesSize;
|
||||
ctx->displayLevel = displayLevel;
|
||||
/* Checks */
|
||||
if (totalSamplesSize < MAX(d, sizeof(U64)) ||
|
||||
if (trainingSamplesSize < MAX(d, sizeof(U64)) ||
|
||||
totalSamplesSize < MAX(d, sizeof(U64)) ||
|
||||
totalSamplesSize >= (size_t)COVER_MAX_SAMPLES_SIZE) {
|
||||
DISPLAYLEVEL(1, "Total samples size is too large (%u MB), maximum size is %u MB\n",
|
||||
DISPLAYLEVEL(1, "Total samples size is too small or too large (%u MB), maximum size is %u MB\n",
|
||||
(unsigned)(totalSamplesSize>>20), (COVER_MAX_SAMPLES_SIZE >> 20));
|
||||
return ERROR(srcSize_wrong);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3807,6 +3807,25 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
|||
if (ZDICT_isError(optDictSize)) goto _output_error;
|
||||
DISPLAYLEVEL(3, "OK, created dictionary of size %u \n", (unsigned)optDictSize);
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : ZDICT_optimizeTrainFromBuffer_cover with tiny training set : ", testNb++);
|
||||
{ BYTE tinySamples[10];
|
||||
size_t tinySampleSizes[10];
|
||||
size_t result;
|
||||
U32 u;
|
||||
for (u=0; u<10; u++) {
|
||||
tinySamples[u] = (BYTE)u;
|
||||
tinySampleSizes[u] = 1;
|
||||
}
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.splitPoint = 0.5;
|
||||
result = ZDICT_optimizeTrainFromBuffer_cover(dictBuffer, optDictSize,
|
||||
tinySamples, tinySampleSizes,
|
||||
10, ¶ms);
|
||||
if (!ZDICT_isError(result)) goto _output_error;
|
||||
if (ZSTD_getErrorCode(result) != ZSTD_error_srcSize_wrong) goto _output_error;
|
||||
}
|
||||
DISPLAYLEVEL(3, "OK \n");
|
||||
|
||||
DISPLAYLEVEL(3, "test%3i : check dictID : ", testNb++);
|
||||
dictID = ZDICT_getDictID(dictBuffer, optDictSize);
|
||||
if (dictID==0) goto _output_error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue