quick.cpp 864 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2017 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/core/lightweight_test.hpp>
  10. #include <cerrno>
  11. int main()
  12. {
  13. boost::system::error_category const & bt = boost::system::generic_category();
  14. int ev = ENOENT;
  15. boost::system::error_code bc( ev, bt );
  16. BOOST_TEST_EQ( bc.value(), ev );
  17. BOOST_TEST_EQ( &bc.category(), &bt );
  18. boost::system::error_condition bn = bt.default_error_condition( ev );
  19. BOOST_TEST_EQ( bn.value(), ev );
  20. BOOST_TEST_EQ( &bn.category(), &bt );
  21. BOOST_TEST( bt.equivalent( ev, bn ) );
  22. BOOST_TEST( bc == bn );
  23. return boost::report_errors();
  24. }