| 290 | } |
| 291 | |
| 292 | void test_relative_virtual_address(const char* file_path) |
| 293 | { |
| 294 | const auto frame = to_string(boost::stacktrace::stacktrace(0, 1).as_vector().front()); |
| 295 | |
| 296 | // Skip the test if the frame does not contain an address |
| 297 | if (frame.find("0x") == std::string::npos) { |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | const auto file_size = get_file_size(file_path); |
| 302 | BOOST_TEST(file_size > 0); |
| 303 | |
| 304 | const auto address = get_address_from_frame(frame); |
| 305 | BOOST_TEST(address > 0); |
| 306 | |
| 307 | // Verify that the address is within the binary |
| 308 | BOOST_TEST(address <= file_size); |
| 309 | } |
| 310 | |
| 311 | int main(const int, const char* argv[]) { |
| 312 | test_deeply_nested_namespaces(); |
no test coverage detected