summaryrefslogtreecommitdiff
path: root/test/example.c
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@nathanm.com>2019-06-22 00:25:39 -0700
committerHans Kristian Rosbach <hk-git@circlestorm.org>2019-06-22 09:25:39 +0200
commit553761a51f0b9af2161bdbb73789b8272df58cb9 (patch)
treebe32cbb86aa2f01020f3c80d2102daf7eae958cd /test/example.c
parentd1c35e4f992aea67e92f36dc5a7b8c0bdf5f46f2 (diff)
downloadProject-Tick-553761a51f0b9af2161bdbb73789b8272df58cb9.tar.gz
Project-Tick-553761a51f0b9af2161bdbb73789b8272df58cb9.zip
Remove duplicate gz functions in test code (#348)
Change CMakeLists.txt so that if WITH_GZFILEOP is OFF, gz* sources are still compiled against the tests which need them. Remove duplicate gz functions from test code. Always compile with gz functions when zlib tests enabled in makefile.
Diffstat (limited to 'test/example.c')
-rw-r--r--test/example.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/test/example.c b/test/example.c
index 13a828b72b..964a380d76 100644
--- a/test/example.c
+++ b/test/example.c
@@ -35,6 +35,9 @@ static const char hello[] = "hello, hello!";
static const char dictionary[] = "hello";
static unsigned long dictId = 0; /* Adler32 value of the dictionary */
+
+void test_compress (unsigned char *compr, z_size_t comprLen,unsigned char *uncompr, z_size_t uncomprLen);
+void test_gzio (const char *fname, unsigned char *uncompr, z_size_t uncomprLen);
void test_deflate (unsigned char *compr, size_t comprLen);
void test_inflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen);
void test_large_deflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen);
@@ -49,9 +52,6 @@ int main (int argc, char *argv[]);
static alloc_func zalloc = NULL;
static free_func zfree = NULL;
-void test_compress (unsigned char *compr, z_size_t comprLen,
- unsigned char *uncompr, z_size_t uncomprLen);
-
/* ===========================================================================
* Test compress() and uncompress()
*/
@@ -76,10 +76,6 @@ void test_compress(unsigned char *compr, z_size_t comprLen, unsigned char *uncom
}
}
-#ifdef WITH_GZFILEOP
-void test_gzio (const char *fname,
- unsigned char *uncompr, z_size_t uncomprLen);
-
/* ===========================================================================
* Test read/write of .gz files
*/
@@ -161,8 +157,6 @@ void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen)
#endif
}
-#endif /* WITH_GZFILEOP */
-
/* ===========================================================================
* Test deflate() with small buffers
*/
@@ -535,13 +529,8 @@ int main(int argc, char *argv[])
test_compress(compr, comprLen, uncompr, uncomprLen);
-#ifdef WITH_GZFILEOP
test_gzio((argc > 1 ? argv[1] : TESTFILE),
uncompr, uncomprLen);
-#else
- (void)argc;
- (void)argv;
-#endif
test_deflate(compr, comprLen);
test_inflate(compr, comprLen, uncompr, uncomprLen);