]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/bind/test/bind_function2_test.cpp
1 #include <boost/config.hpp>
2 #include <boost/config/pragma_message.hpp>
4 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ( defined(BOOST_GCC) && BOOST_GCC < 40600 )
6 BOOST_PRAGMA_MESSAGE( "Skipping test for GCC 4.4 -std=c++0x" )
12 // bind_function2_test.cpp - regression test
14 // Copyright (c) 2015 Peter Dimov
16 // Distributed under the Boost Software License, Version 1.0.
17 // See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt
21 #include <boost/bind/bind.hpp>
22 #include <boost/function.hpp>
23 #include <boost/core/lightweight_test.hpp>
25 using namespace boost::placeholders
;
34 void fv2( int & a
, int b
)
39 void fv3( int & a
, int b
, int c
)
44 void fv4( int & a
, int b
, int c
, int d
)
49 void fv5( int & a
, int b
, int c
, int d
, int e
)
54 void fv6( int & a
, int b
, int c
, int d
, int e
, int f
)
56 a
= b
+ c
+ d
+ e
+ f
;
59 void fv7( int & a
, int b
, int c
, int d
, int e
, int f
, int g
)
61 a
= b
+ c
+ d
+ e
+ f
+ g
;
64 void fv8( int & a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
)
66 a
= b
+ c
+ d
+ e
+ f
+ g
+ h
;
69 void fv9( int & a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, int i
)
71 a
= b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
;
79 boost::function
<void(int&)> fw1
= boost::bind( fv1
, _1
);
80 fw1( x
); BOOST_TEST( x
== 17041 );
84 boost::function
<void(int&, int)> fw2
= boost::bind( fv2
, _1
, _2
);
85 fw2( x
, 1 ); BOOST_TEST( x
== 1 );
89 boost::function
<void(int&, int, int)> fw3
= boost::bind( fv3
, _1
, _2
, _3
);
90 fw3( x
, 1, 2 ); BOOST_TEST( x
== 1+2 );
94 boost::function
<void(int&, int, int, int)> fw4
= boost::bind( fv4
, _1
, _2
, _3
, _4
);
95 fw4( x
, 1, 2, 3 ); BOOST_TEST( x
== 1+2+3 );
99 boost::function
<void(int&, int, int, int, int)> fw5
= boost::bind( fv5
, _1
, _2
, _3
, _4
, _5
);
100 fw5( x
, 1, 2, 3, 4 ); BOOST_TEST( x
== 1+2+3+4 );
104 boost::function
<void(int&, int, int, int, int, int)> fw6
= boost::bind( fv6
, _1
, _2
, _3
, _4
, _5
, _6
);
105 fw6( x
, 1, 2, 3, 4, 5 ); BOOST_TEST( x
== 1+2+3+4+5 );
109 boost::function
<void(int&, int, int, int, int, int, int)> fw7
= boost::bind( fv7
, _1
, _2
, _3
, _4
, _5
, _6
, _7
);
110 fw7( x
, 1, 2, 3, 4, 5, 6 ); BOOST_TEST( x
== 1+2+3+4+5+6 );
114 boost::function
<void(int&, int, int, int, int, int, int, int)> fw8
= boost::bind( fv8
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
);
115 fw8( x
, 1, 2, 3, 4, 5, 6, 7 ); BOOST_TEST( x
== 1+2+3+4+5+6+7 );
119 boost::function
<void(int&, int, int, int, int, int, int, int, int)> fw9
= boost::bind( fv9
, _1
, _2
, _3
, _4
, _5
, _6
, _7
, _8
, _9
);
120 fw9( x
, 1, 2, 3, 4, 5, 6, 7, 8 ); BOOST_TEST( x
== 1+2+3+4+5+6+7+8 );
127 return boost::report_errors();