]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | |
2 | // Copyright 2017 Peter Dimov. | |
3 | // | |
4 | // Distributed under the Boost Software License, Version 1.0. | |
5 | // | |
6 | // See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
9 | // See library home page at http://www.boost.org/libs/system | |
10 | ||
20effc67 | 11 | #include <boost/system/system_error.hpp> |
b32b8144 FG |
12 | #include <boost/system/error_code.hpp> |
13 | #include <boost/core/lightweight_test.hpp> | |
14 | #include <cerrno> | |
15 | ||
16 | int main() | |
17 | { | |
18 | boost::system::error_category const & bt = boost::system::generic_category(); | |
19 | ||
20 | int ev = ENOENT; | |
21 | ||
22 | boost::system::error_code bc( ev, bt ); | |
23 | ||
24 | BOOST_TEST_EQ( bc.value(), ev ); | |
25 | BOOST_TEST_EQ( &bc.category(), &bt ); | |
26 | ||
27 | boost::system::error_condition bn = bt.default_error_condition( ev ); | |
28 | ||
29 | BOOST_TEST_EQ( bn.value(), ev ); | |
30 | BOOST_TEST_EQ( &bn.category(), &bt ); | |
31 | ||
32 | BOOST_TEST( bt.equivalent( ev, bn ) ); | |
33 | ||
11fdf7f2 | 34 | BOOST_TEST( bc == bn ); |
b32b8144 | 35 | |
20effc67 TL |
36 | boost::system::system_error x( bc, "prefix" ); |
37 | ||
38 | BOOST_TEST_EQ( x.code(), bc ); | |
39 | BOOST_TEST_EQ( std::string( x.what() ), "prefix: " + bc.message() ); | |
40 | ||
b32b8144 FG |
41 | return boost::report_errors(); |
42 | } |