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(STD_SINGLE_INSTANCE_SHARED) && defined(__CYGWIN__)
10
11BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, __CYGWIN__" )
12int main() {}
13
14#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_MSC_VER)
15
16BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _MSC_VER" )
17int main() {}
18
19#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && !defined(_CPPLIB_VER)
20
21BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, no _CPPLIB_VER" )
22int main() {}
23
24#elif defined(STD_SINGLE_INSTANCE_SHARED) && defined(_WIN32) && (_MSC_VER < 1900 || _MSC_VER >= 2000)
25
26BOOST_PRAGMA_MESSAGE( "Skipping Windows/DLL test, _MSC_VER is " BOOST_STRINGIZE(_MSC_VER) )
27int main() {}
28
29#else
30
31#include <boost/core/lightweight_test.hpp>
32#include <system_error>
33
34using namespace boost::system;
35
36namespace lib1
37{
38
39std::error_code get_system_code();
40std::error_code get_generic_code();
41
42} // namespace lib1
43
44namespace lib2
45{
46
47std::error_code get_system_code();
48std::error_code get_generic_code();
49
50} // namespace lib2
51
52int main()
53{
54 {
55 std::error_code e1 = lib1::get_system_code();
56 std::error_code e2 = lib2::get_system_code();
57
58 BOOST_TEST_EQ( e1, e2 );
59 }
60
61 {
62 std::error_code e1 = lib1::get_generic_code();
63 std::error_code e2 = lib2::get_generic_code();
64
65 BOOST_TEST_EQ( e1, e2 );
66 }
67
68 return boost::report_errors();
69}
70
71#endif
72

source code of boost/libs/system/test/std_single_instance_test.cpp