]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/metaparse/test/accept_when.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / test / accept_when.cpp
CommitLineData
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/accept_when.hpp>
7#include <boost/metaparse/get_result.hpp>
8#include <boost/metaparse/util/is_digit.hpp>
9#include <boost/metaparse/is_error.hpp>
10#include <boost/metaparse/start.hpp>
11#include <boost/metaparse/one_char.hpp>
12
13#include "common.hpp"
14
15#include <boost/metaparse/util/is_digit.hpp>
16
17#include <boost/mpl/equal_to.hpp>
18#include <boost/mpl/apply_wrap.hpp>
19#include <boost/mpl/assert.hpp>
20
21#include "test_case.hpp"
22
23BOOST_METAPARSE_TEST_CASE(accept_when)
24{
25 using boost::metaparse::is_error;
26 using boost::metaparse::accept_when;
27 using boost::metaparse::one_char;
28 using boost::metaparse::start;
29 using boost::metaparse::get_result;
30
31 using boost::metaparse::util::is_digit;
32
33 using boost::mpl::apply;
34 using boost::mpl::equal_to;
35 using boost::mpl::apply_wrap2;
36
37 // test_with_text
38 BOOST_MPL_ASSERT((
39 is_error<
40 apply_wrap2<
41 accept_when<one_char, is_digit<>, test_failure>,
42 str_hello,
43 start
44 >
45 >
46 ));
47
48 // test_with_number
49 BOOST_MPL_ASSERT((
50 equal_to<
51 get_result<
52 apply_wrap2<
53 accept_when<one_char, is_digit<>, test_failure>,
54 str_1983,
55 start
56 >
57 >::type,
58 char_1
59 >
60 ));
61
62 // test_with_empty_string
63 BOOST_MPL_ASSERT((
64 is_error<
65 apply_wrap2<accept_when<one_char, is_digit<>, test_failure>, str_, start>
66 >
67 ));
68}
69