]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/algorithm_test/reverse.cpp
1 // Copyright Neil Groves 2009. Use, modification and
2 // distribution is subject to the Boost Software License, Version
3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
7 // For more information, see http://www.boost.org/libs/range/
9 #include <boost/range/algorithm/reverse.hpp>
11 #include <boost/test/test_tools.hpp>
12 #include <boost/test/unit_test.hpp>
14 #include <boost/assign.hpp>
26 template<class Container
>
27 void test_reverse_impl(Container
& cont
)
29 Container
reference(cont
);
31 Container
test2(cont
);
34 std::reverse(reference
.begin(), reference
.end());
35 BOOST_CHECK_EQUAL_COLLECTIONS( reference
.begin(), reference
.end(),
36 test
.begin(), test
.end() );
38 boost::reverse(boost::make_iterator_range(test2
));
39 BOOST_CHECK_EQUAL_COLLECTIONS( reference
.begin(), reference
.end(),
40 test2
.begin(), test2
.end() );
43 template<class Container
>
44 void test_reverse_impl()
46 using namespace boost::assign
;
49 test_reverse_impl(cont
);
53 test_reverse_impl(cont
);
56 cont
+= 1,2,3,4,5,6,7,8,9;
57 test_reverse_impl(cont
);
62 test_reverse_impl
< std::vector
<int> >();
63 test_reverse_impl
< std::list
<int> >();
64 test_reverse_impl
< std::deque
<int> >();
70 boost::unit_test::test_suite
*
71 init_unit_test_suite(int argc
, char* argv
[])
73 boost::unit_test::test_suite
* test
74 = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.reverse" );
76 test
->add( BOOST_TEST_CASE( &boost::test_reverse
) );