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 <boost/detail/lightweight_test.hpp> |
---|
11 | |
---|
12 | #define PHOENIX_LIMIT 15 |
---|
13 | #include <boost/spirit/phoenix/primitives.hpp> |
---|
14 | #include <boost/spirit/phoenix/operators.hpp> |
---|
15 | |
---|
16 | using namespace phoenix; |
---|
17 | using namespace std; |
---|
18 | |
---|
19 | /////////////////////////////////////////////////////////////////////////////// |
---|
20 | int |
---|
21 | main() |
---|
22 | { |
---|
23 | int i1 = 1, i = 5; |
---|
24 | |
---|
25 | /////////////////////////////////////////////////////////////////////////////// |
---|
26 | // |
---|
27 | // Unary operators |
---|
28 | // |
---|
29 | /////////////////////////////////////////////////////////////////////////////// |
---|
30 | BOOST_TEST((!val(true))() == false); |
---|
31 | BOOST_TEST((-val(1))() == -1); |
---|
32 | BOOST_TEST((+val(1))() == +1); |
---|
33 | BOOST_TEST((~val(1))() == ~1); |
---|
34 | BOOST_TEST(*(&arg1)(i1) == *(&i1)); |
---|
35 | BOOST_TEST((&arg1)(i1) == &i1); |
---|
36 | |
---|
37 | BOOST_TEST((*val(&i1))() == *(&i1)); |
---|
38 | BOOST_TEST((*&arg1)(i1) == *(&i1)); |
---|
39 | BOOST_TEST((++var(i))() == 6); |
---|
40 | BOOST_TEST((--var(i))() == 5); |
---|
41 | BOOST_TEST((var(i)++)() == 5); |
---|
42 | BOOST_TEST(i == 6); |
---|
43 | BOOST_TEST((var(i)--)() == 6); |
---|
44 | BOOST_TEST(i == 5); |
---|
45 | |
---|
46 | return boost::report_errors(); |
---|
47 | } |
---|