MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / TEST

Function TEST

common/test/test_alog.cpp:85–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85TEST(alog, example) {
86 log_output = &log_output_test;
87 DEFER(log_output = log_output_stdout);
88 LOG_INFO("WTF"
89 " is `"
90 " this `", "exactly", "stuff");
91 EXPECT_STREQ("WTF\" \" is exactly\" \" this stuff", log_output_test.log_start());
92
93 LOG_INFO("WTF is ` this `", 1, 2);
94 EXPECT_STREQ("WTF is 1 this 2", log_output_test.log_start());
95 LOG_INFO("WTF is \n means ` may be work `", "??", "!!");
96 EXPECT_STREQ("WTF is \\n means ?? may be work !!", log_output_test.log_start());
97 LOG_INFO("WTF is \n means ` may be work `", "??", "!!");
98 EXPECT_STREQ("WTF is \\n means ?? may be work !!", log_output_test.log_start());
99 const char foobar[] = "n";
100 LOG_INFO(foobar);
101 // #S len == 6 > 2 + sizeof(yeah) 4, will fit the length condition
102 // but miss the leading/tailing character condition;
103 EXPECT_STREQ("n", log_output_test.log_start());
104 LOG_INFO(VALUE(foobar));
105 EXPECT_STREQ("[foobar=n]", log_output_test.log_start());
106}
107
108struct BeforeAndAfter {
109 BeforeAndAfter() {

Callers

nothing calls this directly

Calls 15

log_output_fileFunction · 0.85
log_output_file_closeFunction · 0.85
readFunction · 0.85
log_formatFunction · 0.85
log_print_Function · 0.85
test_logFunction · 0.85
test_log2Function · 0.85
test_LOG_ERROR_RETURNFunction · 0.85
test_LOG_ERRNO_RETURNFunction · 0.85
foobarasdfClass · 0.85
test_deferFunction · 0.85
segfaultFunction · 0.85

Tested by

no test coverage detected