std_dateorder.cpp 1007 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2008 Joseph Gauterin, Niels Dekker
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // Tests swapping std::time_base::dateorder objects by means of boost::swap.
  7. // std::time_base::dateorder is an enumerated type. It does not have an
  8. // std::swap overload or template specialization.
  9. #include <boost/utility/swap.hpp>
  10. #include <boost/core/lightweight_test.hpp>
  11. #define BOOST_CHECK BOOST_TEST
  12. #define BOOST_CHECK_EQUAL BOOST_TEST_EQ
  13. #include <locale>
  14. int main()
  15. {
  16. const std::time_base::dateorder initial_value1 = std::time_base::dmy;
  17. const std::time_base::dateorder initial_value2 = std::time_base::mdy;
  18. std::time_base::dateorder object1 = initial_value1;
  19. std::time_base::dateorder object2 = initial_value2;
  20. boost::swap(object1,object2);
  21. BOOST_CHECK_EQUAL(object1,initial_value2);
  22. BOOST_CHECK_EQUAL(object2,initial_value1);
  23. return boost::report_errors();
  24. }