| 1 | /*============================================================================= |
| 2 | Copyright (c) 2001-2010 Joel de Guzman |
| 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_eps.hpp> |
| 8 | |
| 9 | #include <boost/spirit/include/qi_lazy.hpp> |
| 10 | #include <boost/spirit/include/qi_not_predicate.hpp> |
| 11 | #include <boost/phoenix/core.hpp> |
| 12 | #include <iostream> |
| 13 | #include "test.hpp" |
| 14 | |
| 15 | int |
| 16 | main() |
| 17 | { |
| 18 | using spirit_test::test; |
| 19 | using boost::spirit::eps; |
| 20 | |
| 21 | { |
| 22 | BOOST_TEST((test("" , eps))); |
| 23 | BOOST_TEST((test("xxx" , eps, false))); |
| 24 | BOOST_TEST((!test("" , !eps))); // not predicate |
| 25 | } |
| 26 | |
| 27 | { // test non-lazy semantic predicate |
| 28 | |
| 29 | BOOST_TEST((test("" , eps(true)))); |
| 30 | BOOST_TEST((!test("" , eps(false)))); |
| 31 | BOOST_TEST((test("" , !eps(false)))); // not predicate |
| 32 | } |
| 33 | |
| 34 | { // test lazy semantic predicate |
| 35 | |
| 36 | using boost::phoenix::val; |
| 37 | |
| 38 | BOOST_TEST((test("" , eps(val(true))))); |
| 39 | BOOST_TEST((!test("" , eps(val(false))))); |
| 40 | BOOST_TEST((test("" , !eps(val(false))))); // not predicate |
| 41 | } |
| 42 | |
| 43 | return boost::report_errors(); |
| 44 | } |
| 45 | |