]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/ticket_5486.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / range / test / ticket_5486.cpp
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/adaptor/adjacent_filtered.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 {
23 class TestTicket5486Pred
24 {
25 public:
26 typedef int first_argument_type;
27 typedef int second_argument_type;
28 typedef bool result_type;
29
30 explicit TestTicket5486Pred(int x) {}
31 bool operator()(int,int) const { return true; }
32 private:
33 TestTicket5486Pred();
34 };
35
36 // Ticket 5486 - pertained to predicates erroneous
37 // requiring default construction
38 void test_ticket_5486()
39 {
40 std::vector<int> v;
41 boost::push_back(v, v | boost::adaptors::adjacent_filtered(TestTicket5486Pred(1)));
42
43 BOOST_CHECK_EQUAL_COLLECTIONS( v.begin(), v.end(),
44 v.begin(), v.end() );
45 }
46 }
47 }
48
49 boost::unit_test::test_suite*
50 init_unit_test_suite(int argc, char* argv[])
51 {
52 boost::unit_test::test_suite* test
53 = BOOST_TEST_SUITE( "RangeTestSuite.ticket_5486" );
54
55 test->add( BOOST_TEST_CASE( &boost::test_ticket_5486 ) );
56
57 return test;
58 }