]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/except.hpp> | |
7 | #include <boost/metaparse/one_char.hpp> | |
8 | #include <boost/metaparse/fail.hpp> | |
9 | #include <boost/metaparse/is_error.hpp> | |
10 | #include <boost/metaparse/start.hpp> | |
11 | #include <boost/metaparse/get_result.hpp> | |
12 | ||
13 | #include "common.hpp" | |
14 | ||
15 | #include <boost/mpl/equal_to.hpp> | |
16 | #include <boost/mpl/apply_wrap.hpp> | |
17 | #include <boost/mpl/assert.hpp> | |
18 | ||
19 | #include "test_case.hpp" | |
20 | ||
21 | BOOST_METAPARSE_TEST_CASE(except) | |
22 | { | |
23 | using boost::metaparse::is_error; | |
24 | using boost::metaparse::except; | |
25 | using boost::metaparse::one_char; | |
26 | using boost::metaparse::start; | |
27 | using boost::metaparse::get_result; | |
28 | using boost::metaparse::fail; | |
29 | ||
30 | using boost::mpl::apply_wrap2; | |
31 | using boost::mpl::equal_to; | |
32 | ||
33 | // test_with_good | |
34 | BOOST_MPL_ASSERT(( | |
35 | is_error< | |
36 | apply_wrap2<except<one_char, int13, test_failure>, str_hello, start> | |
37 | > | |
38 | )); | |
39 | ||
40 | // test_with_bad | |
41 | BOOST_MPL_ASSERT(( | |
42 | equal_to< | |
43 | get_result< | |
44 | apply_wrap2< | |
45 | except<fail<test_failure>, int13, test_failure>, | |
46 | str_hello, | |
47 | start | |
48 | > | |
49 | >::type, | |
50 | int13 | |
51 | > | |
52 | )); | |
53 | } | |
54 | ||
55 | ||
56 |