diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/tests/internal/gzip.c | |
parent | Initial commit. (diff) | |
download | netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.tar.xz netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/tests/internal/gzip.c')
-rw-r--r-- | fluent-bit/tests/internal/gzip.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/fluent-bit/tests/internal/gzip.c b/fluent-bit/tests/internal/gzip.c new file mode 100644 index 00000000..a3f82341 --- /dev/null +++ b/fluent-bit/tests/internal/gzip.c @@ -0,0 +1,46 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +#include <fluent-bit/flb_info.h> +#include <fluent-bit/flb_mem.h> +#include <fluent-bit/flb_gzip.h> + +#include "flb_tests_internal.h" + +/* Sample data */ +char *morpheus = "This is your last chance. After this, there is no " + "turning back. You take the blue pill - the story ends, you wake up in " + "your bed and believe whatever you want to believe. You take the red pill," + "you stay in Wonderland and I show you how deep the rabbit-hole goes."; + +void test_compress() +{ + int ret; + int sample_len; + char *in_data = morpheus; + size_t in_len; + void *str; + size_t len; + + sample_len = strlen(morpheus); + in_len = sample_len; + ret = flb_gzip_compress(in_data, in_len, &str, &len); + TEST_CHECK(ret == 0); + + in_data = str; + in_len = len; + + ret = flb_gzip_uncompress(in_data, in_len, &str, &len); + TEST_CHECK(ret == 0); + + TEST_CHECK(sample_len == len); + ret = memcmp(morpheus, str, sample_len); + TEST_CHECK(ret == 0); + + flb_free(in_data); + flb_free(str); +} + +TEST_LIST = { + {"compress", test_compress}, + { 0 } +}; |