lexicographic_manip.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // (C) Copyright Gennadiy Rozental 2001.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. //! @file
  8. //! Lexicographic comparison manipulator implementation
  9. // ***************************************************************************
  10. #ifndef BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER
  11. #define BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER
  12. // Boost Test
  13. #include <boost/test/tools/detail/fwd.hpp>
  14. #include <boost/test/tools/detail/indirections.hpp>
  15. #include <boost/test/tools/assertion.hpp>
  16. #include <boost/test/tools/collection_comparison_op.hpp>
  17. #include <boost/test/detail/suppress_warnings.hpp>
  18. //____________________________________________________________________________//
  19. namespace boost {
  20. namespace test_tools {
  21. // ************************************************************************** //
  22. // ************** per element comparison manipulator ************** //
  23. // ************************************************************************** //
  24. //! Lexicographic comparison manipulator, for containers
  25. struct lexicographic {};
  26. //____________________________________________________________________________//
  27. inline int
  28. operator<<( unit_test::lazy_ostream const&, lexicographic ) { return 0; }
  29. //____________________________________________________________________________//
  30. namespace tt_detail {
  31. template<typename T1, typename T2, typename OP>
  32. inline assertion_result
  33. operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, lexicographic )
  34. {
  35. typedef typename OP::elem_op elem_op;
  36. return assertion::op::lexicographic_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() );
  37. }
  38. //____________________________________________________________________________//
  39. inline check_type
  40. operator<<( assertion_type const&, lexicographic )
  41. {
  42. return CHECK_BUILT_ASSERTION;
  43. }
  44. //____________________________________________________________________________//
  45. } // namespace tt_detail
  46. } // namespace test_tools
  47. } // namespace boost
  48. #include <boost/test/detail/enable_warnings.hpp>
  49. #endif // BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER