| 1 | /*============================================================================= |
| 2 | Copyright (c) 2001-2010 Hartmut Kaiser |
| 3 | |
| 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/spirit/include/qi_matches.hpp> |
| 8 | |
| 9 | #include <boost/spirit/include/qi_char.hpp> |
| 10 | |
| 11 | #include <iostream> |
| 12 | #include "test.hpp" |
| 13 | |
| 14 | namespace qi = boost::spirit::qi; |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | using spirit_test::test; |
| 19 | using spirit_test::test_attr; |
| 20 | using qi::matches; |
| 21 | using qi::char_; |
| 22 | |
| 23 | { |
| 24 | BOOST_TEST(test("x" , matches[char_])); |
| 25 | bool result = false; |
| 26 | BOOST_TEST(test_attr("x" , matches[char_], result) && result); |
| 27 | } |
| 28 | |
| 29 | { |
| 30 | BOOST_TEST(!test("y" , matches[char_('x')])); |
| 31 | BOOST_TEST(!test("y" , matches['x'])); |
| 32 | bool result = true; |
| 33 | BOOST_TEST(test_attr("y" , matches[char_('x')], result, false) && !result); |
| 34 | result = true; |
| 35 | BOOST_TEST(test_attr("y" , matches['x'], result, false) && !result); |
| 36 | } |
| 37 | |
| 38 | return boost::report_errors(); |
| 39 | } |
| 40 | |