1///////////////////////////////////////////////////////////////////////////////
2// test5.hpp
3//
4// Copyright 2008 Eric Niebler. Distributed under the Boost
5// Software License, Version 1.0. (See accompanying file
6// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8#include "./test.hpp"
9
10///////////////////////////////////////////////////////////////////////////////
11// get_test_cases
12//
13template<typename BidiIterT>
14boost::iterator_range<xpr_test_case<BidiIterT> const *> get_test_cases()
15{
16 typedef typename boost::iterator_value<BidiIterT>::type char_type;
17 typedef xpr_test_case<BidiIterT> xpr_test_case;
18 typedef basic_regex<BidiIterT> regex_type;
19
20 static char_type const *nilbr = 0;
21 static xpr_test_case const test_cases[] =
22 {
23 xpr_test_case
24 (
25 "test82"
26 , L("abba1234abba")
27 , regex_type(+_d)
28 , backrefs(L("1234"), nilbr)
29 )
30 , xpr_test_case
31 (
32 "test83"
33 , L("1234abba1234")
34 , regex_type(+~_d)
35 , backrefs(L("abba"), nilbr)
36 )
37 , xpr_test_case
38 (
39 "test84"
40 , L("abba1234abba")
41 , regex_type(+set[_d])
42 , backrefs(L("1234"), nilbr)
43 )
44 , xpr_test_case
45 (
46 "test85"
47 , L("1234abba1234")
48 , regex_type(+set[~_d])
49 , backrefs(L("abba"), nilbr)
50 )
51 , xpr_test_case
52 (
53 "test86"
54 , L("abba1234abba")
55 , regex_type(+~set[~_d])
56 , backrefs(L("1234"), nilbr)
57 )
58 , xpr_test_case
59 (
60 "test87"
61 , L("1234abba1234")
62 , regex_type(+~set[_d])
63 , backrefs(L("abba"), nilbr)
64 )
65 , xpr_test_case
66 (
67 "test88"
68 , L("1234abba1234")
69 , regex_type(+set[~_w | ~_d])
70 , backrefs(L("abba"), nilbr)
71 )
72 , xpr_test_case
73 (
74 "test89"
75 , L("1234(.;)abba")
76 , regex_type(+~set[_w | _d])
77 , backrefs(L("(.;)"), nilbr)
78 )
79 , xpr_test_case
80 (
81 "test90"
82 , L("(boo[bar]baz)")
83 , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
84 , backrefs(L("(boo[bar]baz)"), L("("), L(""), L(""), L(")"), nilbr)
85 )
86 , xpr_test_case
87 (
88 "test91"
89 , L("[boo(bar)baz]")
90 , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
91 , backrefs(L("[boo(bar)baz]"), L("["), L(""), L(""), L("]"), nilbr)
92 )
93 , xpr_test_case
94 (
95 "test91"
96 , L("[boo[bar]baz]")
97 , regex_type((s1= L('(') >> (s2= nil) | L('[') >> (s3= nil)) >> -*_ >> (s4= L(')') >> s2 | L(']') >> s3))
98 , backrefs(L("[boo[bar]"), L("["), L(""), L(""), L("]"), nilbr)
99 )
100 , xpr_test_case
101 (
102 "test92"
103 , L("foobarfoo")
104 , regex_type(after(L("foo")) >> L("bar"))
105 , backrefs(L("bar"), nilbr)
106 )
107 , xpr_test_case
108 (
109 "test93"
110 , L("foobarfoo")
111 , regex_type(after(s1= L('f') >> _ >> L('o')) >> L("bar"))
112 , backrefs(L("bar"), L("foo"), nilbr)
113 )
114 , xpr_test_case
115 (
116 "test94"
117 , L("foOoo")
118 , regex_type(icase(after(s1= L("fo")) >> L('o')))
119 , backrefs(L("O"), L("fo"), nilbr)
120 )
121 , xpr_test_case
122 (
123 "test95"
124 , L("fOooo")
125 , regex_type(icase(~after(s1= L("fo")) >> L('o')))
126 , backrefs(L("O"), L(""), nilbr)
127 )
128 , xpr_test_case
129 (
130 "test96"
131 , L("12foo12")
132 , regex_type(+alpha)
133 , backrefs(L("foo"), nilbr)
134 )
135 , xpr_test_case
136 (
137 "test97"
138 , L(";12foo12;")
139 , regex_type(+set[alpha | digit])
140 , backrefs(L("12foo12"), nilbr)
141 )
142 , xpr_test_case
143 (
144 "test98"
145 , L("aaaa")
146 , regex_type(after(expr: s1= nil) >> L('a'))
147 , backrefs(L("a"), L(""), nilbr)
148 )
149 , xpr_test_case
150 (
151 "test99"
152 , L("ABCabc123foo")
153 , regex_type(after(s1= L("abc") >> repeat<3>(expr2: _d)) >> L("foo"))
154 , backrefs(L("foo"), L("abc123"), nilbr)
155 )
156 };
157
158 return boost::make_iterator_range(test_cases);
159}
160

source code of boost/libs/xpressive/test/test5.hpp