1///////////////////////////////////////////////////////////////////////////////
2// test1.h
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 "test1"
26 , L("foobarboo")
27 , regex_type(as_xpr(L("foo")))
28 , backrefs(L("foo"), nilbr)
29 )
30 , xpr_test_case
31 (
32 "test2"
33 , L("foobarboo")
34 , regex_type(as_xpr(L("bar")))
35 , backrefs(L("bar"), nilbr)
36 )
37 , xpr_test_case
38 (
39 "test3"
40 , L("foobarboo")
41 , regex_type(as_xpr(L("bat")))
42 , no_match
43 )
44 , xpr_test_case
45 (
46 "test4"
47 , L("foobarboo")
48 , regex_type(L('b') >> *_ >> L("ar"))
49 , backrefs(L("bar"), nilbr)
50 )
51 , xpr_test_case
52 (
53 "test5"
54 , L("foobarboo")
55 , regex_type(L('b') >> *_ >> L('r'))
56 , backrefs(L("bar"), nilbr)
57 )
58 , xpr_test_case
59 (
60 "test6"
61 , L("foobarboo")
62 , regex_type(L('b') >> *_ >> L('b'))
63 , backrefs(L("barb"), nilbr)
64 )
65 , xpr_test_case
66 (
67 "test7"
68 , L("foobarboo")
69 , regex_type(L('b') >> *_ >> L('o'))
70 , backrefs(L("barboo"), nilbr)
71 )
72 , xpr_test_case
73 (
74 "test8"
75 , L("foobarboo")
76 , regex_type(L('b') >> *_ >> L("oo"))
77 , backrefs(L("barboo"), nilbr)
78 )
79 , xpr_test_case
80 (
81 "test9"
82 , L("foobarboo")
83 , regex_type(L('b') >> +_ >> L("ar"))
84 , no_match
85 )
86 , xpr_test_case
87 (
88 "test10"
89 , L("foobarboo")
90 , regex_type(L('b') >> +_ >> L('r'))
91 , backrefs(L("bar"), nilbr)
92 )
93 , xpr_test_case
94 (
95 "test11"
96 , L("foobarboo")
97 , regex_type(L('b') >> +_ >> L('b'))
98 , backrefs(L("barb"), nilbr)
99 )
100 , xpr_test_case
101 (
102 "test12"
103 , L("foobarboo")
104 , regex_type(L('b') >> +_ >> L('o'))
105 , backrefs(L("barboo"), nilbr)
106 )
107 , xpr_test_case
108 (
109 "test13"
110 , L("foobarboo")
111 , regex_type(L('b') >> +_ >> L("oo"))
112 , backrefs(L("barboo"), nilbr)
113 )
114 , xpr_test_case
115 (
116 "test14"
117 , L("foobarboo")
118 , regex_type(bos >> L("foo"))
119 , backrefs(L("foo"), nilbr)
120 )
121 , xpr_test_case
122 (
123 "test15"
124 , L("foobarboo")
125 , regex_type(bos >> L('b') >> *_ >> L("ar"))
126 , no_match
127 )
128 , xpr_test_case
129 (
130 "test15.1"
131 , L("fOo")
132 , regex_type(!icase(L('f') >> *as_xpr(L('o'))))
133 , backrefs(L("fOo"), nilbr)
134 )
135 };
136
137 return boost::make_iterator_range(test_cases);
138}
139
140

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