Update unit tests
This commit is contained in:
parent
779df995c6
commit
7d1dea070c
@ -2570,7 +2570,7 @@ size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
|
||||
return zc->seqCollector.seqIndex;
|
||||
}
|
||||
|
||||
size_t ZSTD_mergeGeneratedSequences(ZSTD_Sequence* sequences, size_t seqsSize) {
|
||||
size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize) {
|
||||
size_t in = 0;
|
||||
size_t out = 0;
|
||||
for (; in < seqsSize; ++in) {
|
||||
|
16
lib/zstd.h
16
lib/zstd.h
@ -1303,10 +1303,12 @@ typedef enum {
|
||||
} ZSTD_sequenceFormat_e;
|
||||
|
||||
/*! ZSTD_generateSequences() :
|
||||
* Extract sequences from the sequence store.
|
||||
* Generate sequences using ZSTD_compress2, given a source buffer.
|
||||
*
|
||||
* Each block will end with a dummy sequence
|
||||
* with offset == 0, matchLength == 0, and litLength == length of last literals.
|
||||
* litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)
|
||||
* simply acts as a block delimiter.
|
||||
*
|
||||
* zc can be used to insert custom compression params.
|
||||
* This function invokes ZSTD_compress2
|
||||
@ -1316,17 +1318,15 @@ typedef enum {
|
||||
ZSTDLIB_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
|
||||
size_t outSeqsSize, const void* src, size_t srcSize);
|
||||
|
||||
/*! ZSTD_mergeGeneratedSequences() :
|
||||
* Convert an array of ZSTD_Sequence in the representation specified in ZSTD_generateSequences()
|
||||
* and merge all "dummy" sequences that represent last literals and block boundaries.
|
||||
*
|
||||
* Any last literals in the block will be merged into the literals of the next sequence.
|
||||
/*! ZSTD_mergeBlockDelimiters() :
|
||||
* Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals
|
||||
* by merging them into into the literals of the next sequence.
|
||||
*
|
||||
* As such, the final generated result has no explicit representation of block boundaries,
|
||||
* and the final last literals segment is not represented in the sequences.
|
||||
* @return : number of sequences in final result
|
||||
* @return : number of sequences left after merging
|
||||
*/
|
||||
ZSTDLIB_API size_t ZSTD_mergeGeneratedSequences(ZSTD_Sequence* sequences, size_t seqsSize);
|
||||
ZSTDLIB_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize);
|
||||
|
||||
/***************************************
|
||||
* Memory management
|
||||
|
@ -2725,12 +2725,12 @@ static int basicUnitTests(U32 const seed, double compressibility)
|
||||
RDG_genBuffer(CNBuffer, srcSize, compressibility, 0., seed);
|
||||
|
||||
/* Test with block delimiters roundtrip */
|
||||
seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize, ZSTD_sf_explicitBlockDelimiters);
|
||||
seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize);
|
||||
FUZ_decodeSequences(decoded, seqs, seqsSize, src, srcSize, ZSTD_sf_explicitBlockDelimiters);
|
||||
assert(!memcmp(CNBuffer, compressedBuffer, srcSize));
|
||||
|
||||
/* Test no block delimiters roundtrip */
|
||||
seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize, ZSTD_sf_noBlockDelimiters);
|
||||
seqsSize = ZSTD_mergeBlockDelimiters(seqs, seqsSize);
|
||||
FUZ_decodeSequences(decoded, seqs, seqsSize, src, srcSize, ZSTD_sf_noBlockDelimiters);
|
||||
assert(!memcmp(CNBuffer, compressedBuffer, srcSize));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user