]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/test/middle_of.cpp
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)
6 #include <boost/metaparse/middle_of.hpp>
7 #include <boost/metaparse/is_error.hpp>
8 #include <boost/metaparse/start.hpp>
9 #include <boost/metaparse/get_result.hpp>
10 #include <boost/metaparse/get_message.hpp>
11 #include <boost/metaparse/error/unpaired.hpp>
12 #include <boost/metaparse/error/literal_expected.hpp>
16 #include <boost/mpl/equal_to.hpp>
17 #include <boost/mpl/apply_wrap.hpp>
18 #include <boost/mpl/assert.hpp>
20 #include <boost/type_traits/is_same.hpp>
22 #include "test_case.hpp"
24 BOOST_METAPARSE_TEST_CASE(middle_of
)
26 using boost::metaparse::get_result
;
27 using boost::metaparse::middle_of
;
28 using boost::metaparse::start
;
29 using boost::metaparse::is_error
;
30 using boost::metaparse::get_message
;
32 using boost::metaparse::error::unpaired
;
33 using boost::metaparse::error::literal_expected
;
37 using boost::mpl::equal_to
;
38 using boost::mpl::apply_wrap2
;
44 apply_wrap2
<middle_of
<lit_h
, lit_e
, lit_l
>, str_hello
, start
>
52 is_error
<apply_wrap2
<middle_of
<lit_x
, lit_e
, lit_l
>, str_hello
, start
> >
57 is_error
<apply_wrap2
<middle_of
<lit_h
, lit_x
, lit_l
>, str_hello
, start
> >
62 is_error
<apply_wrap2
<middle_of
<lit_h
, lit_e
, lit_x
>, str_hello
, start
> >
65 // test_error_message_when_third_fails
68 unpaired
<1, 1, literal_expected
<'x'> >,
70 apply_wrap2
<middle_of
<lit_h
, lit_e
, lit_x
>, str_hello
, start
>
77 is_error
<apply_wrap2
<middle_of
<lit_h
, lit_e
, lit_l
>, str_
, start
> >