]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/yap/test/supplied_transforms.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / yap / test / supplied_transforms.cpp
CommitLineData
f67539c2
TL
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
1e59de90 8#include <boost/core/lightweight_test.hpp>
f67539c2
TL
9
10namespace yap = boost::yap;
11
1e59de90 12int main()
f67539c2
TL
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;
20effc67 19
f67539c2
TL
20 auto xform = yap::replacements(6,9);
21 auto expr_out = yap::transform(expr_in,xform);
22 auto result = yap::evaluate(expr_out);
1e59de90 23 BOOST_TEST(result == 54);
20effc67
TL
24
25#ifndef _MSC_VER // Tsk, tsk.
26 constexpr auto cxform = yap::replacements(6);
27 constexpr auto cexpr_out = yap::transform(1_p,cxform);
28 constexpr auto cresult = yap::evaluate(cexpr_out);
29 static_assert(cresult == 6,"");
30#endif
f67539c2
TL
31 }
32
33 // Test evaluation(), which returns a transform object
34 {
35 using namespace boost::yap::literals;
36
37 auto expr_in = 1_p * 2_p;
20effc67 38
f67539c2
TL
39 auto xform = yap::evaluation(7,10);
40 auto result = yap::transform(expr_in,xform);
1e59de90 41 BOOST_TEST(result == 70);
20effc67
TL
42
43#ifndef _MSC_VER // Tsk, tsk.
44 constexpr auto cxform = yap::evaluation(7);
45 constexpr auto cresult = yap::transform(1_p,cxform);
46 static_assert(cresult == 7,"");
47#endif
f67539c2
TL
48 }
49
50 // Test replace_placeholders(), which returns an expression
51 {
52 using namespace boost::yap::literals;
53
54 auto expr_in = 1_p * 2_p;
20effc67 55
f67539c2
TL
56 auto expr_out = yap::replace_placeholders(expr_in,8,11);
57 auto result = yap::evaluate(expr_out);
1e59de90 58 BOOST_TEST(result == 88);
20effc67
TL
59
60#ifndef _MSC_VER // Tsk, tsk.
61 constexpr auto cexpr_out = yap::replace_placeholders(1_p,8);
62 constexpr auto cresult = yap::evaluate(cexpr_out);
63 static_assert(cresult == 8,"");
64#endif
f67539c2
TL
65 }
66
1e59de90 67 return boost::report_errors();
f67539c2
TL
68}
69