• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
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/always_c.hpp>
7 #include <boost/metaparse/is_error.hpp>
8 #include <boost/metaparse/start.hpp>
9 #include <boost/metaparse/get_result.hpp>
10 
11 #include "common.hpp"
12 
13 #include <boost/mpl/apply_wrap.hpp>
14 #include <boost/mpl/assert.hpp>
15 
16 #include "test_case.hpp"
17 
BOOST_METAPARSE_TEST_CASE(always_c)18 BOOST_METAPARSE_TEST_CASE(always_c)
19 {
20   using boost::metaparse::get_result;
21   using boost::metaparse::always_c;
22   using boost::metaparse::start;
23   using boost::metaparse::is_error;
24 
25   using boost::mpl::equal_to;
26   using boost::mpl::apply_wrap2;
27 
28   // test_result
29   BOOST_MPL_ASSERT((
30     equal_to<
31       get_result<apply_wrap2<always_c<'1', int13>, str_1, start> >::type,
32       int13
33     >
34   ));
35 
36   // test_fail
37   BOOST_MPL_ASSERT((
38     is_error<apply_wrap2<always_c<'1', int13>, str_a, start> >
39   ));
40 }
41 
42