fixed fuzzer tests
which were modified in parallel within branc `dev`
This commit is contained in:
parent
b5528ac86c
commit
4aff9b10b5
@ -454,7 +454,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
FUZ_CHECKTEST(ret==0, "LZ4_compress_fast_extState() failed");
|
||||
|
||||
/* Test compression using fast reset external state*/
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
ret = LZ4_compress_fast_extState_fastReset(stateLZ4, block, compressedBuffer, blockSize, (int)compressedBufferSize, 8);
|
||||
FUZ_CHECKTEST(ret==0, "LZ4_compress_fast_extState_fastReset() failed");
|
||||
|
||||
@ -687,7 +687,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
} }
|
||||
|
||||
/* Compress using external dictionary stream */
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
{
|
||||
LZ4_stream_t LZ4_stream;
|
||||
int expectedSize;
|
||||
@ -713,13 +713,13 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
FUZ_CHECKTEST(blockContinueCompressedSize != expectedSize, "LZ4_compress_fast_continue using extDictCtx produced different-sized output (%d expected vs %d actual)", expectedSize, blockContinueCompressedSize);
|
||||
FUZ_CHECKTEST(XXH32(compressedBuffer, blockContinueCompressedSize, 0) != expectedCrc, "LZ4_compress_fast_continue using extDictCtx produced different output");
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
LZ4_resetStream(&LZ4_stream);
|
||||
LZ4_attach_dictionary(&LZ4_stream, &LZ4dict);
|
||||
ret = LZ4_compress_fast_continue(&LZ4_stream, block, compressedBuffer, blockSize, blockContinueCompressedSize-1, 1);
|
||||
FUZ_CHECKTEST(ret>0, "LZ4_compress_fast_continue using extDictCtx should fail : one missing byte for output buffer : %i written, %i buffer", ret, blockContinueCompressedSize);
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
LZ4_resetStream(&LZ4_stream);
|
||||
LZ4_attach_dictionary(&LZ4_stream, &LZ4dict);
|
||||
ret = LZ4_compress_fast_continue(&LZ4_stream, block, compressedBuffer, blockSize, blockContinueCompressedSize, 1);
|
||||
@ -728,7 +728,7 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
FUZ_CHECKTEST(ret != expectedSize, "LZ4_compress_fast_continue using extDictCtx produced different-sized output");
|
||||
FUZ_CHECKTEST(XXH32(compressedBuffer, ret, 0) != expectedCrc, "LZ4_compress_fast_continue using extDictCtx produced different output");
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
LZ4_resetStream_fast(&LZ4_stream);
|
||||
LZ4_attach_dictionary(&LZ4_stream, &LZ4dict);
|
||||
ret = LZ4_compress_fast_continue(&LZ4_stream, block, compressedBuffer, blockSize, blockContinueCompressedSize, 1);
|
||||
@ -739,36 +739,38 @@ static int FUZ_test(U32 seed, U32 nbCycles, const U32 startCycle, const double c
|
||||
}
|
||||
|
||||
/* Decompress with dictionary as external */
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
decodedBuffer[blockSize] = 0;
|
||||
ret = LZ4_decompress_fast_usingDict(compressedBuffer, decodedBuffer, blockSize, dict, dictSize);
|
||||
FUZ_CHECKTEST(ret!=blockContinueCompressedSize, "LZ4_decompress_fast_usingDict did not read all compressed block input");
|
||||
FUZ_CHECKTEST(decodedBuffer[blockSize], "LZ4_decompress_fast_usingDict overrun specified output buffer size");
|
||||
crcCheck = XXH32(decodedBuffer, blockSize, 0);
|
||||
{ U32 const crcCheck = XXH32(decodedBuffer, blockSize, 0);
|
||||
if (crcCheck!=crcOrig) FUZ_findDiff(block, decodedBuffer);
|
||||
FUZ_CHECKTEST(crcCheck!=crcOrig, "LZ4_decompress_fast_usingDict corrupted decoded data (dict %i)", dictSize);
|
||||
}
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
decodedBuffer[blockSize] = 0;
|
||||
ret = LZ4_decompress_safe_usingDict(compressedBuffer, decodedBuffer, blockContinueCompressedSize, blockSize, dict, dictSize);
|
||||
FUZ_CHECKTEST(ret!=blockSize, "LZ4_decompress_safe_usingDict did not regenerate original data");
|
||||
FUZ_CHECKTEST(decodedBuffer[blockSize], "LZ4_decompress_safe_usingDict overrun specified output buffer size");
|
||||
crcCheck = XXH32(decodedBuffer, blockSize, 0);
|
||||
{ U32 const crcCheck = XXH32(decodedBuffer, blockSize, 0);
|
||||
FUZ_CHECKTEST(crcCheck!=crcOrig, "LZ4_decompress_safe_usingDict corrupted decoded data");
|
||||
}
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
decodedBuffer[blockSize-1] = 0;
|
||||
ret = LZ4_decompress_fast_usingDict(compressedBuffer, decodedBuffer, blockSize-1, dict, dictSize);
|
||||
FUZ_CHECKTEST(ret>=0, "LZ4_decompress_fast_usingDict should have failed : wrong original size (-1 byte)");
|
||||
FUZ_CHECKTEST(decodedBuffer[blockSize-1], "LZ4_decompress_fast_usingDict overrun specified output buffer size");
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
decodedBuffer[blockSize-1] = 0;
|
||||
ret = LZ4_decompress_safe_usingDict(compressedBuffer, decodedBuffer, blockContinueCompressedSize, blockSize-1, dict, dictSize);
|
||||
FUZ_CHECKTEST(ret>=0, "LZ4_decompress_safe_usingDict should have failed : not enough output size (-1 byte)");
|
||||
FUZ_CHECKTEST(decodedBuffer[blockSize-1], "LZ4_decompress_safe_usingDict overrun specified output buffer size");
|
||||
|
||||
FUZ_DISPLAYTEST;
|
||||
FUZ_DISPLAYTEST();
|
||||
{ U32 const missingBytes = (FUZ_rand(&randState) & 0xF) + 2;
|
||||
if ((U32)blockSize > missingBytes) {
|
||||
decodedBuffer[blockSize-missingBytes] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user