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

Function test_compress

freebsd/contrib/zstd/zlibWrapper/examples/example.c:113–134  ·  view source on GitHub ↗

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

(compr, comprLen, uncompr, uncomprLen)

Source from the content-addressed store, hash-verified

111 * Test compress() and uncompress()
112 */
113void test_compress(compr, comprLen, uncompr, uncomprLen)
114 Byte *compr, *uncompr;
115 uLong comprLen, uncomprLen;
116{
117 int err;
118 uLong len = (uLong)strlen(hello)+1;
119
120 err = compress(compr, &comprLen, (const Bytef*)hello, len);
121 CHECK_ERR(err, "compress");
122
123 strcpy((char*)uncompr, "garbage");
124
125 err = uncompress(uncompr, &uncomprLen, compr, comprLen);
126 CHECK_ERR(err, "uncompress");
127
128 if (strcmp((char*)uncompr, hello)) {
129 fprintf(stderr, "bad uncompress\n");
130 exit(1);
131 } else {
132 printf("uncompress(): %s\n", (char *)uncompr);
133 }
134}
135
136/* ===========================================================================
137 * 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