// Boost.Range library // // Copyright Neil Groves 2009. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // // For more information, see http://www.boost.org/libs/range/ // #include #include #include #include #include #include #include #include #include namespace boost { namespace { template< class Container > void test_copy_backward_impl() { Container source; typedef BOOST_DEDUCED_TYPENAME Container::value_type value_t; std::vector target; target.resize(source.size()); typedef BOOST_DEDUCED_TYPENAME range_iterator< std::vector >::type iterator_t; iterator_t it = boost::copy_backward(source, target.begin()); BOOST_CHECK( it == target.end() ); BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(), source.rbegin(), source.rend() ); BOOST_CHECK( it == boost::copy_backward(boost::make_iterator_range(source), target.begin()) ); BOOST_CHECK_EQUAL_COLLECTIONS( target.begin(), target.end(), source.rbegin(), source.rend() ); } void test_copy_backward() { test_copy_backward_impl< std::vector >(); test_copy_backward_impl< std::list >(); test_copy_backward_impl< std::set >(); test_copy_backward_impl< std::multiset >(); } } } boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "RangeTestSuite.algorithm.copy_backward" ); test->add( BOOST_TEST_CASE( &boost::test_copy_backward ) ); return test; }