summaryrefslogtreecommitdiffstats
path: root/tests/frametest.c
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2017-01-03 05:09:52 (GMT)
committerGitHub <noreply@github.com>2017-01-03 05:09:52 (GMT)
commit7bb64ff2b69a9f8367de9ab483cdadf42b4c1b65 (patch)
tree35151b46f6ff17ff4fa8c8cfd53ab6e614c8fc97 /tests/frametest.c
parent018ddf799917ee5c68b5266d6f42277fa6750080 (diff)
parent16d69c8d039e42defbf7387dd0e4e9318017eb6d (diff)
downloadlz4-1.7.5.zip
lz4-1.7.5.tar.gz
lz4-1.7.5.tar.bz2
Merge pull request #297 from lz4/devv1.7.5
v1.7.5
Diffstat (limited to 'tests/frametest.c')
-rw-r--r--tests/frametest.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/tests/frametest.c b/tests/frametest.c
index a99728f..e2e0f86 100644
--- a/tests/frametest.c
+++ b/tests/frametest.c
@@ -35,6 +35,7 @@
/*-************************************
* Includes
**************************************/
+#include "util.h" /* U32 */
#include <stdlib.h> /* malloc, free */
#include <stdio.h> /* fprintf */
#include <string.h> /* strcmp */
@@ -45,25 +46,6 @@
#include "xxhash.h" /* XXH64 */
-/*-************************************
-* Basic Types
-**************************************/
-#if !defined(__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
-# include <stdint.h>
-typedef uint8_t BYTE;
-typedef uint16_t U16;
-typedef uint32_t U32;
-typedef int32_t S32;
-typedef uint64_t U64;
-#else
-typedef unsigned char BYTE;
-typedef unsigned short U16;
-typedef unsigned int U32;
-typedef signed int S32;
-typedef unsigned long long U64;
-#endif
-
-
/* unoptimized version; solves endianess & alignment issues */
static void FUZ_writeLE32 (void* dstVoidPtr, U32 value32)
{
@@ -110,7 +92,7 @@ static clock_t g_clockTime = 0;
*****************************************/
static U32 no_prompt = 0;
static U32 displayLevel = 2;
-static U32 pause = 0;
+static U32 use_pause = 0;
/*-*******************************************************
@@ -204,6 +186,13 @@ int basicTests(U32 seed, double compressibility)
FUZ_fillCompressibleNoiseBuffer(CNBuffer, COMPRESSIBLE_NOISE_LENGTH, compressibility, &randState);
crcOrig = XXH64(CNBuffer, COMPRESSIBLE_NOISE_LENGTH, 1);
+ /* LZ4F_compressBound() : special case : srcSize == 0 */
+ DISPLAYLEVEL(3, "LZ4F_compressBound(0) = ");
+ { size_t const cBound = LZ4F_compressBound(0, NULL);
+ if (cBound < 64 KB) goto _output_error;
+ DISPLAYLEVEL(3, " %u \n", (U32)cBound);
+ }
+
/* Special case : null-content frame */
testSize = 0;
DISPLAYLEVEL(3, "LZ4F_compressFrame, compress null content : \n");
@@ -723,7 +712,7 @@ _end:
free(compressedBuffer);
free(decodedBuffer);
- if (pause) {
+ if (use_pause) {
DISPLAY("press enter to finish \n");
(void)getchar();
}
@@ -795,7 +784,7 @@ int main(int argc, const char** argv)
break;
case 'p': /* pause at the end */
argument++;
- pause = 1;
+ use_pause = 1;
break;
case 'i':