Brian Silverman | fad8f55 | 2018-08-04 23:36:19 -0700 | [diff] [blame^] | 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 | |
| 11 | #ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP |
| 12 | #define BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP |
| 13 | |
| 14 | #include <deque> |
| 15 | #include <boost/core/lightweight_test.hpp> |
| 16 | |
| 17 | namespace boost { |
| 18 | namespace container { |
| 19 | namespace test { |
| 20 | |
| 21 | |
| 22 | template<class Cont> |
| 23 | bool test_container_comparisons() |
| 24 | { |
| 25 | typedef typename Cont::value_type value_type; |
| 26 | |
| 27 | Cont cont; |
| 28 | cont.push_back(value_type(1)); |
| 29 | cont.push_back(value_type(2)); |
| 30 | cont.push_back(value_type(3)); |
| 31 | |
| 32 | Cont cont_equal(cont); |
| 33 | |
| 34 | Cont cont_less; |
| 35 | cont_less.push_back(value_type(1)); |
| 36 | cont_less.push_back(value_type(2)); |
| 37 | cont_less.push_back(value_type(2)); |
| 38 | |
| 39 | BOOST_TEST(cont == cont_equal); |
| 40 | BOOST_TEST(!(cont != cont_equal)); |
| 41 | BOOST_TEST(cont != cont_less); |
| 42 | BOOST_TEST(cont_less < cont); |
| 43 | BOOST_TEST(cont_less <= cont); |
| 44 | BOOST_TEST(!(cont_less > cont)); |
| 45 | BOOST_TEST(!(cont_less >= cont)); |
| 46 | BOOST_TEST(!(cont < cont_less)); |
| 47 | BOOST_TEST(!(cont <= cont_less)); |
| 48 | BOOST_TEST(cont > cont_less); |
| 49 | BOOST_TEST(cont >= cont_less); |
| 50 | |
| 51 | return ::boost::report_errors() == 0; |
| 52 | } |
| 53 | |
| 54 | } //namespace test { |
| 55 | } //namespace container { |
| 56 | } //namespace boost { |
| 57 | |
| 58 | #endif //#ifndef BOOST_CONTAINER_TEST_COMPARISON_TEST_HPP |