]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/yap/test/supplied_transforms.cpp
1 // Copyright (C) 2019 Paul Keir
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/yap.hpp>
8 #include <boost/test/minimal.hpp>
10 namespace yap
= boost::yap
;
12 int test_main(int, char * [])
14 // Test replacements(), which returns a transform object
16 using namespace boost::yap::literals
;
18 auto expr_in
= 1_p
* 2_p
;
19 auto xform
= yap::replacements(6,9);
20 auto expr_out
= yap::transform(expr_in
,xform
);
21 auto result
= yap::evaluate(expr_out
);
22 BOOST_CHECK(result
== 54);
25 // Test evaluation(), which returns a transform object
27 using namespace boost::yap::literals
;
29 auto expr_in
= 1_p
* 2_p
;
30 auto xform
= yap::evaluation(7,10);
31 auto result
= yap::transform(expr_in
,xform
);
32 BOOST_CHECK(result
== 70);
35 // Test replace_placeholders(), which returns an expression
37 using namespace boost::yap::literals
;
39 auto expr_in
= 1_p
* 2_p
;
40 auto expr_out
= yap::replace_placeholders(expr_in
,8,11);
41 auto result
= yap::evaluate(expr_out
);
42 BOOST_CHECK(result
== 88);