1 2 // Copyright 2019 Peter Dimov. 3 // Distributed under the Boost Software License, Version 1.0. 4 5 #include <boost/system/error_code.hpp> 6 #include <boost/config/pragma_message.hpp> 7 #include <boost/config/helper_macros.hpp> 8 9 #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) 10 11 BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" ) main()12int main() {} 13 14 #elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(__CYGWIN__) 15 16 BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, __CYGWIN__" ) main()17int main() {} 18 19 #elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_MSC_VER) 20 21 BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _MSC_VER" ) main()22int main() {} 23 24 #elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_CPPLIB_VER) 25 26 BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _CPPLIB_VER" ) main()27int main() {} 28 29 #elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && (_MSC_VER < 1900 || _MSC_VER >= 2000) 30 BOOST_STRINGIZE(_MSC_VER)31BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, _MSC_VER is " BOOST_STRINGIZE(_MSC_VER) ) 32 int main() {} 33 34 #else 35 36 #include <boost/core/lightweight_test.hpp> 37 #include <system_error> 38 39 using namespace boost::system; 40 41 namespace lib1 42 { 43 44 std::error_code get_system_code(); 45 std::error_code get_generic_code(); 46 47 } // namespace lib1 48 49 namespace lib2 50 { 51 52 std::error_code get_system_code(); 53 std::error_code get_generic_code(); 54 55 } // namespace lib2 56 main()57int main() 58 { 59 { 60 std::error_code e1 = lib1::get_system_code(); 61 std::error_code e2 = lib2::get_system_code(); 62 63 BOOST_TEST_EQ( e1, e2 ); 64 } 65 66 { 67 std::error_code e1 = lib1::get_generic_code(); 68 std::error_code e2 = lib2::get_generic_code(); 69 70 BOOST_TEST_EQ( e1, e2 ); 71 } 72 73 return boost::report_errors(); 74 } 75 76 #endif 77