]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/function/lazy_thunk_tests.cpp
1 //////////////////////////////////////////////////////////////////
3 // lazy_thunk_tests.cpp
5 // Tests for thunk functions.
8 /*=============================================================================
9 Copyright (c) 2000-2003 Brian McNamara and Yannis Smaragdakis
10 Copyright (c) 2001-2007 Joel de Guzman
11 Copyright (c) 2015 John Fletcher
13 Distributed under the Boost Software License, Version 1.0. (See accompanying
14 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
15 ==============================================================================*/
18 #include <boost/phoenix/core.hpp>
19 #include <boost/phoenix/function.hpp>
20 #include <boost/shared_ptr.hpp>
21 #include <boost/phoenix/function/lazy_prelude.hpp>
23 #include <boost/detail/lightweight_test.hpp>
25 using namespace boost::phoenix
;
33 using boost::phoenix::arg_names::arg1
;
34 using boost::phoenix::arg_names::arg2
;
36 BOOST_TEST( thunk1(inc
,1)()() == 2);
37 BOOST_TEST( thunk1(inc
,arg1
)(1)() == 2);
38 BOOST_TEST( thunk2(plus
,1,2)()() == 3);
39 BOOST_TEST( thunk2(plus
,arg1
,arg2
)(1,2)() == 3);
41 list
<int> l
= enum_from_to(1,5);
42 list
<int> l4
= take(4,l
)();
43 BOOST_TEST( foldl(plus
,0,l4
)() == 10);
44 BOOST_TEST( thunk3(foldl
,plus
,0,l4
)()() == 10);
45 BOOST_TEST( thunk3(foldl
,plus
,arg1
,l4
)(0)() == 10);
47 return boost::report_errors();