mirror of
https://github.com/boostorg/stacktrace.git
synced 2026-01-25 06:42:17 +00:00
Code deduplicated and simplified, added empty() functions and some explicit bool operators, speed-up and improved the output of the ostream operators, improved tests coverage
This commit is contained in:
@@ -182,17 +182,25 @@ void test_frame() {
|
||||
BOOST_TEST(st[i] >= st[i]);
|
||||
|
||||
frame fv = nst[2];
|
||||
BOOST_TEST(fv);
|
||||
if (i >= 2 && i < min_size - 3) { // Begin and end of the trace may match, skipping them
|
||||
BOOST_TEST(st[i].name() != fv.name());
|
||||
BOOST_TEST(st[i] != fv);
|
||||
BOOST_TEST(st[i] < fv || st[i] > fv);
|
||||
BOOST_TEST(hash_value(st[i]) != hash_value(fv));
|
||||
BOOST_TEST(st[i].source_line() == 0 || st[i].source_file() != fv.source_file());
|
||||
BOOST_TEST(st[i]);
|
||||
}
|
||||
|
||||
fv = st[i];
|
||||
BOOST_TEST(hash_value(st[i]) == hash_value(fv));
|
||||
}
|
||||
|
||||
boost::stacktrace::frame empty_frame;
|
||||
BOOST_TEST(!empty_frame);
|
||||
BOOST_TEST(empty_frame.source_file() == "");
|
||||
BOOST_TEST(empty_frame.name() == "");
|
||||
BOOST_TEST(empty_frame.source_line() == 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
@@ -21,12 +21,20 @@ void test_deeply_nested_namespaces() {
|
||||
void test_nested() {
|
||||
std::pair<stacktrace, stacktrace> res = foo2(15);
|
||||
|
||||
BOOST_TEST(!res.first);
|
||||
BOOST_TEST(res.first.size() == 0);
|
||||
BOOST_TEST(res.first.begin()->name() == "");
|
||||
BOOST_TEST(res.first.begin()->source_file() == "");
|
||||
BOOST_TEST(res.first.begin()->source_line() == 0);
|
||||
BOOST_TEST(!res.second);
|
||||
BOOST_TEST(res.second.size() == 0);
|
||||
BOOST_TEST(res.second.begin()->name() == "");
|
||||
BOOST_TEST(res.second.begin()->source_file() == "");
|
||||
BOOST_TEST(res.second.begin()->source_line() == 0);
|
||||
|
||||
BOOST_TEST(res.second[0].name() == "");
|
||||
BOOST_TEST(res.second[0].source_file() == "");
|
||||
BOOST_TEST(res.second[0].source_line() == 0);
|
||||
BOOST_TEST(res.second[0].address() == 0);
|
||||
|
||||
BOOST_TEST(res.second <= res.first);
|
||||
@@ -36,10 +44,18 @@ void test_nested() {
|
||||
BOOST_TEST(!(res.second > res.first));
|
||||
}
|
||||
|
||||
void test_empty_frame() {
|
||||
boost::stacktrace::frame empty_frame;
|
||||
BOOST_TEST(!empty_frame);
|
||||
BOOST_TEST(empty_frame.source_file() == "");
|
||||
BOOST_TEST(empty_frame.name() == "");
|
||||
BOOST_TEST(empty_frame.source_line() == 0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
test_deeply_nested_namespaces();
|
||||
test_nested();
|
||||
test_empty_frame();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user