summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@solidstatenetworks.com>2021-07-11 16:17:30 -0700
committerHans Kristian Rosbach <hk-github@circlestorm.org>2021-12-24 12:52:14 +0100
commitde570b8aac416d520ec11ae544d1f380b9fd6f3d (patch)
tree93a9b1965b374de3660c3c67ae7d10b9257254cc
parent18a4712638b1e1a782457bff643b76cbd8305db4 (diff)
Added code coverage for inflateGetDictionary in example.
-rw-r--r--test/example.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/example.c b/test/example.c
index 821cfb8..90de07e 100644
--- a/test/example.c
+++ b/test/example.c
@@ -575,6 +575,8 @@ void test_dict_deflate(unsigned char *compr, size_t comprLen) {
*/
void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) {
int err;
+ uint8_t check_dictionary[10];
+ uint32_t check_dictionary_len = 0;
PREFIX3(stream) d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage garbage garbage");
@@ -605,6 +607,20 @@ void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *unc
}
CHECK_ERR(err, "inflate with dict");
}
+
+ err = PREFIX(inflateGetDictionary)(&d_stream, NULL, &check_dictionary_len);
+ CHECK_ERR(err, "inflateGetDictionary");
+ if (check_dictionary_len != sizeof(dictionary)) {
+ fprintf(stderr, "bad dictionary length\n");
+ exit(1);
+ }
+
+ err = PREFIX(inflateGetDictionary)(&d_stream, check_dictionary, &check_dictionary_len);
+ CHECK_ERR(err, "inflateGetDictionary");
+ if (memcmp(dictionary, check_dictionary, sizeof(dictionary)) != 0) {
+ fprintf(stderr, "bad dictionary\n");
+ exit(1);
+ }
err = PREFIX(inflateEnd)(&d_stream);
CHECK_ERR(err, "inflateEnd");