• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
6 #include <boost/metaparse/fail.hpp>
7 #include <boost/metaparse/get_message.hpp>
8 #include <boost/metaparse/get_position.hpp>
9 #include <boost/metaparse/start.hpp>
10 
11 #include "common.hpp"
12 
13 #include <boost/type_traits/is_same.hpp>
14 
15 #include <boost/mpl/assert.hpp>
16 #include <boost/mpl/equal_to.hpp>
17 #include <boost/mpl/apply_wrap.hpp>
18 
19 #include "test_case.hpp"
20 
BOOST_METAPARSE_TEST_CASE(fail_tag)21 BOOST_METAPARSE_TEST_CASE(fail_tag)
22 {
23   using boost::metaparse::fail;
24   using boost::metaparse::get_message;
25   using boost::metaparse::get_position;
26   using boost::metaparse::start;
27 
28   using boost::mpl::apply_wrap2;
29   using boost::mpl::equal_to;
30   using boost::is_same;
31 
32   typedef fail<test_failure> p;
33   typedef apply_wrap2<p, str_hello, start> failed_result;
34 
35   // test_getting_message_back
36   BOOST_MPL_ASSERT((is_same<test_failure, get_message<failed_result>::type>));
37 
38   // test_getting_position
39   BOOST_MPL_ASSERT((equal_to<start, get_position<failed_result>::type>));
40 }
41 
42