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:
Antony Polukhin
2016-12-01 09:55:17 +03:00
parent fd513391ca
commit 4ce841ef65
10 changed files with 176 additions and 191 deletions

View File

@@ -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();
}