| 190 | } |
| 191 | |
| 192 | void test_frame() { |
| 193 | stacktrace nst = return_from_nested_namespaces(); |
| 194 | stacktrace st = make_some_stacktrace1(); |
| 195 | |
| 196 | const std::size_t min_size = (nst.size() < st.size() ? nst.size() : st.size()); |
| 197 | BOOST_TEST(min_size > 2); |
| 198 | |
| 199 | for (std::size_t i = 0; i < min_size; ++i) { |
| 200 | BOOST_TEST(st[i] == st[i]); |
| 201 | BOOST_TEST(st[i].source_file() == st[i].source_file()); |
| 202 | BOOST_TEST(st[i].source_line() == st[i].source_line()); |
| 203 | BOOST_TEST(st[i] <= st[i]); |
| 204 | BOOST_TEST(st[i] >= st[i]); |
| 205 | |
| 206 | frame fv = nst[i]; |
| 207 | BOOST_TEST(fv); |
| 208 | if (i > 1 && i < min_size - 3) { // Begin ...and end of the trace may match, skipping |
| 209 | BOOST_TEST(st[i] != fv); |
| 210 | |
| 211 | #if !(defined(BOOST_STACKTRACE_TEST_NO_DEBUG_AT_ALL) && defined(BOOST_MSVC)) |
| 212 | // MSVC can not get function name withhout debug symbols even if it is exported |
| 213 | BOOST_TEST(st[i].name() != fv.name()); |
| 214 | BOOST_TEST(st[i] != fv); |
| 215 | BOOST_TEST(st[i] < fv || st[i] > fv); |
| 216 | BOOST_TEST(hash_value(st[i]) != hash_value(fv)); |
| 217 | #endif |
| 218 | |
| 219 | if (st[i].source_line()) { |
| 220 | BOOST_TEST(st[i].source_file() != fv.source_file() || st[i].source_line() != fv.source_line()); |
| 221 | } |
| 222 | BOOST_TEST(st[i]); |
| 223 | } |
| 224 | |
| 225 | fv = st[i]; |
| 226 | BOOST_TEST(hash_value(st[i]) == hash_value(fv)); |
| 227 | } |
| 228 | |
| 229 | boost::stacktrace::frame empty_frame; |
| 230 | BOOST_TEST(!empty_frame); |
| 231 | BOOST_TEST_EQ(empty_frame.source_file(), ""); |
| 232 | BOOST_TEST_EQ(empty_frame.name(), ""); |
| 233 | BOOST_TEST_EQ(empty_frame.source_line(), 0); |
| 234 | } |
| 235 | |
| 236 | // Template parameter bool BySkip is to produce different functions on each BySkip. This simplifies debugging when one of the tests catches error |
| 237 | template <bool BySkip> |
no test coverage detected