From be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 04:57:58 +0200 Subject: Adding upstream version 1.44.3. Signed-off-by: Daniel Baumann --- fluent-bit/tests/internal/gzip.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 fluent-bit/tests/internal/gzip.c (limited to 'fluent-bit/tests/internal/gzip.c') 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 +#include +#include + +#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 } +}; -- cgit v1.2.3