1 // Boost.Range library
2 //
3 // Copyright Neil Groves 2011. 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)
7 //
8 //
9 // For more information, see http://www.boost.org/libs/range/
10 //
11 #include <boost/range/irange.hpp>
12 #include <boost/range/algorithm_ext/push_back.hpp>
13
14 #include <boost/test/test_tools.hpp>
15 #include <boost/test/unit_test.hpp>
16
17 #include <vector>
18
19 namespace boost
20 {
21 namespace
22 {
test_irange_termination()23 void test_irange_termination()
24 {
25 std::vector<int> reference;
26 for (int i = 0; i < 9; i += 2)
27 reference.push_back(i);
28
29 std::vector<int> actual;
30 boost::push_back(actual, boost::irange(0,9,2));
31
32 BOOST_CHECK_EQUAL_COLLECTIONS(actual.begin(), actual.end(),
33 reference.begin(), reference.end());
34 }
35 }
36 }
37
38 boost::unit_test::test_suite*
init_unit_test_suite(int argc,char * argv[])39 init_unit_test_suite(int argc, char* argv[])
40 {
41 boost::unit_test::test_suite* test
42 = BOOST_TEST_SUITE( "RangeTestSuite.ticket_5544" );
43
44 test->add( BOOST_TEST_CASE( &boost::test_irange_termination ) );
45
46 return test;
47 }
48