]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bind/test/bind_function_ap_test.cpp
900a131805089f4e36a94603f872b1b7ae4209e3
1 #include <boost/config.hpp>
4 // bind_function_ap_test.cpp - regression test
6 // Copyright (c) 2015 Peter Dimov
8 // Distributed under the Boost Software License, Version 1.0.
9 // See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt
13 #if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 406 )
14 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
15 #elif defined( __clang__ ) && defined( __has_warning )
16 # if __has_warning( "-Wdeprecated-declarations" )
17 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
21 #include <boost/bind.hpp>
22 #include <boost/function.hpp>
23 #include <boost/detail/lightweight_test.hpp>
28 void fv1( std::auto_ptr
<int> p1
)
30 BOOST_TEST( *p1
== 1 );
33 void fv2( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
)
35 BOOST_TEST( *p1
== 1 );
36 BOOST_TEST( *p2
== 2 );
39 void fv3( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
)
41 BOOST_TEST( *p1
== 1 );
42 BOOST_TEST( *p2
== 2 );
43 BOOST_TEST( *p3
== 3 );
46 void fv4( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
)
48 BOOST_TEST( *p1
== 1 );
49 BOOST_TEST( *p2
== 2 );
50 BOOST_TEST( *p3
== 3 );
51 BOOST_TEST( *p4
== 4 );
54 void fv5( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
)
56 BOOST_TEST( *p1
== 1 );
57 BOOST_TEST( *p2
== 2 );
58 BOOST_TEST( *p3
== 3 );
59 BOOST_TEST( *p4
== 4 );
60 BOOST_TEST( *p5
== 5 );
63 void fv6( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
)
65 BOOST_TEST( *p1
== 1 );
66 BOOST_TEST( *p2
== 2 );
67 BOOST_TEST( *p3
== 3 );
68 BOOST_TEST( *p4
== 4 );
69 BOOST_TEST( *p5
== 5 );
70 BOOST_TEST( *p6
== 6 );
73 void fv7( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
)
75 BOOST_TEST( *p1
== 1 );
76 BOOST_TEST( *p2
== 2 );
77 BOOST_TEST( *p3
== 3 );
78 BOOST_TEST( *p4
== 4 );
79 BOOST_TEST( *p5
== 5 );
80 BOOST_TEST( *p6
== 6 );
81 BOOST_TEST( *p7
== 7 );
84 void fv8( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
, std::auto_ptr
<int> p8
)
86 BOOST_TEST( *p1
== 1 );
87 BOOST_TEST( *p2
== 2 );
88 BOOST_TEST( *p3
== 3 );
89 BOOST_TEST( *p4
== 4 );
90 BOOST_TEST( *p5
== 5 );
91 BOOST_TEST( *p6
== 6 );
92 BOOST_TEST( *p7
== 7 );
93 BOOST_TEST( *p8
== 8 );
96 void fv9( std::auto_ptr
<int> p1
, std::auto_ptr
<int> p2
, std::auto_ptr
<int> p3
, std::auto_ptr
<int> p4
, std::auto_ptr
<int> p5
, std::auto_ptr
<int> p6
, std::auto_ptr
<int> p7
, std::auto_ptr
<int> p8
, std::auto_ptr
<int> p9
)
98 BOOST_TEST( *p1
== 1 );
99 BOOST_TEST( *p2
== 2 );
100 BOOST_TEST( *p3
== 3 );
101 BOOST_TEST( *p4
== 4 );
102 BOOST_TEST( *p5
== 5 );
103 BOOST_TEST( *p6
== 6 );
104 BOOST_TEST( *p7
== 7 );
105 BOOST_TEST( *p8
== 8 );
106 BOOST_TEST( *p9
== 9 );
112 boost::function
<void(std::auto_ptr
<int>)> fw1
= boost::bind( fv1
, _1
);
114 std::auto_ptr
<int> p1( new int(1) );
120 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>)> fw2
= boost::bind( fv2
, _1
, _2
);
122 std::auto_ptr
<int> p1( new int(1) );
123 std::auto_ptr
<int> p2( new int(2) );
129 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw3
= boost::bind( fv3
, _1
, _2
, _3
);
131 std::auto_ptr
<int> p1( new int(1) );
132 std::auto_ptr
<int> p2( new int(2) );
133 std::auto_ptr
<int> p3( new int(3) );
139 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw4
= boost::bind( fv4
, _1
, _2
, _3
, _4
);
141 std::auto_ptr
<int> p1( new int(1) );
142 std::auto_ptr
<int> p2( new int(2) );
143 std::auto_ptr
<int> p3( new int(3) );
144 std::auto_ptr
<int> p4( new int(4) );
146 fw4( p1
, p2
, p3
, p4
);
150 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw5
= boost::bind( fv5
, _1
, _2
, _3
, _4
, _5
);
152 std::auto_ptr
<int> p1( new int(1) );
153 std::auto_ptr
<int> p2( new int(2) );
154 std::auto_ptr
<int> p3( new int(3) );
155 std::auto_ptr
<int> p4( new int(4) );
156 std::auto_ptr
<int> p5( new int(5) );
158 fw5( p1
, p2
, p3
, p4
, p5
);
162 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw6
= boost::bind( fv6
, _1
, _2
, _3
, _4
, _5
, _6
);
164 std::auto_ptr
<int> p1( new int(1) );
165 std::auto_ptr
<int> p2( new int(2) );
166 std::auto_ptr
<int> p3( new int(3) );
167 std::auto_ptr
<int> p4( new int(4) );
168 std::auto_ptr
<int> p5( new int(5) );
169 std::auto_ptr
<int> p6( new int(6) );
171 fw6( p1
, p2
, p3
, p4
, p5
, p6
);
175 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw7
= boost::bind( fv7
, _1
, _2
, _3
, _4
, _5
, _6
, _7
);
177 std::auto_ptr
<int> p1( new int(1) );
178 std::auto_ptr
<int> p2( new int(2) );
179 std::auto_ptr
<int> p3( new int(3) );
180 std::auto_ptr
<int> p4( new int(4) );
181 std::auto_ptr
<int> p5( new int(5) );
182 std::auto_ptr
<int> p6( new int(6) );
183 std::auto_ptr
<int> p7( new int(7) );
185 fw7( p1
, p2
, p3
, p4
, p5
, p6
, p7
);
189 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw8
= boost::bind( fv8
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
);
191 std::auto_ptr
<int> p1( new int(1) );
192 std::auto_ptr
<int> p2( new int(2) );
193 std::auto_ptr
<int> p3( new int(3) );
194 std::auto_ptr
<int> p4( new int(4) );
195 std::auto_ptr
<int> p5( new int(5) );
196 std::auto_ptr
<int> p6( new int(6) );
197 std::auto_ptr
<int> p7( new int(7) );
198 std::auto_ptr
<int> p8( new int(8) );
200 fw8( p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
);
204 boost::function
<void(std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>, std::auto_ptr
<int>)> fw9
= boost::bind( fv9
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
, _9
);
206 std::auto_ptr
<int> p1( new int(1) );
207 std::auto_ptr
<int> p2( new int(2) );
208 std::auto_ptr
<int> p3( new int(3) );
209 std::auto_ptr
<int> p4( new int(4) );
210 std::auto_ptr
<int> p5( new int(5) );
211 std::auto_ptr
<int> p6( new int(6) );
212 std::auto_ptr
<int> p7( new int(7) );
213 std::auto_ptr
<int> p8( new int(8) );
214 std::auto_ptr
<int> p9( new int(9) );
216 fw9( p1
, p2
, p3
, p4
, p5
, p6
, p7
, p8
, p9
);
223 return boost::report_errors();