]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/classic/phoenix/test/mixed_binary_tests.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / spirit / classic / phoenix / test / mixed_binary_tests.cpp
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
12 #define PHOENIX_LIMIT 15
13 #include <boost/spirit/include/phoenix1_primitives.hpp>
14 #include <boost/spirit/include/phoenix1_operators.hpp>
15
16 #include <boost/core/lightweight_test.hpp>
17
18 using namespace phoenix;
19 using namespace std;
20
21 ///////////////////////////////////////////////////////////////////////////////
22 int
23 main()
24 {
25 int i1 = 1, i2 = 2, i50 = 50, i100 = 100;
26 double d2_5 = 2.5;
27 string hello = "hello";
28 const char* world = " world";
29
30 ///////////////////////////////////////////////////////////////////////////////
31 //
32 // Mixed type operators
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 BOOST_TEST((arg1 + arg2)(i100, i50) == (i100 + i50));
36 BOOST_TEST((arg1 + 3)(i100) == (3 + i100));
37 BOOST_TEST((arg1 + arg2)(hello, world) == "hello world");
38 BOOST_TEST((arg1 + arg2)(i1, d2_5) == (i1 + d2_5));
39
40 BOOST_TEST((*(arg1 + arg2))(world, i2) == *(world + i2));
41 BOOST_TEST((*(arg1 + arg2))(i2, world) == *(i2 + world));
42 BOOST_TEST((*(val(world+i2) - arg1))(i2) == *world);
43
44 ///////////////////////////////////////////////////////////////////////////////
45 //
46 // End asserts
47 //
48 ///////////////////////////////////////////////////////////////////////////////
49
50 return boost::report_errors();
51 }