xref: /aosp_15_r20/external/pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/deps/clog/test/clog.cc (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 /*
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <gtest/gtest.h>
10 
11 #include <clog.h>
12 
13 CLOG_DEFINE_LOG_DEBUG(named_log_debug, "Unit Test", CLOG_DEBUG);
14 CLOG_DEFINE_LOG_INFO(named_log_info, "Unit Test", CLOG_INFO);
15 CLOG_DEFINE_LOG_WARNING(named_log_warning, "Unit Test", CLOG_WARNING);
16 CLOG_DEFINE_LOG_ERROR(named_log_error, "Unit Test", CLOG_ERROR);
17 CLOG_DEFINE_LOG_FATAL(named_log_fatal, "Unit Test", CLOG_FATAL);
18 
19 CLOG_DEFINE_LOG_DEBUG(nameless_log_debug, NULL, CLOG_DEBUG);
20 CLOG_DEFINE_LOG_INFO(nameless_log_info, NULL, CLOG_INFO);
21 CLOG_DEFINE_LOG_WARNING(nameless_log_warning, NULL, CLOG_WARNING);
22 CLOG_DEFINE_LOG_ERROR(nameless_log_error, NULL, CLOG_ERROR);
23 CLOG_DEFINE_LOG_FATAL(nameless_log_fatal, NULL, CLOG_FATAL);
24 
25 CLOG_DEFINE_LOG_DEBUG(suppressed_log_debug, NULL, CLOG_INFO);
26 CLOG_DEFINE_LOG_INFO(suppressed_log_info, NULL, CLOG_WARNING);
27 CLOG_DEFINE_LOG_WARNING(suppressed_log_warning, NULL, CLOG_ERROR);
28 CLOG_DEFINE_LOG_ERROR(suppressed_log_error, NULL, CLOG_FATAL);
29 CLOG_DEFINE_LOG_FATAL(suppressed_log_fatal, NULL, CLOG_NONE);
30 
TEST(CLOG,debug)31 TEST(CLOG, debug) {
32   named_log_debug("test debug message with a module name");
33   nameless_log_debug("test debug message without a module name");
34   suppressed_log_debug("test suppressed debug message");
35 }
36 
TEST(CLOG,info)37 TEST(CLOG, info) {
38   named_log_info("test info message with a module name");
39   nameless_log_info("test info message without a module name");
40   suppressed_log_info("test suppressed info message");
41 }
42 
TEST(CLOG,warning)43 TEST(CLOG, warning) {
44   named_log_warning("test warning message with a module name");
45   nameless_log_warning("test warning message without a module name");
46   suppressed_log_warning("test suppressed warning message");
47 }
48 
TEST(CLOG,error)49 TEST(CLOG, error) {
50   named_log_error("test error message with a module name");
51   nameless_log_error("test error message without a module name");
52   suppressed_log_error("test suppressed error message");
53 }
54