eps.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*=============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #include <boost/detail/lightweight_test.hpp>
  7. #include <boost/spirit/include/qi_auxiliary.hpp>
  8. #include <boost/spirit/include/qi_operator.hpp>
  9. #include <boost/spirit/include/phoenix_core.hpp>
  10. #include <iostream>
  11. #include "test.hpp"
  12. int
  13. main()
  14. {
  15. using spirit_test::test;
  16. using boost::spirit::eps;
  17. {
  18. BOOST_TEST((test("", eps)));
  19. BOOST_TEST((test("xxx", eps, false)));
  20. BOOST_TEST((!test("", !eps))); // not predicate
  21. }
  22. { // test non-lazy semantic predicate
  23. BOOST_TEST((test("", eps(true))));
  24. BOOST_TEST((!test("", eps(false))));
  25. BOOST_TEST((test("", !eps(false)))); // not predicate
  26. }
  27. { // test lazy semantic predicate
  28. using boost::phoenix::val;
  29. BOOST_TEST((test("", eps(val(true)))));
  30. BOOST_TEST((!test("", eps(val(false)))));
  31. BOOST_TEST((test("", !eps(val(false))))); // not predicate
  32. }
  33. return boost::report_errors();
  34. }