empty.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/metaparse/empty.hpp>
  6. #include <boost/metaparse/is_error.hpp>
  7. #include <boost/metaparse/start.hpp>
  8. #include <boost/metaparse/get_result.hpp>
  9. #include "common.hpp"
  10. #include <boost/mpl/equal_to.hpp>
  11. #include <boost/mpl/apply_wrap.hpp>
  12. #include <boost/mpl/assert.hpp>
  13. #include "test_case.hpp"
  14. BOOST_METAPARSE_TEST_CASE(empty)
  15. {
  16. using boost::metaparse::get_result;
  17. using boost::metaparse::empty;
  18. using boost::metaparse::start;
  19. using boost::metaparse::is_error;
  20. using boost::mpl::equal_to;
  21. using boost::mpl::apply_wrap2;
  22. typedef empty<int13> empty13;
  23. // test_accept_empty
  24. BOOST_MPL_ASSERT((
  25. equal_to<get_result<apply_wrap2<empty13, str_, start> >::type, int13>
  26. ));
  27. // test_reject_non_empty
  28. BOOST_MPL_ASSERT((is_error<apply_wrap2<empty13, str_a, start> >));
  29. }