MCPcopy Create free account
hub / github.com/ElementsProject/elements / BOOST_FIXTURE_TEST_CASE

Function BOOST_FIXTURE_TEST_CASE

src/test/logging_tests.cpp:78–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup)
79{
80 LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s", "bar1\n");
81 LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::None, "foo2: %s", "bar2\n");
82 LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo3: %s", "bar3\n");
83 LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::NONE, BCLog::Level::None, "foo4: %s", "bar4\n");
84 std::ifstream file{tmp_log_path};
85 std::vector<std::string> log_lines;
86 for (std::string log; std::getline(file, log);) {
87 log_lines.push_back(log);
88 }
89 std::vector<std::string> expected = {
90 "[src1:1] [fn1] [net:debug] foo1: bar1",
91 "[src2:2] [fn2] [net] foo2: bar2",
92 "[src3:3] [fn3] [debug] foo3: bar3",
93 "[src4:4] [fn4] foo4: bar4",
94 };
95 BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
96}
97
98BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacros, LogSetup)
99{

Callers

nothing calls this directly

Calls 9

LogPrintf_Function · 0.85
TrimStringFunction · 0.85
GetLogCategoryFunction · 0.85
EnableCategoryMethod · 0.80
LogCategoriesStringMethod · 0.80
emplace_backMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected