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