warnings_test.cpp 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017, 2019 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/config.hpp>
  9. #if defined( BOOST_GCC ) && BOOST_GCC < 40600
  10. #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
  11. #endif
  12. #include <boost/system/error_code.hpp>
  13. #include <boost/core/lightweight_test.hpp>
  14. #include <cerrno>
  15. int main()
  16. {
  17. boost::system::error_category const & bt = boost::system::generic_category();
  18. int ev = ENOENT;
  19. boost::system::error_code bc( ev, bt );
  20. BOOST_TEST_EQ( bc.value(), ev );
  21. BOOST_TEST_EQ( &bc.category(), &bt );
  22. boost::system::error_condition bn = bt.default_error_condition( ev );
  23. BOOST_TEST_EQ( bn.value(), ev );
  24. BOOST_TEST_EQ( &bn.category(), &bt );
  25. BOOST_TEST( bt.equivalent( ev, bn ) );
  26. BOOST_TEST( bc == bn );
  27. return boost::report_errors();
  28. }