• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 ////////////////////////////////////////////////////////////////////////////
2 // lazy_operator_tests.cpp
3 //
4 // lazy operator tests
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_operator.hpp>
21 
22 
main()23 int main()
24 {
25     using boost::phoenix::plus;
26     using boost::phoenix::minus;
27     using boost::phoenix::arg_names::arg1;
28     using boost::phoenix::arg_names::arg2;
29 
30     int a = 123;
31     int b = 256;
32 
33     BOOST_TEST(plus(arg1, arg2)(a, b)    == a+b);
34     BOOST_TEST(plus(arg1, arg2, 3)(a, b) == a+b+3);
35     BOOST_TEST(plus(arg1, b)(a)          == a+b);
36     BOOST_TEST(plus(a, arg2)(a,b)        == a+b);
37     BOOST_TEST(plus(a, arg1)(b)          == a+b);
38     BOOST_TEST(plus(a, b)()              == a+b);
39     BOOST_TEST(minus(a, b)()             == a-b);
40     BOOST_TEST(plus(minus(a, b),b)()             == a);
41     BOOST_TEST(plus(minus(arg1, b),b)(a)         == a);
42     BOOST_TEST(plus(minus(arg1, arg2),b)(a,b)    == a);
43     BOOST_TEST(plus(minus(arg1, arg2),arg2)(a,b) ==a);
44 
45     return boost::report_errors();
46 }
47