diff options
| author | Nathan Moinvaziri <nathan@solidstatenetworks.com> | 2021-07-11 16:17:30 -0700 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-09-22 16:14:05 +0200 |
| commit | 4deaf27124912152a51649160501e22e6ae7d621 (patch) | |
| tree | 245a727baee89ea479a96f7452b4ea881e6d3a5e /test/example.c | |
| parent | 983df0adec3fb04bc47f051e479fb6490f5da3d9 (diff) | |
| download | Project-Tick-4deaf27124912152a51649160501e22e6ae7d621.tar.gz Project-Tick-4deaf27124912152a51649160501e22e6ae7d621.zip | |
Added code coverage for inflateGetDictionary in example.
Diffstat (limited to 'test/example.c')
| -rw-r--r-- | test/example.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/example.c b/test/example.c index 9f1f52a940..4f81962f7a 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"); |
