Improve unit test

dev
senhuang42 2020-11-12 11:09:01 -05:00
parent 4d4fd2c55f
commit 1a8af0de73
2 changed files with 4 additions and 4 deletions

View File

@ -2497,7 +2497,6 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex]; ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex];
size_t i; size_t i;
int repIdx;
U32 rep[ZSTD_REP_NUM]; U32 rep[ZSTD_REP_NUM];
U32 shouldUpdateRep; U32 shouldUpdateRep;
@ -2561,8 +2560,9 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
} }
outSeqs[i].offset = rawOffset; outSeqs[i].offset = rawOffset;
if (shouldUpdateRep) { if (shouldUpdateRep) {
for (int i = ZSTD_REP_NUM - 1; i > 0; i--) { int j;
rep[i] = rep[i - 1]; for (j = ZSTD_REP_NUM - 1; j > 0; j--) {
rep[j] = rep[j - 1];
} }
rep[0] = outSeqs[i].offset; rep[0] = outSeqs[i].offset;
} }

View File

@ -2723,7 +2723,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
assert(cctx != NULL); assert(cctx != NULL);
/* Populate src with random data */ /* Populate src with random data */
RDG_genBuffer(CNBuffer, srcSize, compressibility, 0., seed); RDG_genBuffer(CNBuffer, srcSize, compressibility, 0.5, seed);
/* Test with block delimiters roundtrip */ /* Test with block delimiters roundtrip */
seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize); seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize);