Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/spirit/phoenix/test/unary_tests.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.4 KB
Line 
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
16using namespace phoenix;
17using namespace std;
18
19///////////////////////////////////////////////////////////////////////////////
20int
21main()
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}
Note: See TracBrowser for help on using the repository browser.