]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/boost_bind_compatibility/bind_and_or_test.cpp
1 /*==============================================================================
2 Copyright (c) 2008 Peter Dimov
3 Copyright (c) 2005-2010 Joel de Guzman
4 Copyright (c) 2010 Thomas Heller
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
10 #include <boost/phoenix/core.hpp>
11 #include <boost/phoenix/bind.hpp>
12 #include <boost/phoenix/operator.hpp>
15 #include <boost/detail/lightweight_test.hpp>
32 BOOST_ERROR("Short-circuit evaluation failure");
36 template <typename F
, typename A1
, typename A2
, typename R
>
38 tester(F f
, A1 a1
, A2 a2
, R r
)
40 BOOST_TEST(f(a1
, a2
) == r
);
45 using boost::phoenix::bind
;
46 using boost::phoenix::placeholders::_1
;
47 using boost::phoenix::placeholders::_2
;
51 tester(bind(f
, true) && bind(g
, true), false, false, f(true) && g(true));
52 tester(bind(f
, true) && bind(g
, false), false, false, f(true) && g(false));
54 tester(bind(f
, false) && bind(h
), false, false, f(false) && h());
56 tester(bind(f
, _1
) && bind(g
, _2
), true, true, f(true) && g(true));
57 tester(bind(f
, _1
) && bind(g
, _2
), true, false, f(true) && g(false));
59 tester(bind(f
, _1
) && bind(h
), false, false, f(false) && h());
63 tester(bind(f
, false) || bind(g
, true), false, false, f(false) || g(true));
65 tester(bind(f
, false) || bind(g
, false), false, false, f(false) || g(false));
67 tester(bind(f
, true) || bind(h
), false, false, f(true) || h());
69 tester(bind(f
, _1
) || bind(g
, _2
), false, true, f(false) || g(true));
70 tester(bind(f
, _1
) || bind(g
, _2
), false, false, f(false) || g(false));
72 tester(bind(f
, _1
) || bind(h
), true, false, f(true) || h());
76 return boost::report_errors();