]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/system/test/system_error_test3.cpp
1 // Copyright 2021, 2022 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0
3 // https://www.boost.org/LICENSE_1_0.txt
5 #include <boost/system/system_error.hpp>
6 #include <boost/core/lightweight_test.hpp>
9 namespace sys
= boost::system
;
14 sys::error_code
ec( 5, sys::generic_category() );
15 sys::system_error
x1( ec
);
17 BOOST_TEST_EQ( std::string( x1
.what() ), ec
.what() );
21 sys::error_code
ec( 5, sys::generic_category() );
22 sys::system_error
x1( ec
, "prefix" );
24 BOOST_TEST_EQ( std::string( x1
.what() ), "prefix: " + ec
.what() );
28 sys::error_code
ec( 5, sys::generic_category() );
29 sys::system_error
x1( ec
, std::string( "prefix2" ) );
31 BOOST_TEST_EQ( std::string( x1
.what() ), "prefix2: " + ec
.what() );
35 BOOST_STATIC_CONSTEXPR
boost::source_location loc
= BOOST_CURRENT_LOCATION
;
37 sys::error_code
ec( 5, sys::generic_category(), &loc
);
38 sys::system_error
x1( ec
, "prefix3" );
40 BOOST_TEST_EQ( std::string( x1
.what() ), "prefix3: " + ec
.what() );
44 sys::system_error
x1( 5, sys::system_category() );
46 BOOST_TEST_EQ( std::string( x1
.what() ), sys::error_code( 5, sys::system_category() ).what() );
50 sys::system_error
x1( 5, sys::system_category(), "prefix" );
52 BOOST_TEST_EQ( std::string( x1
.what() ), "prefix: " + sys::error_code( 5, sys::system_category() ).what() );
56 sys::system_error
x1( 5, sys::system_category(), std::string( "prefix2" ) );
58 BOOST_TEST_EQ( std::string( x1
.what() ), "prefix2: " + sys::error_code( 5, sys::system_category() ).what() );
61 return boost::report_errors();