• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Range library
2 //
3 //  Copyright Neil Groves 2014. 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/adaptor/indirected.hpp>
12 #include <boost/optional.hpp>
13 #include <boost/optional/optional_io.hpp>
14 
15 #include <boost/test/test_tools.hpp>
16 #include <boost/test/unit_test.hpp>
17 
18 #include <vector>
19 
20 namespace boost
21 {
22     namespace
23     {
test_ticket_5811_indirected_optional()24         void test_ticket_5811_indirected_optional()
25         {
26             std::vector<boost::optional<int> > v;
27             std::vector<int> r;
28             for (int i = 0; i < 10; ++i)
29             {
30                 v.push_back(i);
31                 r.push_back(i);
32             }
33             BOOST_CHECK_EQUAL_COLLECTIONS(r.begin(), r.end(),
34                                           v.begin(), v.end());
35         }
36     }
37 }
38 
39 boost::unit_test::test_suite*
init_unit_test_suite(int argc,char * argv[])40 init_unit_test_suite(int argc, char* argv[])
41 {
42     boost::unit_test::test_suite* test
43         = BOOST_TEST_SUITE("RangeTestSuite.ticket_5811_indirected_optional");
44 
45     test->add(BOOST_TEST_CASE(&boost::test_ticket_5811_indirected_optional));
46 
47     return test;
48 }
49