1 #include <gtest/gtest.h>
2
3 #include <clog.h>
4
5 CLOG_DEFINE_LOG_DEBUG(named_log_debug, "Unit Test", CLOG_DEBUG);
6 CLOG_DEFINE_LOG_INFO(named_log_info, "Unit Test", CLOG_INFO);
7 CLOG_DEFINE_LOG_WARNING(named_log_warning, "Unit Test", CLOG_WARNING);
8 CLOG_DEFINE_LOG_ERROR(named_log_error, "Unit Test", CLOG_ERROR);
9 CLOG_DEFINE_LOG_FATAL(named_log_fatal, "Unit Test", CLOG_FATAL);
10
11 CLOG_DEFINE_LOG_DEBUG(nameless_log_debug, NULL, CLOG_DEBUG);
12 CLOG_DEFINE_LOG_INFO(nameless_log_info, NULL, CLOG_INFO);
13 CLOG_DEFINE_LOG_WARNING(nameless_log_warning, NULL, CLOG_WARNING);
14 CLOG_DEFINE_LOG_ERROR(nameless_log_error, NULL, CLOG_ERROR);
15 CLOG_DEFINE_LOG_FATAL(nameless_log_fatal, NULL, CLOG_FATAL);
16
17 CLOG_DEFINE_LOG_DEBUG(suppressed_log_debug, NULL, CLOG_INFO);
18 CLOG_DEFINE_LOG_INFO(suppressed_log_info, NULL, CLOG_WARNING);
19 CLOG_DEFINE_LOG_WARNING(suppressed_log_warning, NULL, CLOG_ERROR);
20 CLOG_DEFINE_LOG_ERROR(suppressed_log_error, NULL, CLOG_FATAL);
21 CLOG_DEFINE_LOG_FATAL(suppressed_log_fatal, NULL, CLOG_NONE);
22
23
TEST(CLOG,debug)24 TEST(CLOG, debug) {
25 named_log_debug("test debug message with a module name");
26 nameless_log_debug("test debug message without a module name");
27 suppressed_log_debug("test suppressed debug message");
28 }
29
TEST(CLOG,info)30 TEST(CLOG, info) {
31 named_log_info("test info message with a module name");
32 nameless_log_info("test info message without a module name");
33 suppressed_log_info("test suppressed info message");
34 }
35
TEST(CLOG,warning)36 TEST(CLOG, warning) {
37 named_log_warning("test warning message with a module name");
38 nameless_log_warning("test warning message without a module name");
39 suppressed_log_warning("test suppressed warning message");
40 }
41
TEST(CLOG,error)42 TEST(CLOG, error) {
43 named_log_error("test error message with a module name");
44 nameless_log_error("test error message without a module name");
45 suppressed_log_error("test suppressed error message");
46 }
47