fail_tag.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014.
  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/fail.hpp>
  6. #include <boost/metaparse/get_message.hpp>
  7. #include <boost/metaparse/get_position.hpp>
  8. #include <boost/metaparse/start.hpp>
  9. #include "common.hpp"
  10. #include <boost/type_traits/is_same.hpp>
  11. #include <boost/mpl/assert.hpp>
  12. #include <boost/mpl/equal_to.hpp>
  13. #include <boost/mpl/apply_wrap.hpp>
  14. #include "test_case.hpp"
  15. BOOST_METAPARSE_TEST_CASE(fail_tag)
  16. {
  17. using boost::metaparse::fail;
  18. using boost::metaparse::get_message;
  19. using boost::metaparse::get_position;
  20. using boost::metaparse::start;
  21. using boost::mpl::apply_wrap2;
  22. using boost::mpl::equal_to;
  23. using boost::is_same;
  24. typedef fail<test_failure> p;
  25. typedef apply_wrap2<p, str_hello, start> failed_result;
  26. // test_getting_message_back
  27. BOOST_MPL_ASSERT((is_same<test_failure, get_message<failed_result>::type>));
  28. // test_getting_position
  29. BOOST_MPL_ASSERT((equal_to<start, get_position<failed_result>::type>));
  30. }