]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/test/ticket_5486.cpp
add subtree-ish sources for 12.0.3
[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 <functional>
18 #include <vector>
19
20 namespace boost
21 {
22 namespace
23 {
24 class TestTicket5486Pred
25 : public std::binary_function<int,int,bool>
26 {
27 public:
28 explicit TestTicket5486Pred(int x) {}
29 bool operator()(int,int) const { return true; }
30 private:
31 TestTicket5486Pred();
32 };
33
34 // Ticket 5486 - pertained to predicates erroneous
35 // requiring default construction
36 void test_ticket_5486()
37 {
38 std::vector<int> v;
39 boost::push_back(v, v | boost::adaptors::adjacent_filtered(TestTicket5486Pred(1)));
40
41 BOOST_CHECK_EQUAL_COLLECTIONS( v.begin(), v.end(),
42 v.begin(), v.end() );
43 }
44 }
45 }
46
47 boost::unit_test::test_suite*
48 init_unit_test_suite(int argc, char* argv[])
49 {
50 boost::unit_test::test_suite* test
51 = BOOST_TEST_SUITE( "RangeTestSuite.ticket_5486" );
52
53 test->add( BOOST_TEST_CASE( &boost::test_ticket_5486 ) );
54
55 return test;
56 }