diff options
Diffstat (limited to 'libnetdata/tests')
-rw-r--r-- | libnetdata/tests/Makefile.am | 4 | ||||
-rw-r--r-- | libnetdata/tests/test_str2ld.c | 48 |
2 files changed, 0 insertions, 52 deletions
diff --git a/libnetdata/tests/Makefile.am b/libnetdata/tests/Makefile.am deleted file mode 100644 index babdcf0df..000000000 --- a/libnetdata/tests/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -AUTOMAKE_OPTIONS = subdir-objects -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in diff --git a/libnetdata/tests/test_str2ld.c b/libnetdata/tests/test_str2ld.c deleted file mode 100644 index 8b97a70f8..000000000 --- a/libnetdata/tests/test_str2ld.c +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "../libnetdata.h" -#include "../required_dummies.h" -#include <setjmp.h> -#include <cmocka.h> - -static void test_str2ld(void **state) -{ - (void)state; - char *values[] = { - "1.2345678", - "-35.6", - "0.00123", - "23842384234234.2", - ".1", - "1.2e-10", - "hello", - "1wrong", - "nan", - "inf", - NULL - }; - - for (int i = 0; values[i]; i++) { - char *e_mine = "hello", *e_sys = "world"; - NETDATA_DOUBLE mine = str2ndd(values[i], &e_mine); - NETDATA_DOUBLE sys = strtondd(values[i], &e_sys); - - if (isnan(mine)) - assert_true(isnan(sys)); - else if (isinf(mine)) - assert_true(isinf(sys)); - else if (mine != sys) - assert_false(ABS(mine - sys) > 0.000001); - - assert_ptr_equal(e_mine, e_sys); - } -} - -int main(void) -{ - const struct CMUnitTest tests[] = { - cmocka_unit_test(test_str2ld) - }; - - return cmocka_run_group_tests_name("str2ld", tests, NULL, NULL); -} |