| 1 | // Copyright 2020 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/generic_category.hpp> |
| 6 | #include <boost/system/error_condition.hpp> |
| 7 | #include <boost/core/lightweight_test.hpp> |
| 8 | #include <cerrno> |
| 9 | |
| 10 | namespace sys = boost::system; |
| 11 | |
| 12 | int main() |
| 13 | { |
| 14 | sys::error_category const & cat = sys::generic_category(); |
| 15 | |
| 16 | // name |
| 17 | BOOST_TEST_CSTR_EQ( cat.name(), "generic"); |
| 18 | |
| 19 | // default_error_condition |
| 20 | BOOST_TEST( cat.default_error_condition( 0 ) == sys::error_condition( 0, cat ) ); |
| 21 | BOOST_TEST( cat.default_error_condition( ENOENT ) == sys::error_condition( ENOENT, cat ) ); |
| 22 | BOOST_TEST( cat.default_error_condition( -1 ) == sys::error_condition( -1, cat ) ); |
| 23 | |
| 24 | // failed |
| 25 | BOOST_TEST( !cat.failed( 0 ) ); |
| 26 | BOOST_TEST( cat.failed( ENOENT ) ); |
| 27 | BOOST_TEST( cat.failed( -1 ) ); |
| 28 | |
| 29 | return boost::report_errors(); |
| 30 | } |
| 31 |
