1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-05 19:15:58 +03:00

more tests

This commit is contained in:
Yann Collet
2015-11-18 11:29:32 +01:00
parent 94b9d8ec8d
commit b2549846ba
2 changed files with 66 additions and 72 deletions

View File

@@ -494,11 +494,6 @@ FORCE_INLINE size_t ZSTD_execSequence(BYTE* op,
/* offset beyond prefix */ /* offset beyond prefix */
if (match < vBase) return ERROR(corruption_detected); if (match < vBase) return ERROR(corruption_detected);
match = dictEnd - (base-match); match = dictEnd - (base-match);
if (match + sequence.matchLength <= dictEnd - 8)
{
ZSTD_wildcopy(op, match, sequence.matchLength); /* works even if matchLength < 8 */
return oMatchEnd - ostart;
}
if (match + sequence.matchLength <= dictEnd) if (match + sequence.matchLength <= dictEnd)
{ {
memcpy(op, match, sequence.matchLength); memcpy(op, match, sequence.matchLength);
@@ -507,11 +502,10 @@ FORCE_INLINE size_t ZSTD_execSequence(BYTE* op,
/* span extDict & currentPrefixSegment */ /* span extDict & currentPrefixSegment */
{ {
size_t length1 = dictEnd - match; size_t length1 = dictEnd - match;
size_t length2 = sequence.matchLength - length1;
memcpy(op, match, length1); memcpy(op, match, length1);
op += length1; op += length1;
memcpy(op, base, length2); /* will fail in case of overlapping match */ sequence.matchLength -= length1;
return oMatchEnd - ostart; match = base;
} }
} }

View File

@@ -155,17 +155,17 @@ test-zstd: zstd datagen
@echo "**** zstd round-trip tests **** " @echo "**** zstd round-trip tests **** "
./datagen | md5sum > tmp1 ./datagen | md5sum > tmp1
./datagen | ./zstd -v | ./zstd -d | md5sum > tmp2 ./datagen | ./zstd -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2 # check potential differences diff tmp1 tmp2
./datagen | ./zstd -6 -v | ./zstd -d | md5sum > tmp2 ./datagen | ./zstd -6 -v | ./zstd -d | md5sum > tmp2
diff tmp1 tmp2 # check potential differences diff tmp1 tmp2
./datagen -g256MB | md5sum > tmp1 ./datagen -g256MB | md5sum > tmp1
./datagen -g256MB | ./zstd -v | ./zstd -d | md5sum > tmp2 ./datagen -g256MB | ./zstd -v | ./zstd -d | md5sum > tmp2
#diff tmp1 tmp2 # check potential differences diff tmp1 tmp2
./datagen -g256MB | ./zstd -3 -v | ./zstd -d | md5sum > tmp2 ./datagen -g256MB | ./zstd -3 -v | ./zstd -d | md5sum > tmp2
#diff tmp1 tmp2 # check potential differences diff tmp1 tmp2
./datagen -g6GB -P99 | md5sum > tmp1 ./datagen -g6GB -P99 | md5sum > tmp1
./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d | md5sum > tmp2 ./datagen -g6GB -P99 | ./zstd -vq | ./zstd -d | md5sum > tmp2
#diff tmp1 tmp2 # check potential differences diff tmp1 tmp2
test-zstd32: zstd32 datagen test-zstd32: zstd32 datagen
./datagen | ./zstd32 -v | ./zstd32 -d > $(VOID) ./datagen | ./zstd32 -v | ./zstd32 -d > $(VOID)