MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_compress

Function test_compress

freebsd/contrib/zlib/test/example.c:88–109  ·  view source on GitHub ↗

=========================================================================== * Test compress() and uncompress() */

(compr, comprLen, uncompr, uncomprLen)

Source from the content-addressed store, hash-verified

86 * Test compress() and uncompress()
87 */
88void test_compress(compr, comprLen, uncompr, uncomprLen)
89 Byte *compr, *uncompr;
90 uLong comprLen, uncomprLen;
91{
92 int err;
93 uLong len = (uLong)strlen(hello)+1;
94
95 err = compress(compr, &comprLen, (const Bytef*)hello, len);
96 CHECK_ERR(err, "compress");
97
98 strcpy((char*)uncompr, "garbage");
99
100 err = uncompress(uncompr, &uncomprLen, compr, comprLen);
101 CHECK_ERR(err, "uncompress");
102
103 if (strcmp((char*)uncompr, hello)) {
104 fprintf(stderr, "bad uncompress\n");
105 exit(1);
106 } else {
107 printf("uncompress(): %s\n", (char *)uncompr);
108 }
109}
110
111/* ===========================================================================
112 * Test read/write of .gz files

Callers 1

mainFunction · 0.70

Calls 4

uncompressFunction · 0.85
strcmpFunction · 0.85
compressFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected