]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/bll_compatibility/rvalue_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / phoenix / test / bll_compatibility / rvalue_test.cpp
1 // rvalue_test - test lambda function objects with rvalue arguments
2 //
3 // Copyright (c) 2007 Peter Dimov
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8
9 #include <boost/lambda/lambda.hpp>
10 #include <boost/detail/lightweight_test.hpp>
11
12 int main()
13 {
14 using namespace boost::lambda;
15
16 int x = 0;
17 int const y = 1;
18 int const z = 2;
19
20 BOOST_TEST( _1( x ) == 0 );
21 BOOST_TEST( _1( y ) == 1 );
22 BOOST_TEST( _1( 2 ) == 2 );
23
24 BOOST_TEST( _2( x, x ) == 0 );
25 BOOST_TEST( _2( x, y ) == 1 );
26 BOOST_TEST( _2( x, 2 ) == 2 );
27
28 BOOST_TEST( _2( 4, x ) == 0 );
29 BOOST_TEST( _2( 4, y ) == 1 );
30 BOOST_TEST( _2( 4, 2 ) == 2 );
31
32 (_1 = _2)( x, y );
33 BOOST_TEST( x == y );
34
35 (_1 = _2)( x, 3 );
36 BOOST_TEST( x == 3 );
37
38 (_2 = _1)( z, x );
39 BOOST_TEST( x == z );
40
41 (_2 = _1)( 4, x );
42 BOOST_TEST( x == 4 );
43
44 BOOST_TEST( _3( x, x, x ) == x );
45 BOOST_TEST( _3( x, x, y ) == y );
46 BOOST_TEST( _3( x, x, 2 ) == 2 );
47
48 BOOST_TEST( _3( x, 5, x ) == x );
49 BOOST_TEST( _3( x, 5, y ) == y );
50 BOOST_TEST( _3( x, 5, 2 ) == 2 );
51
52 BOOST_TEST( _3( 9, 5, x ) == x );
53 BOOST_TEST( _3( 9, 5, y ) == y );
54 BOOST_TEST( _3( 9, 5, 2 ) == 2 );
55
56 return boost::report_errors();
57 }