| 1 | // Copyright 2021 Peter Dimov. |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // http://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #include <boost/system/error_code.hpp> |
| 6 | #include <boost/core/lightweight_test.hpp> |
| 7 | #include <cerrno> |
| 8 | #include <system_error> |
| 9 | |
| 10 | int main() |
| 11 | { |
| 12 | { |
| 13 | boost::system::error_code e1; |
| 14 | boost::system::error_code e2( 0, boost::system::system_category() ); |
| 15 | |
| 16 | BOOST_TEST_EQ( e1, e2 ); |
| 17 | |
| 18 | std::error_code e3( e1 ); |
| 19 | std::error_code e4( e2 ); |
| 20 | |
| 21 | BOOST_TEST_EQ( e3, e4 ); |
| 22 | } |
| 23 | |
| 24 | { |
| 25 | boost::system::error_code e1; |
| 26 | |
| 27 | std::error_code e2( e1 ); |
| 28 | std::error_code e3( e1.value(), e1.category() ); |
| 29 | |
| 30 | BOOST_TEST_EQ( e2, e3 ); |
| 31 | } |
| 32 | |
| 33 | { |
| 34 | boost::system::error_condition e1; |
| 35 | boost::system::error_condition e2( 0, boost::system::generic_category() ); |
| 36 | |
| 37 | BOOST_TEST_EQ( e1, e2 ); |
| 38 | |
| 39 | std::error_condition e3( e1 ); |
| 40 | std::error_condition e4( e2 ); |
| 41 | |
| 42 | BOOST_TEST( e3 == e4 ); |
| 43 | } |
| 44 | |
| 45 | { |
| 46 | boost::system::error_condition e1; |
| 47 | |
| 48 | std::error_condition e2( e1 ); |
| 49 | std::error_condition e3( e1.value(), e1.category() ); |
| 50 | |
| 51 | BOOST_TEST( e2 == e3 ); |
| 52 | } |
| 53 | |
| 54 | return boost::report_errors(); |
| 55 | } |
| 56 |
