]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/test/qi/difference.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2010 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 =============================================================================*/
7 #include <boost/detail/lightweight_test.hpp>
8 #include <boost/spirit/include/qi_operator.hpp>
9 #include <boost/spirit/include/qi_char.hpp>
10 #include <boost/spirit/include/qi_string.hpp>
11 #include <boost/spirit/include/qi_numeric.hpp>
12 #include <boost/spirit/include/qi_directive.hpp>
13 #include <boost/spirit/include/qi_action.hpp>
14 #include <boost/spirit/include/support_argument.hpp>
15 #include <boost/spirit/include/phoenix_core.hpp>
16 #include <boost/spirit/include/phoenix_operator.hpp>
25 using namespace boost::spirit::ascii
;
26 using boost::spirit::lit
;
27 using spirit_test::test
;
30 BOOST_TEST(test("b", char_
- 'a'));
31 BOOST_TEST(!test("a", char_
- 'a'));
32 BOOST_TEST(test("/* abcdefghijk */", "/*" >> *(char_
- "*/") >> "*/"));
36 BOOST_TEST(test("b", char_
- no_case
['a']));
37 BOOST_TEST(!test("a", char_
- no_case
['a']));
38 BOOST_TEST(!test("A", char_
- no_case
['a']));
40 BOOST_TEST(test("b", no_case
[lower
- 'a']));
41 BOOST_TEST(test("B", no_case
[lower
- 'a']));
42 BOOST_TEST(!test("a", no_case
[lower
- 'a']));
43 BOOST_TEST(!test("A", no_case
[lower
- 'a']));
47 // $$$ See difference.hpp why these tests are not done anymore. $$$
49 // BOOST_TEST(test("switcher", lit("switcher") - "switch"));
50 // BOOST_TEST(test(" switcher ", lit("switcher") - "switch", space));
52 BOOST_TEST(!test("switch", lit("switch") - "switch"));
56 using boost::spirit::_1
;
57 namespace phx
= boost::phoenix
;
63 , "/*" >> *(char_
- "*/")[phx::ref(s
) += _1
] >> "*/"
65 BOOST_TEST(s
== "abcdefghijk");
70 , "/*" >> *(char_
- "*/")[phx::ref(s
) += _1
] >> "*/"
73 BOOST_TEST(s
== "abcdefghijk");
76 return boost::report_errors();