1 
2 // Copyright 2018 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 #include <boost/system/error_code.hpp>
12 #include <boost/config/pragma_message.hpp>
13 
14 #if !defined(BOOST_WINDOWS_API)
15 
16 BOOST_PRAGMA_MESSAGE( "Skipping test, BOOST_WINDOWS_API is not defined" )
main()17 int main() {}
18 
19 #else
20 
21 #include <boost/core/lightweight_test.hpp>
22 #include <windows.h>
23 
main()24 int main()
25 {
26     namespace sys = boost::system;
27 
28     HRESULT r = HRESULT_FROM_WIN32( ERROR_ACCESS_DENIED );
29 
30     sys::error_code ec( r, sys::system_category() );
31     sys::error_condition en = make_error_condition( sys::errc::permission_denied );
32 
33     BOOST_TEST( ec == en );
34     BOOST_TEST( ec.default_error_condition() == en );
35 
36     BOOST_TEST_EQ( ec.default_error_condition().value(), en.value() );
37 
38     return boost::report_errors();
39 }
40 
41 #endif
42