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