From 9067f0987bb952d8ff266529d03e39aa1af3ffee Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 28 Nov 2023 21:43:16 +0200 Subject: [PATCH] Update source_location_test4.cpp --- test/source_location_test4.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/test/source_location_test4.cpp b/test/source_location_test4.cpp index 420612e..1242314 100644 --- a/test/source_location_test4.cpp +++ b/test/source_location_test4.cpp @@ -5,6 +5,21 @@ #include #include #include +#include + +static char const* adjust_filename( char const* file ) +{ +#if defined(__INTEL_LLVM_COMPILER) && __INTEL_LLVM_COMPILER >= 20210300 + + char const* fn = std::strrchr( file, '/' ); + return fn? fn + 1: file; + +#else + + return file; + +#endif +} boost::source_location s_loc = BOOST_CURRENT_LOCATION; @@ -18,8 +33,8 @@ boost::source_location f( boost::source_location const& loc = BOOST_CURRENT_LOCA int main() { { - BOOST_TEST_CSTR_EQ( s_loc.file_name(), __FILE__ ); - BOOST_TEST_EQ( s_loc.line(), 9 ); + BOOST_TEST_CSTR_EQ( s_loc.file_name(), adjust_filename(__FILE__) ); + BOOST_TEST_EQ( s_loc.line(), 24 ); #if defined(BOOST_GCC) && BOOST_GCC < 90000 // '__static_initialization_and_destruction_0' @@ -29,15 +44,15 @@ int main() } { - BOOST_TEST_CSTR_EQ( c_loc.file_name(), __FILE__ ); - BOOST_TEST_EQ( c_loc.line(), 11 ); + BOOST_TEST_CSTR_EQ( c_loc.file_name(), adjust_filename(__FILE__) ); + BOOST_TEST_EQ( c_loc.line(), 26 ); } { boost::source_location loc = f(); - BOOST_TEST_CSTR_EQ( loc.file_name(), __FILE__ ); - BOOST_TEST( loc.line() == 13 || loc.line() == 37 ); + BOOST_TEST_CSTR_EQ( loc.file_name(), adjust_filename(__FILE__) ); + BOOST_TEST( loc.line() == 28 || loc.line() == 52 ); } return boost::report_errors();