Debian Codegraph @

ext/zlib-ng/test/test_compress_dual.cc

raw
1 /* test_compress_dual.cc - Test linking against both zlib and zlib-ng */
2
3 #include "zlib.h"
4
5 #include <stdio.h>
6 #include <stdint.h>
7 #include <stdlib.h>
8 #include <string.h>
9
10 #include "test_shared.h"
11
12 #include <gtest/gtest.h>
13
14 TEST(compress, basic_zlib) {
15 Byte compr[128], uncompr[128];
16 uLong compr_len = sizeof(compr), uncompr_len = sizeof(uncompr);
17 int err;
18
19 err = compress(compr, &compr_len, (const unsigned char *)hello, hello_len);
20 EXPECT_EQ(err, Z_OK);
21
22 strcpy((char*)uncompr, "garbage");
23
24 err = uncompress(uncompr, &uncompr_len, compr, compr_len);
25 EXPECT_EQ(err, Z_OK);
26
27 EXPECT_STREQ((char *)uncompr, (char *)hello);
28 }