win32_hresult_test.cpp 979 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2018 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. // See library home page at http://www.boost.org/libs/system
  8. #include <boost/system/error_code.hpp>
  9. #include <boost/config/pragma_message.hpp>
  10. #if !defined(BOOST_WINDOWS_API)
  11. BOOST_PRAGMA_MESSAGE( "Skipping test, BOOST_WINDOWS_API is not defined" )
  12. int main() {}
  13. #else
  14. #include <boost/core/lightweight_test.hpp>
  15. #include <windows.h>
  16. int main()
  17. {
  18. namespace sys = boost::system;
  19. HRESULT r = HRESULT_FROM_WIN32( ERROR_ACCESS_DENIED );
  20. sys::error_code ec( r, sys::system_category() );
  21. sys::error_condition en = make_error_condition( sys::errc::permission_denied );
  22. BOOST_TEST( ec == en );
  23. BOOST_TEST( ec.default_error_condition() == en );
  24. BOOST_TEST_EQ( ec.default_error_condition().value(), en.value() );
  25. return boost::report_errors();
  26. }
  27. #endif