Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/xpressive/test/test5.hpp @ 69

Last change on this file since 69 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 4.3 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2// test5.hpp
3//
4//  Copyright 2004 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<test_case<BidiIterT> const *> get_test_cases()
15{
16    typedef typename boost::iterator_value<BidiIterT>::type char_type;
17    typedef test_case<BidiIterT> test_case;
18    typedef basic_regex<BidiIterT> regex_type;
19
20    static char_type const *nilbr = 0;
21    static test_case const test_cases[] =
22    {
23        test_case
24        (
25            "test82"
26          , L("abba1234abba")
27          , regex_type(+_d)
28          , backrefs(L("1234"), nilbr)
29        )
30      , test_case
31        (
32            "test83"
33          , L("1234abba1234")
34          , regex_type(+~_d)
35          , backrefs(L("abba"), nilbr)
36        )
37      , test_case
38        (
39            "test84"
40          , L("abba1234abba")
41          , regex_type(+set[_d])
42          , backrefs(L("1234"), nilbr)
43        )
44      , test_case
45        (
46            "test85"
47          , L("1234abba1234")
48          , regex_type(+set[~_d])
49          , backrefs(L("abba"), nilbr)
50        )
51      , test_case
52        (
53            "test86"
54          , L("abba1234abba")
55          , regex_type(+~set[~_d])
56          , backrefs(L("1234"), nilbr)
57        )
58      , test_case
59        (
60            "test87"
61          , L("1234abba1234")
62          , regex_type(+~set[_d])
63          , backrefs(L("abba"), nilbr)
64        )
65      , test_case
66        (
67            "test88"
68          , L("1234abba1234")
69          , regex_type(+set[~_w | ~_d])
70          , backrefs(L("abba"), nilbr)
71        )
72      , test_case
73        (
74            "test89"
75          , L("1234(.;)abba")
76          , regex_type(+~set[_w | _d])
77          , backrefs(L("(.;)"), nilbr)
78        )
79      , 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      , 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      , 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      , test_case
101        (
102            "test92"
103          , L("foobarfoo")
104          , regex_type(after(L("foo")) >> L("bar"))
105          , backrefs(L("bar"), nilbr)
106        )
107      , 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      , 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      , 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      , test_case
129        (
130            "test96"
131          , L("12foo12")
132          , regex_type(+alpha)
133          , backrefs(L("foo"), nilbr)
134        )
135      , test_case
136        (
137            "test97"
138          , L(";12foo12;")
139          , regex_type(+set[alpha | digit])
140          , backrefs(L("12foo12"), nilbr)
141        )
142      , test_case
143        (
144            "test98"
145          , L("aaaa")
146          , regex_type(after(s1= nil) >> L('a'))
147          , backrefs(L("a"), L(""), nilbr)
148        )
149      , test_case
150        (
151            "test99"
152          , L("ABCabc123foo")
153          , regex_type(after(s1= L("abc") >> repeat<3>(_d)) >> L("foo"))
154          , backrefs(L("foo"), L("abc123"), nilbr)
155        )
156    };
157
158    return boost::make_iterator_range(test_cases);
159}
Note: See TracBrowser for help on using the repository browser.