]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/algorithm/test/is_partitioned_until_test.cpp
2 Copyright (c) Marshall Clow 2011-2012, Alexander Zaitsev <zamazan4ik@gmail.com>, 2017.
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 For more information, see http://www.boost.org
12 #include <boost/config.hpp>
13 #include <boost/algorithm/is_partitioned_until.hpp>
15 #define BOOST_TEST_MAIN
16 #include <boost/test/unit_test.hpp>
22 namespace ba
= boost::algorithm
;
23 // namespace ba = boost;
28 less_than ( T foo
) : val ( foo
) {}
29 less_than ( const less_than
&rhs
) : val ( rhs
.val
) {}
31 bool operator () ( const T
&v
) const { return v
< val
; }
34 less_than
operator = ( const less_than
&rhs
);
39 void test_sequence1 () {
43 for ( int i
= 5; i
< 15; ++i
)
45 BOOST_CHECK ( ba::is_partitioned_until ( v
, less_than
<int>(3)) == v
.end()); // no elements
46 BOOST_CHECK ( ba::is_partitioned_until ( v
, less_than
<int>(6)) == v
.end()); // only the first element
47 BOOST_CHECK ( ba::is_partitioned_until ( v
, less_than
<int>(10)) == v
.end()); // in the middle somewhere
48 BOOST_CHECK ( ba::is_partitioned_until ( v
, less_than
<int>(99)) == v
.end()); // all elements satisfy
49 // With bidirectional iterators.
51 for ( int i
= 5; i
< 15; ++i
)
53 BOOST_CHECK ( ba::is_partitioned_until ( l
.begin (), l
.end (), less_than
<int>(3)) == l
.end()); // no elements
54 BOOST_CHECK ( ba::is_partitioned_until ( l
.begin (), l
.end (), less_than
<int>(6)) == l
.end()); // only the first element
55 BOOST_CHECK ( ba::is_partitioned_until ( l
.begin (), l
.end (), less_than
<int>(10)) == l
.end()); // in the middle somewhere
56 BOOST_CHECK ( ba::is_partitioned_until ( l
.begin (), l
.end (), less_than
<int>(99)) == l
.end()); // all elements satisfy
60 BOOST_AUTO_TEST_CASE( test_main
)