]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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 | ||
92f5a8d4 | 14 | #include <boost/system/error_code.hpp> |
b32b8144 | 15 | #include <boost/config.hpp> |
92f5a8d4 | 16 | #include <boost/config/pragma_message.hpp> |
b32b8144 FG |
17 | #include <iostream> |
18 | ||
92f5a8d4 TL |
19 | #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) |
20 | ||
21 | BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" ) | |
b32b8144 FG |
22 | |
23 | int 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 | ||
b32b8144 FG |
32 | #include <boost/core/lightweight_test.hpp> |
33 | #include <system_error> | |
34 | #include <cerrno> | |
35 | #include <string> | |
36 | #include <cstdio> | |
37 | ||
38 | static 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() ); | |
b32b8144 FG |
44 | } |
45 | ||
46 | static 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() ); | |
b32b8144 FG |
52 | } |
53 | ||
54 | int 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 |