diff options
author | sanine <sanine.not@pm.me> | 2021-09-24 00:04:34 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2021-09-24 00:04:34 -0500 |
commit | 92fe2dc01578533a7ecd506ada134b471380a90a (patch) | |
tree | f4abc20d0ed92d3bc248f5068d82106d9ef2f99d /src/test | |
parent | 921f1a46bbccbdf9dcadbd7017ec0c575d2bed1f (diff) |
update logging to use real functions
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/logging/logging_tests.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/test/logging/logging_tests.c b/src/test/logging/logging_tests.c index 2d4ced9..e0aa5ef 100644 --- a/src/test/logging/logging_tests.c +++ b/src/test/logging/logging_tests.c @@ -10,6 +10,7 @@ /* test declarations */ mu_test test_log_get_level(); +mu_test test_log_set_defaults(); mu_test test_log_debug(); @@ -22,26 +23,24 @@ void honey_logging_tests() } -/* test definitions */ +/* ~~~~~~~~ test definitions ~~~~~~~~ */ mu_test test_log_get_level() { - struct honey_log_info info; + honey_log_info.log_level = DEBUG; + mu_assert_streq("DEBUG", honey_log_level_str()); - info.log_level = DEBUG; - mu_assert_streq("DEBUG", honey_log_level_str_(&info)); + honey_log_info.log_level = INFO; + mu_assert_streq("INFO", honey_log_level_str()); - info.log_level = INFO; - mu_assert_streq("INFO", honey_log_level_str_(&info)); + honey_log_info.log_level = WARN; + mu_assert_streq("WARN", honey_log_level_str()); - info.log_level = WARN; - mu_assert_streq("WARN", honey_log_level_str_(&info)); + honey_log_info.log_level = ERROR; + mu_assert_streq("ERROR", honey_log_level_str()); - info.log_level = ERROR; - mu_assert_streq("ERROR", honey_log_level_str_(&info)); - - info.log_level = FATAL; - mu_assert_streq("FATAL", honey_log_level_str_(&info)); + honey_log_info.log_level = FATAL; + mu_assert_streq("FATAL", honey_log_level_str()); return 0; } @@ -56,16 +55,15 @@ mu_test test_log_debug() stream = open_memstream(&buffer, &len); mu_assert_unequal(stream, NULL); - struct honey_log_info info; - info.debug_out = stream; - info.log_level = FATAL; + honey_log_info.debug_out = stream; + honey_log_info.log_level = FATAL; - honey_debug_(info, "hello, world!"); + honey_debug("hello, %s!", "world"); fflush(stream); mu_assert_streq(buffer, ""); - info.log_level = DEBUG; - honey_debug_(info, "hello, world!"); + honey_log_info.log_level = DEBUG; + honey_debug("hello, %s!", "world"); fclose(stream); mu_assert_streq(buffer, "[DEBUG] hello, world!"); free(buffer); |