]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/metaparse/test/repeated1_test.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / test / repeated1_test.hpp
CommitLineData
7c673cae
FG
1// Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
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// This header file contains code that is reused by other cpp files
7
8#include <boost/metaparse/letter.hpp>
9#include <boost/metaparse/is_error.hpp>
10#include <boost/metaparse/start.hpp>
11#include <boost/metaparse/get_result.hpp>
12#include <boost/metaparse/always.hpp>
13#include <boost/metaparse/one_char.hpp>
14
15#include "common.hpp"
16
17#include <boost/mpl/equal_to.hpp>
18#include <boost/mpl/apply_wrap.hpp>
19#include <boost/mpl/equal.hpp>
20#include <boost/mpl/vector_c.hpp>
21#include <boost/mpl/vector.hpp>
22#include <boost/mpl/assert.hpp>
23
24#include "test_case.hpp"
25
26BOOST_METAPARSE_TEST_CASE(TEST_NAME)
27{
28 using boost::metaparse::get_result;
29 using boost::metaparse::letter;
30 using boost::metaparse::start;
31 using boost::metaparse::is_error;
32 using boost::metaparse::always;
33 using boost::metaparse::one_char;
34
35 using boost::mpl::equal;
36 using boost::mpl::apply_wrap2;
37 using boost::mpl::list;
38 using boost::mpl::vector_c;
39 using boost::mpl::vector;
40
41 typedef repeated1<letter> repeated1_letter;
42 typedef always<one_char, int> always_int;
43
44 // test_empty_input
45 BOOST_MPL_ASSERT((is_error<apply_wrap2<repeated1_letter, str_, start> >));
46
47 // test0
48 BOOST_MPL_ASSERT((is_error<apply_wrap2<repeated1_letter, chars0, start> >));
49
50 // test1
51 BOOST_MPL_ASSERT((
52 equal<
53 get_result<apply_wrap2<repeated1_letter, chars1, start> >::type,
54 vector_c<char, 'h'>
55 >
56 ));
57
58 // test2
59 BOOST_MPL_ASSERT((
60 equal<
61 get_result<apply_wrap2<repeated1_letter, chars2, start> >::type,
62 vector_c<char, 'h', 'e'>
63 >
64 ));
65
66 // test3
67 BOOST_MPL_ASSERT((
68 equal<
69 get_result<apply_wrap2<repeated1_letter, chars3, start> >::type,
70 vector_c<char, 'h', 'e', 'l'>
71 >
72 ));
73
74 // test4
75 BOOST_MPL_ASSERT((
76 equal<
77 get_result<apply_wrap2<repeated1_letter, chars4, start> >::type,
78 vector_c<char, 'h', 'e', 'l', 'l'>
79 >
80 ));
81
82 // test5
83 BOOST_MPL_ASSERT((
84 equal<
85 get_result<apply_wrap2<repeated1_letter, chars5, start> >::type,
86 vector_c<char, 'h', 'e', 'l', 'l', 'o'>
87 >
88 ));
89
90 // test_no_extra_evaluation
91 BOOST_MPL_ASSERT((
92 equal<
93 get_result<apply_wrap2<repeated1<always_int>, str_ca, start> >::type,
94 vector<int, int>
95 >
96 ));
97}
98
99