comparison_test.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP
  11. #define BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP
  12. #include <deque>
  13. #include <boost/core/lightweight_test.hpp>
  14. namespace boost {
  15. namespace container {
  16. namespace test {
  17. template<class Cont>
  18. bool test_container_comparisons()
  19. {
  20. typedef typename Cont::value_type value_type;
  21. Cont cont;
  22. cont.push_back(value_type(1));
  23. cont.push_back(value_type(2));
  24. cont.push_back(value_type(3));
  25. Cont cont_equal(cont);
  26. Cont cont_less;
  27. cont_less.push_back(value_type(1));
  28. cont_less.push_back(value_type(2));
  29. cont_less.push_back(value_type(2));
  30. BOOST_TEST(cont == cont_equal);
  31. BOOST_TEST(!(cont != cont_equal));
  32. BOOST_TEST(cont != cont_less);
  33. BOOST_TEST(cont_less < cont);
  34. BOOST_TEST(cont_less <= cont);
  35. BOOST_TEST(!(cont_less > cont));
  36. BOOST_TEST(!(cont_less >= cont));
  37. BOOST_TEST(!(cont < cont_less));
  38. BOOST_TEST(!(cont <= cont_less));
  39. BOOST_TEST(cont > cont_less);
  40. BOOST_TEST(cont >= cont_less);
  41. return ::boost::report_errors() == 0;
  42. }
  43. } //namespace test {
  44. } //namespace container {
  45. } //namespace boost {
  46. #endif //#ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP