std_mismatch_test.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // Avoid spurious VC++ warnings
  9. # define _CRT_SECURE_NO_WARNINGS
  10. #include <boost/system/error_code.hpp>
  11. #include <boost/config.hpp>
  12. #include <boost/config/pragma_message.hpp>
  13. #include <iostream>
  14. #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
  15. BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" )
  16. int main()
  17. {
  18. std::cout
  19. << "The version of the C++ standard library being used does not"
  20. " support header <system_error> so interoperation will not be tested.\n";
  21. }
  22. #else
  23. #include <boost/core/lightweight_test.hpp>
  24. #include <system_error>
  25. #include <cerrno>
  26. #include <string>
  27. #include <cstdio>
  28. static void test_generic_category()
  29. {
  30. boost::system::error_category const & bt = boost::system::generic_category();
  31. std::error_category const & st = bt;
  32. BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
  33. }
  34. static void test_system_category()
  35. {
  36. boost::system::error_category const & bt = boost::system::system_category();
  37. std::error_category const & st = bt;
  38. BOOST_TEST_CSTR_EQ( bt.name(), st.name() );
  39. }
  40. int main()
  41. {
  42. std::cout
  43. << "The version of the C++ standard library being used"
  44. " supports header <system_error> so interoperation will be tested.\n";
  45. test_generic_category();
  46. test_system_category();
  47. return boost::report_errors();
  48. }
  49. #endif