• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/detail/lightweight_test.hpp>
8 #include <boost/spirit/include/qi_auxiliary.hpp>
9 #include <boost/spirit/include/qi_operator.hpp>
10 #include <boost/spirit/include/phoenix_core.hpp>
11 
12 #include <iostream>
13 #include "test.hpp"
14 
15 int
main()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