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 11 #include <boost/system/error_code.hpp> 12 #include <boost/core/lightweight_test.hpp> 13 #include <cerrno> 14 main()15int main() 16 { 17 boost::system::error_category const & bt = boost::system::generic_category(); 18 19 int ev = ENOENT; 20 21 boost::system::error_code bc( ev, bt ); 22 23 BOOST_TEST_EQ( bc.value(), ev ); 24 BOOST_TEST_EQ( &bc.category(), &bt ); 25 26 boost::system::error_condition bn = bt.default_error_condition( ev ); 27 28 BOOST_TEST_EQ( bn.value(), ev ); 29 BOOST_TEST_EQ( &bn.category(), &bt ); 30 31 BOOST_TEST( bt.equivalent( ev, bn ) ); 32 33 BOOST_TEST( bc == bn ); 34 35 return boost::report_errors(); 36 } 37