diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6a94bb1..3b38593 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -104,6 +104,7 @@ boost_test(TYPE run SOURCES ec_location_test.cpp) boost_test(TYPE run SOURCES error_condition_test3.cpp) boost_test(TYPE run SOURCES error_code_test2.cpp) boost_test(TYPE run SOURCES system_error_test2.cpp) +boost_test(TYPE run SOURCES std_interop_test10.cpp) # result diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index e9ae669..f491bca 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -126,6 +126,7 @@ run ec_location_test.cpp ; run error_condition_test3.cpp ; run error_code_test2.cpp ; run system_error_test2.cpp ; +run std_interop_test10.cpp ; # result diff --git a/test/std_interop_test10.cpp b/test/std_interop_test10.cpp new file mode 100644 index 0000000..ef68af7 --- /dev/null +++ b/test/std_interop_test10.cpp @@ -0,0 +1,48 @@ +// Copyright 2021 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include + +#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + +BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" ) +int main() {} + +#else + +#include + +int main() +{ + { + boost::system::error_code e1; + boost::system::error_code e2( 0, boost::system::system_category() ); + + BOOST_TEST_EQ( e1, e2 ); + + std::error_code e3( e1 ); + std::error_code e4( e2 ); + + BOOST_TEST_EQ( e3, e4 ); + } + + { + boost::system::error_condition e1; + boost::system::error_condition e2( 0, boost::system::generic_category() ); + + BOOST_TEST_EQ( e1, e2 ); + + std::error_condition e3( e1 ); + std::error_condition e4( e2 ); + + BOOST_TEST( e3 == e4 ); + } + + return boost::report_errors(); +} + +#endif