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 // Avoid spurious VC++ warnings 12 # define _CRT_SECURE_NO_WARNINGS 13 14 #include <boost/system/error_code.hpp> 15 #include <boost/config.hpp> 16 #include <boost/config/pragma_message.hpp> 17 #include <iostream> 18 19 #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) 20 21 BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" ) 22 main()23int main() 24 { 25 std::cout 26 << "The version of the C++ standard library being used does not" 27 " support header <system_error> so interoperation will not be tested.\n"; 28 } 29 30 #else 31 32 #include <boost/core/lightweight_test.hpp> 33 #include <system_error> 34 #include <cerrno> 35 #include <string> 36 #include <cstdio> 37 test_generic_category()38static void test_generic_category() 39 { 40 boost::system::error_category const & bt = boost::system::generic_category(); 41 std::error_category const & st = bt; 42 43 BOOST_TEST_CSTR_EQ( bt.name(), st.name() ); 44 } 45 test_system_category()46static void test_system_category() 47 { 48 boost::system::error_category const & bt = boost::system::system_category(); 49 std::error_category const & st = bt; 50 51 BOOST_TEST_CSTR_EQ( bt.name(), st.name() ); 52 } 53 main()54int main() 55 { 56 std::cout 57 << "The version of the C++ standard library being used" 58 " supports header <system_error> so interoperation will be tested.\n"; 59 60 test_generic_category(); 61 test_system_category(); 62 63 return boost::report_errors(); 64 } 65 66 #endif 67