]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/yap/test/supplied_transforms.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / yap / test / supplied_transforms.cpp
1 // Copyright (C) 2019 Paul Keir
2 //
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>
7
8 #include <boost/test/minimal.hpp>
9
10 namespace yap = boost::yap;
11
12 int test_main(int, char * [])
13 {
14 // Test replacements(), which returns a transform object
15 {
16 using namespace boost::yap::literals;
17
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);
23 }
24
25 // Test evaluation(), which returns a transform object
26 {
27 using namespace boost::yap::literals;
28
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);
33 }
34
35 // Test replace_placeholders(), which returns an expression
36 {
37 using namespace boost::yap::literals;
38
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);
43 }
44
45 return 0;
46 }
47