]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/yap/test/placeholder_eval.cpp
48c1d98b43992030916f6ffe800b49f550fb3d20
1 // Copyright (C) 2016-2018 T. Zachary Laine
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/yap/expression.hpp>
8 #include <boost/core/lightweight_test.hpp>
14 using term
= boost::yap::terminal
<boost::yap::expression
, T
>;
18 boost::yap::terminal
<boost::yap::expression
, boost::yap::placeholder
<I
>>;
21 using ref
= boost::yap::expression_ref
<boost::yap::expression
, T
>;
23 namespace yap
= boost::yap
;
24 namespace bh
= boost::hana
;
30 using namespace boost::yap::literals
;
32 place_term
<3> p3
= 3_p
;
34 term
<int> i
{std::move(i_
)};
37 bh::tuple
<ref
<place_term
<3> &>, term
<int>>>
38 expr
= p3
+ std::move(i
);
45 bh::tuple
<ref
<place_term
<3> &>, term
<int>>>>>
46 unevaluated_expr
= p3
+ std::move(expr
);
49 double result
= evaluate(p3
, 5, 6, 7);
50 BOOST_TEST(result
== 7);
54 double result
= evaluate(expr
, std::string("15"), 3, 1);
55 BOOST_TEST(result
== 43);
59 double result
= evaluate(unevaluated_expr
, std::string("15"), 2, 3);
60 BOOST_TEST(result
== 48);
64 return boost::report_errors();