#include #include #include template using term = boost::yap::terminal; template using ref = boost::yap::expression_ref; namespace yap = boost::yap; namespace bh = boost::hana; TEST(placeholder_eval, test_placeholder_eval) { using namespace boost::yap::literals; yap::placeholder<3> p3 = 3_p; int i_ = 42; term i{std::move(i_)}; yap::expression< yap::expr_kind::plus, bh::tuple< ref &>, term > > expr = p3 + std::move(i); yap::expression< yap::expr_kind::plus, bh::tuple< ref &>, yap::expression< yap::expr_kind::plus, bh::tuple< ref &>, term > > > > unevaluated_expr = p3 + std::move(expr); { double result = evaluate(p3, 5, 6, 7); EXPECT_EQ(result, 7); } { double result = evaluate(expr, std::string("15"), 3, 1); EXPECT_EQ(result, 43); } { double result = evaluate(unevaluated_expr, std::string("15"), 2, 3); EXPECT_EQ(result, 48); } }