| 1 | //////////////////////////////////////////////////////////////////////////// |
| 2 | // lazy_compose_tests.cpp |
| 3 | // |
| 4 | // tests on compose |
| 5 | // |
| 6 | //////////////////////////////////////////////////////////////////////////// |
| 7 | /*============================================================================= |
| 8 | Copyright (c) 2000-2003 Brian McNamara and Yannis Smaragdakis |
| 9 | Copyright (c) 2001-2007 Joel de Guzman |
| 10 | Copyright (c) 2015 John Fletcher |
| 11 | |
| 12 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 13 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 14 | ==============================================================================*/ |
| 15 | |
| 16 | #include <boost/phoenix/core/limits.hpp> |
| 17 | |
| 18 | #include <boost/detail/lightweight_test.hpp> |
| 19 | #include <boost/phoenix/core.hpp> |
| 20 | #include <boost/phoenix/function/lazy_prelude.hpp> |
| 21 | |
| 22 | |
| 23 | int main() |
| 24 | { |
| 25 | namespace phx = boost::phoenix; |
| 26 | using boost::phoenix::arg_names::arg1; |
| 27 | using boost::phoenix::arg_names::arg2; |
| 28 | using namespace phx; |
| 29 | |
| 30 | BOOST_TEST(compose(id,id)(arg1)(1) == 1); |
| 31 | BOOST_TEST(compose(id,id)(1)() == 1); |
| 32 | BOOST_TEST(compose(inc,inc)(arg1)(1) == 3); |
| 33 | BOOST_TEST(compose(inc,plus)(arg1,arg2)(2,3) == 6); |
| 34 | BOOST_TEST(compose(plus,inc,dec)(arg1)(1) == 2); |
| 35 | BOOST_TEST(compose(plus,plus,minus)(arg1,arg2)(3,1) == 6); |
| 36 | |
| 37 | |
| 38 | |
| 39 | return boost::report_errors(); |
| 40 | } |
| 41 | |