]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/algorithm_test/fill.cpp
3 // Copyright Neil Groves 2009. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/range/
11 #include <boost/range/algorithm/fill.hpp>
13 #include <boost/test/test_tools.hpp>
14 #include <boost/test/unit_test.hpp>
16 #include <boost/assign.hpp>
28 template< class Container
>
29 void test_fill_impl(Container
& cont
)
31 Container
reference(cont
);
32 std::fill(reference
.begin(), reference
.end(), 1);
34 Container
target(cont
);
35 boost::fill(target
, 1);
37 BOOST_CHECK_EQUAL_COLLECTIONS( reference
.begin(), reference
.end(),
38 target
.begin(), target
.end() );
40 Container
target2(cont
);
41 boost::fill(boost::make_iterator_range(target2
), 1);
43 BOOST_CHECK_EQUAL_COLLECTIONS( reference
.begin(), reference
.end(),
44 target2
.begin(), target2
.end() );
47 template< class Container
>
50 using namespace boost::assign
;
64 cont
+= 1,2,3,4,5,6,7,8,9;
70 test_fill_impl
< std::vector
<int> >();
71 test_fill_impl
< std::list
<int> >();
72 test_fill_impl
< std::deque
<int> >();
77 boost::unit_test::test_suite
*
78 init_unit_test_suite(int argc
, char* argv
[])
80 boost::unit_test::test_suite
* test
81 = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.fill" );
83 test
->add( BOOST_TEST_CASE( &boost::test_fill
) );