MCPcopy Create free account
hub / github.com/boostorg/stacktrace / test_nested

Function test_nested

test/test.cpp:72–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70// Template parameter Depth is to produce different functions on each Depth. This simplifies debugging when one of the tests catches error
71template <std::size_t Depth>
72void test_nested(bool print = true) {
73 std::pair<stacktrace, stacktrace> res = function_from_library(Depth, function_from_main_translation_unit);
74
75 std::stringstream ss1, ss2;
76
77 ss1 << res.first;
78 ss2 << res.second;
79 if (print) {
80 std::cout << "'" << ss1.str() << "'\n\n" << ss2.str() << std::endl;
81 }
82 BOOST_TEST(!ss1.str().empty());
83 BOOST_TEST(!ss2.str().empty());
84
85 BOOST_TEST(ss1.str().find(" 0# ") != std::string::npos);
86 BOOST_TEST(ss2.str().find(" 0# ") != std::string::npos);
87
88 BOOST_TEST(ss1.str().find(" 1# ") != std::string::npos);
89 BOOST_TEST(ss2.str().find(" 1# ") != std::string::npos);
90
91 BOOST_TEST(ss1.str().find(" in ") != std::string::npos);
92 BOOST_TEST(ss2.str().find(" in ") != std::string::npos);
93
94#if BOOST_STACKTRACE_TEST_SHOULD_OUTPUT_READABLE_NAMES
95 BOOST_TEST(ss1.str().find("main") != std::string::npos);
96 BOOST_TEST(ss2.str().find("main") != std::string::npos);
97
98 BOOST_TEST(ss1.str().find("function_from_library") != std::string::npos);
99 BOOST_TEST(ss2.str().find("function_from_library") != std::string::npos);
100
101 BOOST_TEST(ss1.str().find("function_from_main_translation_unit") != std::string::npos);
102 BOOST_TEST(ss2.str().find("function_from_main_translation_unit") != std::string::npos);
103#endif
104}
105
106template <class Bt>
107void test_comparisons_base(Bt nst, Bt st) {

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected