1 /*=============================================================================
2 Phoenix V1.2.1
3 Copyright (c) 2001-2003 Joel de Guzman
4
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 #include <iostream>
10 #include <string>
11 #include <boost/detail/lightweight_test.hpp>
12
13 #define PHOENIX_LIMIT 15
14 #include <boost/spirit/include/phoenix1_primitives.hpp>
15 #include <boost/spirit/include/phoenix1_operators.hpp>
16
17 using namespace phoenix;
18 using namespace std;
19
20 ///////////////////////////////////////////////////////////////////////////////
21 int
main()22 main()
23 {
24 int i1 = 1, i2 = 2, i50 = 50, i100 = 100;
25 double d2_5 = 2.5;
26 string hello = "hello";
27 const char* world = " world";
28
29 ///////////////////////////////////////////////////////////////////////////////
30 //
31 // Mixed type operators
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 BOOST_TEST((arg1 + arg2)(i100, i50) == (i100 + i50));
35 BOOST_TEST((arg1 + 3)(i100) == (3 + i100));
36 BOOST_TEST((arg1 + arg2)(hello, world) == "hello world");
37 BOOST_TEST((arg1 + arg2)(i1, d2_5) == (i1 + d2_5));
38
39 BOOST_TEST((*(arg1 + arg2))(world, i2) == *(world + i2));
40 BOOST_TEST((*(arg1 + arg2))(i2, world) == *(i2 + world));
41 BOOST_TEST((*(val(world+i2) - arg1))(i2) == *world);
42
43 ///////////////////////////////////////////////////////////////////////////////
44 //
45 // End asserts
46 //
47 ///////////////////////////////////////////////////////////////////////////////
48
49 return boost::report_errors();
50 }
51