1 ///////////////////////////////////////////////////////////////////////////////
2 // test7.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 //
13 template<typename BidiIterT>
get_test_cases()14 boost::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             "test127"
26           , L("foobar")
27           , regex_type(as_xpr(L("foo")) >> /*This is a comment[*/ L("bar"))
28           , backrefs(L("foobar"), nilbr)
29         )
30       , xpr_test_case
31         (
32             "test128"
33           , L("foobar")
34           , regex_type(bos >> L("foobar") >> eos)
35           , backrefs(L("foobar"), nilbr)
36         )
37       , xpr_test_case
38         (
39             "test129"
40           , L("foobar")
41           , regex_type(bos >> L('f') >> *as_xpr(L('o')))
42           , backrefs(L("foo"), nilbr)
43         )
44       , xpr_test_case
45         (
46             "test129.1"
47           , L("foobar")
48           , regex_type(bos >> L('f') >> *as_xpr(L('\157')))
49           , backrefs(L("foo"), nilbr)
50         )
51       , xpr_test_case
52         (
53             "test130"
54           , L("foo bar")
55           , regex_type(bos >> L("foo bar") >> eos)
56           , backrefs(L("foo bar"), nilbr)
57         )
58       , xpr_test_case
59         (
60             "test131"
61           , L("foo bar")
62           , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") >> eos)
63           , backrefs(L("foo bar"), nilbr)
64         )
65       , xpr_test_case
66         (
67             "test132"
68           , L("foo bar")
69           , regex_type(bos >> (L("foo") >> set[L(' ')] >> L("bar")) >> eos /*This is a comment*/)
70           , backrefs(L("foo bar"), nilbr)
71         )
72       , xpr_test_case
73         (
74             "test133"
75           , L("foo bar")
76           , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar") /*This is a comment*/)
77           , backrefs(L("foo bar"), nilbr)
78         )
79       , xpr_test_case
80         (
81             "test134"
82           , L("foo bar#Thisisnotacomment")
83           , regex_type(bos >> L("foo") >> set[L(' ')] >> L("bar#Thisisnotacomment"))
84           , backrefs(L("foo bar#Thisisnotacomment"), nilbr)
85         )
86       , xpr_test_case
87         (
88             "test135"
89           , L("f oo b ar")
90           , regex_type(bos >> L("f oo b ar"))
91           , backrefs(L("f oo b ar"), nilbr)
92         )
93       , xpr_test_case
94         (
95             "test137"
96           , L("a--")
97           , regex_type(bos >> *(s1= optional(L('a'))) >> eos)
98           , no_match
99         )
100       , xpr_test_case
101         (
102             "test138"
103           , L("a--")
104           , regex_type(bos >> -*(s1= optional(L('a'))) >> eos)
105           , no_match
106         )
107       , xpr_test_case
108         (
109             "test139"
110           , L("bc")
111           , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
112           , backrefs(L("bc"), L(""), nilbr)
113         )
114       , xpr_test_case
115         (
116             "test140"
117           , L("bbc")
118           , regex_type(bos >> repeat<2>(s1= optional(L('b'))) >> L("bc") >> eos)
119           , backrefs(L("bbc"), L(""), nilbr)
120         )
121     };
122 
123     return boost::make_iterator_range(test_cases);
124 }
125