From 1ca109e1770b56095bdf4c664f3b99b7ac93776d Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 23 Sep 2021 23:11:23 -0500 Subject: add honey_log_level_str_() --- src/test/logging/logging_tests.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'src/test/logging') diff --git a/src/test/logging/logging_tests.c b/src/test/logging/logging_tests.c index 2e92d68..2a07d30 100644 --- a/src/test/logging/logging_tests.c +++ b/src/test/logging/logging_tests.c @@ -1,6 +1,42 @@ -#include "../minunit.h" -#include "../suites.h" +#include "test/minunit.h" +#include "test/suites.h" + +#include "logging/logging.h" + + +/* test declarations */ + +mu_test test_log_get_level(); + + +/* main suite */ void honey_logging_tests() { + mu_run_test("get log level strings", test_log_get_level); +} + + +/* test definitions */ + +mu_test test_log_get_level() +{ + struct honey_log_info info; + + info.log_level = DEBUG; + mu_assert_streq("DEBUG", honey_log_level_str_(&info)); + + info.log_level = INFO; + mu_assert_streq("INFO", honey_log_level_str_(&info)); + + info.log_level = WARN; + mu_assert_streq("WARN", honey_log_level_str_(&info)); + + 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)); + + return 0; } -- cgit v1.2.1