]> git.saurik.com Git - wxWidgets.git/blame - tests/regex/regex.inc
add mac theme -> rgb color conversion
[wxWidgets.git] / tests / regex / regex.inc
CommitLineData
e70833fb
VS
1/*
2 * Test data for wxRegEx (UTF-8 encoded)
3 *
0d95d20c 4 * Generated Sun Apr 25 15:30:23 2004 by regex.pl from the following files:
e70833fb
VS
5 *
6 * reg.test: Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
7 * wxreg.test: Copyright (c) 2004 Mike Wetherell.
8 *
9 * Test types:
10 * e compile error expected
11 * f match failure expected
12 * m successful match
13 * i successful match with -indices (used in checking things like
14 * nonparticipating subexpressions)
15 * p unsuccessful match with -indices (!!) (used in checking
16 * partial-match reporting)
17 *
18 * Flag characters:
19 * - no-op (placeholder)
20 * + provide fake xy equivalence class and ch collating element
21 * % force small state-set cache in matcher (to test cache replace)
22 * ^ beginning of string is not beginning of line
23 * $ end of string is not end of line
24 * * test is Unicode-specific, needs big character set
25 *
26 * & test as both ARE and BRE
27 * b BRE
28 * e ERE
29 * a turn advanced-features bit on (error unless ERE already)
30 * q literal string, no metacharacters at all
31 *
32 * i case-independent matching
33 * o ("opaque") no subexpression capture
34 * p newlines are half-magic, excluded from . and [^ only
35 * w newlines are half-magic, significant to ^ and $ only
36 * n newlines are fully magic, both effects
37 * x expanded RE syntax
38 * t incomplete-match reporting
39 *
40 * A backslash-_a_lphanumeric seen
41 * B ERE/ARE literal-_b_race heuristic used
42 * E backslash (_e_scape) seen within []
43 * H looka_h_ead constraint seen
44 * I _i_mpossible to match
45 * L _l_ocale-specific construct seen
46 * M unportable (_m_achine-specific) construct seen
47 * N RE can match empty (_n_ull) string
48 * P non-_P_OSIX construct seen
49 * Q {} _q_uantifier seen
50 * R back _r_eference seen
51 * S POSIX-un_s_pecified syntax seen
52 * T prefers shortest (_t_iny)
53 * U saw original-POSIX botch: unmatched right paren in ERE (_u_gh)
54 */
55
56
57/*
58 * 1 basic sanity checks
59 */
60
61class regextest_1 : public RegExTestSuite
62{
63public:
64 regextest_1() : RegExTestSuite("regex.1") { }
65 static Test *suite();
66};
67
68Test *regextest_1::suite()
69{
70 RegExTestSuite *suite = new regextest_1;
71
72 suite->add("m", "1", "&", "abc", "abc", "abc", NULL);
73 suite->add("f", "2", "&", "abc", "def", NULL);
74 suite->add("m", "3", "&", "abc", "xyabxabce", "abc", NULL);
75
76 return suite;
77}
78
79CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_1, "regex.1");
80
81
82/*
83 * 2 invalid option combinations
84 */
85
86class regextest_2 : public RegExTestSuite
87{
88public:
89 regextest_2() : RegExTestSuite("regex.2") { }
90 static Test *suite();
91};
92
93Test *regextest_2::suite()
94{
95 RegExTestSuite *suite = new regextest_2;
96
97 suite->add("e", "1", "qe", "a", "INVARG", NULL);
98 suite->add("e", "2", "qa", "a", "INVARG", NULL);
99 suite->add("e", "3", "qx", "a", "INVARG", NULL);
100 suite->add("e", "4", "qn", "a", "INVARG", NULL);
101 suite->add("e", "5", "ba", "a", "INVARG", NULL);
102
103 return suite;
104}
105
106CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_2, "regex.2");
107
108
109/*
110 * 3 basic syntax
111 */
112
113class regextest_3 : public RegExTestSuite
114{
115public:
116 regextest_3() : RegExTestSuite("regex.3") { }
117 static Test *suite();
118};
119
120Test *regextest_3::suite()
121{
122 RegExTestSuite *suite = new regextest_3;
123
124 suite->add("i", "1", "&NS", "", "a", "0 -1", NULL);
125 suite->add("m", "2", "NS", "a|", "a", "a", NULL);
126 suite->add("m", "3", "-", "a|b", "a", "a", NULL);
127 suite->add("m", "4", "-", "a|b", "b", "b", NULL);
128 suite->add("m", "5", "NS", "a||b", "b", "b", NULL);
129 suite->add("m", "6", "&", "ab", "ab", "ab", NULL);
130
131 return suite;
132}
133
134CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_3, "regex.3");
135
136
137/*
138 * 4 parentheses
139 */
140
141class regextest_4 : public RegExTestSuite
142{
143public:
144 regextest_4() : RegExTestSuite("regex.4") { }
145 static Test *suite();
146};
147
148Test *regextest_4::suite()
149{
150 RegExTestSuite *suite = new regextest_4;
151
152 suite->add("m", "1", "-", "(a)e", "ae", "ae", "a", NULL);
153 suite->add("m", "2", "o", "(a)e", "ae", NULL);
154 suite->add("m", "3", "b", "\\(a\\)b", "ab", "ab", "a", NULL);
155 suite->add("m", "4", "-", "a((b)c)", "abc", "abc", "bc", "b", NULL);
156 suite->add("m", "5", "-", "a(b)(c)", "abc", "abc", "b", "c", NULL);
157 suite->add("e", "6", "-", "a(b", "EPAREN", NULL);
158 suite->add("e", "7", "b", "a\\(b", "EPAREN", NULL);
159 suite->add("m", "8", "eU", "a)b", "a)b", "a)b", NULL);
160 suite->add("e", "9", "-", "a)b", "EPAREN", NULL);
161 suite->add("e", "10", "b", "a\\)b", "EPAREN", NULL);
162 suite->add("m", "11", "P", "a(?:b)c", "abc", "abc", NULL);
163 suite->add("e", "12", "e", "a(?:b)c", "BADRPT", NULL);
164 suite->add("i", "13", "S", "a()b", "ab", "0 1", "1 0", NULL);
165 suite->add("m", "14", "SP", "a(?:)b", "ab", "ab", NULL);
166 suite->add("i", "15", "S", "a(|b)c", "ac", "0 1", "1 0", NULL);
167 suite->add("m", "16", "S", "a(b|)c", "abc", "abc", "b", NULL);
168
169 return suite;
170}
171
172CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_4, "regex.4");
173
174
175/*
176 * 5 simple one-char matching
177 */
178
179class regextest_5 : public RegExTestSuite
180{
181public:
182 regextest_5() : RegExTestSuite("regex.5") { }
183 static Test *suite();
184};
185
186Test *regextest_5::suite()
187{
188 RegExTestSuite *suite = new regextest_5;
189
190 suite->add("m", "1", "&", "a.b", "axb", "axb", NULL);
191 suite->add("f", "2", "&n", "a.b", "a\nb", NULL);
192 suite->add("m", "3", "&", "a[bc]d", "abd", "abd", NULL);
193 suite->add("m", "4", "&", "a[bc]d", "acd", "acd", NULL);
194 suite->add("f", "5", "&", "a[bc]d", "aed", NULL);
195 suite->add("f", "6", "&", "a[^bc]d", "abd", NULL);
196 suite->add("m", "7", "&", "a[^bc]d", "aed", "aed", NULL);
197 suite->add("f", "8", "&p", "a[^bc]d", "a\nd", NULL);
198
199 return suite;
200}
201
202CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_5, "regex.5");
203
204
205/*
206 * 6 context-dependent syntax
207 */
208
209class regextest_6 : public RegExTestSuite
210{
211public:
212 regextest_6() : RegExTestSuite("regex.6") { }
213 static Test *suite();
214};
215
216Test *regextest_6::suite()
217{
218 RegExTestSuite *suite = new regextest_6;
219
220 suite->add("e", "1", "-", "*", "BADRPT", NULL);
221 suite->add("m", "2", "b", "*", "*", "*", NULL);
222 suite->add("m", "3", "b", "\\(*\\)", "*", "*", "*", NULL);
223 suite->add("e", "4", "-", "(*)", "BADRPT", NULL);
224 suite->add("m", "5", "b", "^*", "*", "*", NULL);
225 suite->add("e", "6", "-", "^*", "BADRPT", NULL);
226 suite->add("f", "7", "&", "^b", "^b", NULL);
227 suite->add("m", "8", "b", "x^", "x^", "x^", NULL);
228 suite->add("f", "9", "I", "x^", "x", NULL);
229 suite->add("m", "10", "n", "\n^", "x\nb", "\n", NULL);
230 suite->add("f", "11", "bS", "\\(^b\\)", "^b", NULL);
231 suite->add("m", "12", "-", "(^b)", "b", "b", "b", NULL);
232 suite->add("m", "13", "&", "x$", "x", "x", NULL);
233 suite->add("m", "14", "bS", "\\(x$\\)", "x", "x", "x", NULL);
234 suite->add("m", "15", "-", "(x$)", "x", "x", "x", NULL);
235 suite->add("m", "16", "b", "x$y", "x$y", "x$y", NULL);
236 suite->add("f", "17", "I", "x$y", "xy", NULL);
237 suite->add("m", "18", "n", "x$\n", "x\n", "x\n", NULL);
238 suite->add("e", "19", "-", "+", "BADRPT", NULL);
239 suite->add("e", "20", "-", "?", "BADRPT", NULL);
240
241 return suite;
242}
243
244CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_6, "regex.6");
245
246
247/*
248 * 7 simple quantifiers
249 */
250
251class regextest_7 : public RegExTestSuite
252{
253public:
254 regextest_7() : RegExTestSuite("regex.7") { }
255 static Test *suite();
256};
257
258Test *regextest_7::suite()
259{
260 RegExTestSuite *suite = new regextest_7;
261
262 suite->add("m", "1", "&N", "a*", "aa", "aa", NULL);
263 suite->add("i", "2", "&N", "a*", "b", "0 -1", NULL);
264 suite->add("m", "3", "-", "a+", "aa", "aa", NULL);
265 suite->add("m", "4", "-", "a?b", "ab", "ab", NULL);
266 suite->add("m", "5", "-", "a?b", "b", "b", NULL);
267 suite->add("e", "6", "-", "**", "BADRPT", NULL);
268 suite->add("m", "7", "bN", "**", "***", "***", NULL);
269 suite->add("e", "8", "&", "a**", "BADRPT", NULL);
270 suite->add("e", "9", "&", "a**b", "BADRPT", NULL);
271 suite->add("e", "10", "&", "***", "BADRPT", NULL);
272 suite->add("e", "11", "-", "a++", "BADRPT", NULL);
273 suite->add("e", "12", "-", "a?+", "BADRPT", NULL);
274 suite->add("e", "13", "-", "a?*", "BADRPT", NULL);
275 suite->add("e", "14", "-", "a+*", "BADRPT", NULL);
276 suite->add("e", "15", "-", "a*+", "BADRPT", NULL);
277
278 return suite;
279}
280
281CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_7, "regex.7");
282
283
284/*
285 * 8 braces
286 */
287
288class regextest_8 : public RegExTestSuite
289{
290public:
291 regextest_8() : RegExTestSuite("regex.8") { }
292 static Test *suite();
293};
294
295Test *regextest_8::suite()
296{
297 RegExTestSuite *suite = new regextest_8;
298
299 suite->add("m", "1", "NQ", "a{0,1}", "", "", NULL);
300 suite->add("m", "2", "NQ", "a{0,1}", "ac", "a", NULL);
301 suite->add("e", "3", "-", "a{1,0}", "BADBR", NULL);
302 suite->add("e", "4", "-", "a{1,2,3}", "BADBR", NULL);
303 suite->add("e", "5", "-", "a{257}", "BADBR", NULL);
304 suite->add("e", "6", "-", "a{1000}", "BADBR", NULL);
305 suite->add("e", "7", "-", "a{1", "EBRACE", NULL);
306 suite->add("e", "8", "-", "a{1n}", "BADBR", NULL);
307 suite->add("m", "9", "BS", "a{b", "a{b", "a{b", NULL);
308 suite->add("m", "10", "BS", "a{", "a{", "a{", NULL);
309 suite->add("m", "11", "bQ", "a\\{0,1\\}b", "cb", "b", NULL);
310 suite->add("e", "12", "b", "a\\{0,1", "EBRACE", NULL);
311 suite->add("e", "13", "-", "a{0,1\\", "BADBR", NULL);
312 suite->add("m", "14", "Q", "a{0}b", "ab", "b", NULL);
313 suite->add("m", "15", "Q", "a{0,0}b", "ab", "b", NULL);
314 suite->add("m", "16", "Q", "a{0,1}b", "ab", "ab", NULL);
315 suite->add("m", "17", "Q", "a{0,2}b", "b", "b", NULL);
316 suite->add("m", "18", "Q", "a{0,2}b", "aab", "aab", NULL);
317 suite->add("m", "19", "Q", "a{0,}b", "aab", "aab", NULL);
318 suite->add("m", "20", "Q", "a{1,1}b", "aab", "ab", NULL);
319 suite->add("m", "21", "Q", "a{1,3}b", "aaaab", "aaab", NULL);
320 suite->add("f", "22", "Q", "a{1,3}b", "b", NULL);
321 suite->add("m", "23", "Q", "a{1,}b", "aab", "aab", NULL);
322 suite->add("f", "24", "Q", "a{2,3}b", "ab", NULL);
323 suite->add("m", "25", "Q", "a{2,3}b", "aaaab", "aaab", NULL);
324 suite->add("f", "26", "Q", "a{2,}b", "ab", NULL);
325 suite->add("m", "27", "Q", "a{2,}b", "aaaab", "aaaab", NULL);
326
327 return suite;
328}
329
330CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_8, "regex.8");
331
332
333/*
334 * 9 brackets
335 */
336
337class regextest_9 : public RegExTestSuite
338{
339public:
340 regextest_9() : RegExTestSuite("regex.9") { }
341 static Test *suite();
342};
343
344Test *regextest_9::suite()
345{
346 RegExTestSuite *suite = new regextest_9;
347
348 suite->add("m", "1", "&", "a[bc]", "ac", "ac", NULL);
349 suite->add("m", "2", "&", "a[-]", "a-", "a-", NULL);
350 suite->add("m", "3", "&", "a[[.-.]]", "a-", "a-", NULL);
351 suite->add("m", "4", "&L", "a[[.zero.]]", "a0", "a0", NULL);
352 suite->add("m", "5", "&LM", "a[[.zero.]-9]", "a2", "a2", NULL);
353 suite->add("m", "6", "&M", "a[0-[.9.]]", "a2", "a2", NULL);
354 suite->add("m", "7", "&+L", "a[[=x=]]", "ax", "ax", NULL);
355 suite->add("m", "8", "&+L", "a[[=x=]]", "ay", "ay", NULL);
356 suite->add("f", "9", "&+L", "a[[=x=]]", "az", NULL);
357 suite->add("e", "10", "&", "a[0-[=x=]]", "ERANGE", NULL);
358 suite->add("m", "11", "&L", "a[[:digit:]]", "a0", "a0", NULL);
359 suite->add("e", "12", "&", "a[[:woopsie:]]", "ECTYPE", NULL);
360 suite->add("f", "13", "&L", "a[[:digit:]]", "ab", NULL);
361 suite->add("e", "14", "&", "a[0-[:digit:]]", "ERANGE", NULL);
362 suite->add("m", "15", "&LP", "[[:<:]]a", "a", "a", NULL);
363 suite->add("m", "16", "&LP", "a[[:>:]]", "a", "a", NULL);
364 suite->add("e", "17", "&", "a[[..]]b", "ECOLLATE", NULL);
365 suite->add("e", "18", "&", "a[[==]]b", "ECOLLATE", NULL);
366 suite->add("e", "19", "&", "a[[::]]b", "ECTYPE", NULL);
367 suite->add("e", "20", "&", "a[[.a", "EBRACK", NULL);
368 suite->add("e", "21", "&", "a[[=a", "EBRACK", NULL);
369 suite->add("e", "22", "&", "a[[:a", "EBRACK", NULL);
370 suite->add("e", "23", "&", "a[", "EBRACK", NULL);
371 suite->add("e", "24", "&", "a[b", "EBRACK", NULL);
372 suite->add("e", "25", "&", "a[b-", "EBRACK", NULL);
373 suite->add("e", "26", "&", "a[b-c", "EBRACK", NULL);
374 suite->add("m", "27", "&M", "a[b-c]", "ab", "ab", NULL);
375 suite->add("m", "28", "&", "a[b-b]", "ab", "ab", NULL);
376 suite->add("m", "29", "&M", "a[1-2]", "a2", "a2", NULL);
377 suite->add("e", "30", "&", "a[c-b]", "ERANGE", NULL);
378 suite->add("e", "31", "&", "a[a-b-c]", "ERANGE", NULL);
379 suite->add("m", "32", "&M", "a[--?]b", "a?b", "a?b", NULL);
380 suite->add("m", "33", "&", "a[---]b", "a-b", "a-b", NULL);
381 suite->add("m", "34", "&", "a[]b]c", "a]c", "a]c", NULL);
382 suite->add("m", "35", "EP", "a[\\]]b", "a]b", "a]b", NULL);
383 suite->add("f", "36", "bE", "a[\\]]b", "a]b", NULL);
384 suite->add("m", "37", "bE", "a[\\]]b", "a\\]b", "a\\]b", NULL);
385 suite->add("m", "38", "eE", "a[\\]]b", "a\\]b", "a\\]b", NULL);
386 suite->add("m", "39", "EP", "a[\\\\]b", "a\\b", "a\\b", NULL);
387 suite->add("m", "40", "eE", "a[\\\\]b", "a\\b", "a\\b", NULL);
388 suite->add("m", "41", "bE", "a[\\\\]b", "a\\b", "a\\b", NULL);
389 suite->add("e", "42", "-", "a[\\Z]b", "EESCAPE", NULL);
390 suite->add("m", "43", "&", "a[[b]c", "a[c", "a[c", NULL);
391 suite->add("m", "44", "EMP*", "a[\\u00fe-\\u0507][\\u00ff-\\u0300]b", "aĂ˿b", "aĂ˿b", NULL);
392
393 return suite;
394}
395
396CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_9, "regex.9");
397
398
399/*
400 * 10 anchors and newlines
401 */
402
403class regextest_10 : public RegExTestSuite
404{
405public:
406 regextest_10() : RegExTestSuite("regex.10") { }
407 static Test *suite();
408};
409
410Test *regextest_10::suite()
411{
412 RegExTestSuite *suite = new regextest_10;
413
414 suite->add("m", "1", "&", "^a", "a", "a", NULL);
415 suite->add("f", "2", "&^", "^a", "a", NULL);
416 suite->add("i", "3", "&N", "^", "a", "0 -1", NULL);
417 suite->add("i", "4", "&", "a$", "aba", "2 2", NULL);
418 suite->add("f", "5", "&$", "a$", "a", NULL);
419 suite->add("i", "6", "&N", "$", "ab", "2 1", NULL);
420 suite->add("m", "7", "&n", "^a", "a", "a", NULL);
421 suite->add("m", "8", "&n", "^a", "b\na", "a", NULL);
422 suite->add("i", "9", "&w", "^a", "a\na", "0 0", NULL);
423 suite->add("i", "10", "&n^", "^a", "a\na", "2 2", NULL);
424 suite->add("m", "11", "&n", "a$", "a", "a", NULL);
425 suite->add("m", "12", "&n", "a$", "a\nb", "a", NULL);
426 suite->add("i", "13", "&n", "a$", "a\na", "0 0", NULL);
427 suite->add("i", "14", "N", "^^", "a", "0 -1", NULL);
428 suite->add("m", "15", "b", "^^", "^", "^", NULL);
429 suite->add("i", "16", "N", "$$", "a", "1 0", NULL);
430 suite->add("m", "17", "b", "$$", "$", "$", NULL);
431 suite->add("m", "18", "&N", "^$", "", "", NULL);
432 suite->add("f", "19", "&N", "^$", "a", NULL);
433 suite->add("i", "20", "&nN", "^$", "a\n\nb", "2 1", NULL);
434 suite->add("m", "21", "N", "$^", "", "", NULL);
435 suite->add("m", "22", "b", "$^", "$^", "$^", NULL);
436 suite->add("m", "23", "P", "\\Aa", "a", "a", NULL);
437 suite->add("m", "24", "^P", "\\Aa", "a", "a", NULL);
438 suite->add("f", "25", "^nP", "\\Aa", "b\na", NULL);
439 suite->add("m", "26", "P", "a\\Z", "a", "a", NULL);
440 suite->add("m", "27", "$P", "a\\Z", "a", "a", NULL);
441 suite->add("f", "28", "$nP", "a\\Z", "a\nb", NULL);
442 suite->add("e", "29", "-", "^*", "BADRPT", NULL);
443 suite->add("e", "30", "-", "$*", "BADRPT", NULL);
444 suite->add("e", "31", "-", "\\A*", "BADRPT", NULL);
445 suite->add("e", "32", "-", "\\Z*", "BADRPT", NULL);
446
447 return suite;
448}
449
450CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_10, "regex.10");
451
452
453/*
454 * 11 boundary constraints
455 */
456
457class regextest_11 : public RegExTestSuite
458{
459public:
460 regextest_11() : RegExTestSuite("regex.11") { }
461 static Test *suite();
462};
463
464Test *regextest_11::suite()
465{
466 RegExTestSuite *suite = new regextest_11;
467
468 suite->add("m", "1", "&LP", "[[:<:]]a", "a", "a", NULL);
469 suite->add("m", "2", "&LP", "[[:<:]]a", "-a", "a", NULL);
470 suite->add("f", "3", "&LP", "[[:<:]]a", "ba", NULL);
471 suite->add("m", "4", "&LP", "a[[:>:]]", "a", "a", NULL);
472 suite->add("m", "5", "&LP", "a[[:>:]]", "a-", "a", NULL);
473 suite->add("f", "6", "&LP", "a[[:>:]]", "ab", NULL);
474 suite->add("m", "7", "bLP", "\\<a", "a", "a", NULL);
475 suite->add("f", "8", "bLP", "\\<a", "ba", NULL);
476 suite->add("m", "9", "bLP", "a\\>", "a", "a", NULL);
477 suite->add("f", "10", "bLP", "a\\>", "ab", NULL);
478 suite->add("m", "11", "LP", "\\ya", "a", "a", NULL);
479 suite->add("f", "12", "LP", "\\ya", "ba", NULL);
480 suite->add("m", "13", "LP", "a\\y", "a", "a", NULL);
481 suite->add("f", "14", "LP", "a\\y", "ab", NULL);
482 suite->add("m", "15", "LP", "a\\Y", "ab", "a", NULL);
483 suite->add("f", "16", "LP", "a\\Y", "a-", NULL);
484 suite->add("f", "17", "LP", "a\\Y", "a", NULL);
485 suite->add("f", "18", "LP", "-\\Y", "-a", NULL);
486 suite->add("m", "19", "LP", "-\\Y", "-%", "-", NULL);
487 suite->add("f", "20", "LP", "\\Y-", "a-", NULL);
488 suite->add("e", "21", "-", "[[:<:]]*", "BADRPT", NULL);
489 suite->add("e", "22", "-", "[[:>:]]*", "BADRPT", NULL);
490 suite->add("e", "23", "b", "\\<*", "BADRPT", NULL);
491 suite->add("e", "24", "b", "\\>*", "BADRPT", NULL);
492 suite->add("e", "25", "-", "\\y*", "BADRPT", NULL);
493 suite->add("e", "26", "-", "\\Y*", "BADRPT", NULL);
494 suite->add("m", "27", "LP", "\\ma", "a", "a", NULL);
495 suite->add("f", "28", "LP", "\\ma", "ba", NULL);
496 suite->add("m", "29", "LP", "a\\M", "a", "a", NULL);
497 suite->add("f", "30", "LP", "a\\M", "ab", NULL);
498 suite->add("f", "31", "ILP", "\\Ma", "a", NULL);
499 suite->add("f", "32", "ILP", "a\\m", "a", NULL);
500
501 return suite;
502}
503
504CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_11, "regex.11");
505
506
507/*
508 * 12 character classes
509 */
510
511class regextest_12 : public RegExTestSuite
512{
513public:
514 regextest_12() : RegExTestSuite("regex.12") { }
515 static Test *suite();
516};
517
518Test *regextest_12::suite()
519{
520 RegExTestSuite *suite = new regextest_12;
521
522 suite->add("m", "1", "LP", "a\\db", "a0b", "a0b", NULL);
523 suite->add("f", "2", "LP", "a\\db", "axb", NULL);
524 suite->add("f", "3", "LP", "a\\Db", "a0b", NULL);
525 suite->add("m", "4", "LP", "a\\Db", "axb", "axb", NULL);
526 suite->add("m", "5", "LP", "a\\sb", "a b", "a b", NULL);
527 suite->add("m", "6", "LP", "a\\sb", "a\tb", "a\tb", NULL);
528 suite->add("m", "7", "LP", "a\\sb", "a\nb", "a\nb", NULL);
529 suite->add("f", "8", "LP", "a\\sb", "axb", NULL);
530 suite->add("m", "9", "LP", "a\\Sb", "axb", "axb", NULL);
531 suite->add("f", "10", "LP", "a\\Sb", "a b", NULL);
532 suite->add("m", "11", "LP", "a\\wb", "axb", "axb", NULL);
533 suite->add("f", "12", "LP", "a\\wb", "a-b", NULL);
534 suite->add("f", "13", "LP", "a\\Wb", "axb", NULL);
535 suite->add("m", "14", "LP", "a\\Wb", "a-b", "a-b", NULL);
536 suite->add("m", "15", "LP", "\\y\\w+z\\y", "adze-guz", "guz", NULL);
537 suite->add("m", "16", "LPE", "a[\\d]b", "a1b", "a1b", NULL);
538 suite->add("m", "17", "LPE", "a[\\s]b", "a b", "a b", NULL);
539 suite->add("m", "18", "LPE", "a[\\w]b", "axb", "axb", NULL);
540
541 return suite;
542}
543
544CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_12, "regex.12");
545
546
547/*
548 * 13 escapes
549 */
550
551class regextest_13 : public RegExTestSuite
552{
553public:
554 regextest_13() : RegExTestSuite("regex.13") { }
555 static Test *suite();
556};
557
558Test *regextest_13::suite()
559{
560 RegExTestSuite *suite = new regextest_13;
561
562 suite->add("e", "1", "&", "a\\", "EESCAPE", NULL);
563 suite->add("m", "2", "-", "a\\<b", "a<b", "a<b", NULL);
564 suite->add("m", "3", "e", "a\\<b", "a<b", "a<b", NULL);
565 suite->add("m", "4", "bAS", "a\\wb", "awb", "awb", NULL);
566 suite->add("m", "5", "eAS", "a\\wb", "awb", "awb", NULL);
567 suite->add("m", "6", "PL", "a\\ab", "a\ab", "a\ab", NULL);
568 suite->add("m", "7", "P", "a\\bb", "a\bb", "a\bb", NULL);
569 suite->add("m", "8", "P", "a\\Bb", "a\\b", "a\\b", NULL);
570 suite->add("m", "9", "MP", "a\\chb", "a\bb", "a\bb", NULL);
571 suite->add("m", "10", "MP", "a\\cHb", "a\bb", "a\bb", NULL);
572 suite->add("m", "11", "LMP", "a\\e", "a\033", "a\033", NULL);
573 suite->add("m", "12", "P", "a\\fb", "a\fb", "a\fb", NULL);
574 suite->add("m", "13", "P", "a\\nb", "a\nb", "a\nb", NULL);
575 suite->add("m", "14", "P", "a\\rb", "a\rb", "a\rb", NULL);
576 suite->add("m", "15", "P", "a\\tb", "a\tb", "a\tb", NULL);
577 suite->add("m", "16", "P", "a\\u0008x", "a\bx", "a\bx", NULL);
578 suite->add("e", "17", "-", "a\\u008x", "EESCAPE", NULL);
579 suite->add("m", "18", "P", "a\\u00088x", "a\b8x", "a\b8x", NULL);
580 suite->add("m", "19", "P", "a\\U00000008x", "a\bx", "a\bx", NULL);
581 suite->add("e", "20", "-", "a\\U0000008x", "EESCAPE", NULL);
582 suite->add("m", "21", "P", "a\\vb", "a\vb", "a\vb", NULL);
583 suite->add("m", "22", "MP", "a\\x08x", "a\bx", "a\bx", NULL);
584 suite->add("e", "23", "-", "a\\xq", "EESCAPE", NULL);
585 suite->add("m", "24", "MP", "a\\x0008x", "a\bx", "a\bx", NULL);
586 suite->add("e", "25", "-", "a\\z", "EESCAPE", NULL);
587 suite->add("m", "26", "MP", "a\\010b", "a\bb", "a\bb", NULL);
588
589 return suite;
590}
591
592CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_13, "regex.13");
593
594
595/*
596 * 14 back references
597 */
598
599class regextest_14 : public RegExTestSuite
600{
601public:
602 regextest_14() : RegExTestSuite("regex.14") { }
603 static Test *suite();
604};
605
606Test *regextest_14::suite()
607{
608 RegExTestSuite *suite = new regextest_14;
609
610 suite->add("m", "1", "RP", "a(b*)c\\1", "abbcbb", "abbcbb", "bb", NULL);
611 suite->add("m", "2", "RP", "a(b*)c\\1", "ac", "ac", "", NULL);
612 suite->add("f", "3", "RP", "a(b*)c\\1", "abbcb", NULL);
613 suite->add("m", "4", "RP", "a(b*)\\1", "abbcbb", "abb", "b", NULL);
614 suite->add("m", "5", "RP", "a(b|bb)\\1", "abbcbb", "abb", "b", NULL);
615 suite->add("m", "6", "RP", "a([bc])\\1", "abb", "abb", "b", NULL);
616 suite->add("f", "7", "RP", "a([bc])\\1", "abc", NULL);
617 suite->add("m", "8", "RP", "a([bc])\\1", "abcabb", "abb", "b", NULL);
618 suite->add("f", "9", "RP", "a([bc])*\\1", "abc", NULL);
619 suite->add("f", "10", "RP", "a([bc])\\1", "abB", NULL);
620 suite->add("m", "11", "iRP", "a([bc])\\1", "abB", "abB", "b", NULL);
621 suite->add("m", "12", "RP", "a([bc])\\1+", "abbb", "abbb", "b", NULL);
622 suite->add("m", "13", "QRP", "a([bc])\\1{3,4}", "abbbb", "abbbb", "b", NULL);
623 suite->add("f", "14", "QRP", "a([bc])\\1{3,4}", "abbb", NULL);
624 suite->add("m", "15", "RP", "a([bc])\\1*", "abbb", "abbb", "b", NULL);
625 suite->add("m", "16", "RP", "a([bc])\\1*", "ab", "ab", "b", NULL);
626 suite->add("m", "17", "RP", "a([bc])(\\1*)", "ab", "ab", "b", "", NULL);
627 suite->add("e", "18", "-", "a((b)\\1)", "ESUBREG", NULL);
628 suite->add("e", "19", "-", "a(b)c\\2", "ESUBREG", NULL);
629 suite->add("m", "20", "bR", "a\\(b*\\)c\\1", "abbcbb", "abbcbb", "bb", NULL);
630
631 return suite;
632}
633
634CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_14, "regex.14");
635
636
637/*
638 * 15 octal escapes vs back references
639 */
640
641class regextest_15 : public RegExTestSuite
642{
643public:
644 regextest_15() : RegExTestSuite("regex.15") { }
645 static Test *suite();
646};
647
648Test *regextest_15::suite()
649{
650 RegExTestSuite *suite = new regextest_15;
651
652 suite->add("m", "1", "MP", "a\\010b", "a\bb", "a\bb", NULL);
653 suite->add("m", "2", "MP", "a\\0070b", "a\a0b", "a\a0b", NULL);
654 suite->add("m", "3", "MP", "a\\07b", "a\ab", "a\ab", NULL);
655 suite->add("m", "4", "MP", "a(b)(b)(b)(b)(b)(b)(b)(b)(b)(b)\\07c", "abbbbbbbbbb\ac", "abbbbbbbbbb\ac", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", NULL);
656 suite->add("e", "5", "-", "a\\7b", "ESUBREG", NULL);
657 suite->add("m", "6", "MP", "a\\10b", "a\bb", "a\bb", NULL);
658 suite->add("m", "7", "MP", "a\\101b", "aAb", "aAb", NULL);
659 suite->add("m", "8", "RP", "a(b)(b)(b)(b)(b)(b)(b)(b)(b)(b)\\10c", "abbbbbbbbbbbc", "abbbbbbbbbbbc", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", NULL);
660 suite->add("e", "9", "-", "a((((((((((b\\10))))))))))c", "ESUBREG", NULL);
661 suite->add("m", "10", "MP", "a\\12b", "a\nb", "a\nb", NULL);
662 suite->add("e", "11", "b", "a\\12b", "ESUBREG", NULL);
663 suite->add("m", "12", "eAS", "a\\12b", "a12b", "a12b", NULL);
664
665 return suite;
666}
667
668CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_15, "regex.15");
669
670
671/*
672 * 16 expanded syntax
673 */
674
675class regextest_16 : public RegExTestSuite
676{
677public:
678 regextest_16() : RegExTestSuite("regex.16") { }
679 static Test *suite();
680};
681
682Test *regextest_16::suite()
683{
684 RegExTestSuite *suite = new regextest_16;
685
686 suite->add("m", "1", "xP", "a b c", "abc", "abc", NULL);
687 suite->add("m", "2", "xP", "a b #oops\nc\td", "abcd", "abcd", NULL);
688 suite->add("m", "3", "x", "a\\ b\\\tc", "a b\tc", "a b\tc", NULL);
689 suite->add("m", "4", "xP", "a b\\#c", "ab#c", "ab#c", NULL);
690 suite->add("m", "5", "xP", "a b[c d]e", "ab e", "ab e", NULL);
691 suite->add("m", "6", "xP", "a b[c#d]e", "ab#e", "ab#e", NULL);
692 suite->add("m", "7", "xP", "a b[c#d]e", "abde", "abde", NULL);
693 suite->add("m", "8", "xSPB", "ab{ d", "ab{d", "ab{d", NULL);
694 suite->add("m", "9", "xPQ", "ab{ 1 , 2 }c", "abc", "abc", NULL);
695
696 return suite;
697}
698
699CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_16, "regex.16");
700
701
702/*
703 * 17 misc syntax
704 */
705
706class regextest_17 : public RegExTestSuite
707{
708public:
709 regextest_17() : RegExTestSuite("regex.17") { }
710 static Test *suite();
711};
712
713Test *regextest_17::suite()
714{
715 RegExTestSuite *suite = new regextest_17;
716
717 suite->add("m", "1", "P", "a(?#comment)b", "ab", "ab", NULL);
718
719 return suite;
720}
721
722CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_17, "regex.17");
723
724
725/*
726 * 18 unmatchable REs
727 */
728
729class regextest_18 : public RegExTestSuite
730{
731public:
732 regextest_18() : RegExTestSuite("regex.18") { }
733 static Test *suite();
734};
735
736Test *regextest_18::suite()
737{
738 RegExTestSuite *suite = new regextest_18;
739
740 suite->add("f", "1", "I", "a^b", "ab", NULL);
741
742 return suite;
743}
744
745CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_18, "regex.18");
746
747
748/*
749 * 19 case independence
750 */
751
752class regextest_19 : public RegExTestSuite
753{
754public:
755 regextest_19() : RegExTestSuite("regex.19") { }
756 static Test *suite();
757};
758
759Test *regextest_19::suite()
760{
761 RegExTestSuite *suite = new regextest_19;
762
763 suite->add("m", "1", "&i", "ab", "Ab", "Ab", NULL);
764 suite->add("m", "2", "&i", "a[bc]", "aC", "aC", NULL);
765 suite->add("f", "3", "&i", "a[^bc]", "aB", NULL);
766 suite->add("m", "4", "&iM", "a[b-d]", "aC", "aC", NULL);
767 suite->add("f", "5", "&iM", "a[^b-d]", "aC", NULL);
768
769 return suite;
770}
771
772CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_19, "regex.19");
773
774
775/*
776 * 20 directors and embedded options
777 */
778
779class regextest_20 : public RegExTestSuite
780{
781public:
782 regextest_20() : RegExTestSuite("regex.20") { }
783 static Test *suite();
784};
785
786Test *regextest_20::suite()
787{
788 RegExTestSuite *suite = new regextest_20;
789
790 suite->add("e", "1", "&", "***?", "BADPAT", NULL);
791 suite->add("m", "2", "q", "***?", "***?", "***?", NULL);
792 suite->add("m", "3", "&P", "***=a*b", "a*b", "a*b", NULL);
793 suite->add("m", "4", "q", "***=a*b", "***=a*b", "***=a*b", NULL);
794 suite->add("m", "5", "bLP", "***:\\w+", "ab", "ab", NULL);
795 suite->add("m", "6", "eLP", "***:\\w+", "ab", "ab", NULL);
796 suite->add("e", "7", "&", "***:***=a*b", "BADRPT", NULL);
797 suite->add("m", "8", "&P", "***:(?b)a+b", "a+b", "a+b", NULL);
798 suite->add("m", "9", "P", "(?b)a+b", "a+b", "a+b", NULL);
799 suite->add("e", "10", "e", "(?b)\\w+", "BADRPT", NULL);
800 suite->add("m", "11", "bAS", "(?b)\\w+", "(?b)w+", "(?b)w+", NULL);
801 suite->add("m", "12", "iP", "(?c)a", "a", "a", NULL);
802 suite->add("f", "13", "iP", "(?c)a", "A", NULL);
803 suite->add("m", "14", "APS", "(?e)\\W+", "WW", "WW", NULL);
804 suite->add("m", "15", "P", "(?i)a+", "Aa", "Aa", NULL);
805 suite->add("f", "16", "P", "(?m)a.b", "a\nb", NULL);
806 suite->add("m", "17", "P", "(?m)^b", "a\nb", "b", NULL);
807 suite->add("f", "18", "P", "(?n)a.b", "a\nb", NULL);
808 suite->add("m", "19", "P", "(?n)^b", "a\nb", "b", NULL);
809 suite->add("f", "20", "P", "(?p)a.b", "a\nb", NULL);
810 suite->add("f", "21", "P", "(?p)^b", "a\nb", NULL);
811 suite->add("m", "22", "P", "(?q)a+b", "a+b", "a+b", NULL);
812 suite->add("m", "23", "nP", "(?s)a.b", "a\nb", "a\nb", NULL);
813 suite->add("m", "24", "xP", "(?t)a b", "a b", "a b", NULL);
814 suite->add("m", "25", "P", "(?w)a.b", "a\nb", "a\nb", NULL);
815 suite->add("m", "26", "P", "(?w)^b", "a\nb", "b", NULL);
816 suite->add("m", "27", "P", "(?x)a b", "ab", "ab", NULL);
817 suite->add("e", "28", "-", "(?z)ab", "BADOPT", NULL);
818 suite->add("m", "29", "P", "(?ici)a+", "Aa", "Aa", NULL);
819 suite->add("e", "30", "P", "(?i)(?q)a+", "BADRPT", NULL);
820 suite->add("m", "31", "P", "(?q)(?i)a+", "(?i)a+", "(?i)a+", NULL);
821 suite->add("m", "32", "P", "(?qe)a+", "a", "a", NULL);
822 suite->add("m", "33", "xP", "(?q)a b", "a b", "a b", NULL);
823 suite->add("m", "34", "P", "(?qx)a b", "a b", "a b", NULL);
824 suite->add("m", "35", "P", "(?qi)ab", "Ab", "Ab", NULL);
825
826 return suite;
827}
828
829CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_20, "regex.20");
830
831
832/*
833 * 21 capturing
834 */
835
836class regextest_21 : public RegExTestSuite
837{
838public:
839 regextest_21() : RegExTestSuite("regex.21") { }
840 static Test *suite();
841};
842
843Test *regextest_21::suite()
844{
845 RegExTestSuite *suite = new regextest_21;
846
847 suite->add("m", "1", "-", "a(b)c", "abc", "abc", "b", NULL);
848 suite->add("m", "2", "P", "a(?:b)c", "xabc", "abc", NULL);
849 suite->add("m", "3", "-", "a((b))c", "xabcy", "abc", "b", "b", NULL);
850 suite->add("m", "4", "P", "a(?:(b))c", "abcy", "abc", "b", NULL);
851 suite->add("m", "5", "P", "a((?:b))c", "abc", "abc", "b", NULL);
852 suite->add("m", "6", "P", "a(?:(?:b))c", "abc", "abc", NULL);
853 suite->add("i", "7", "Q", "a(b){0}c", "ac", "0 1", "-1 -1", NULL);
854 suite->add("m", "8", "-", "a(b)c(d)e", "abcde", "abcde", "b", "d", NULL);
855 suite->add("m", "9", "-", "(b)c(d)e", "bcde", "bcde", "b", "d", NULL);
856 suite->add("m", "10", "-", "a(b)(d)e", "abde", "abde", "b", "d", NULL);
857 suite->add("m", "11", "-", "a(b)c(d)", "abcd", "abcd", "b", "d", NULL);
858 suite->add("m", "12", "-", "(ab)(cd)", "xabcdy", "abcd", "ab", "cd", NULL);
859 suite->add("m", "13", "-", "a(b)?c", "xabcy", "abc", "b", NULL);
860 suite->add("i", "14", "-", "a(b)?c", "xacy", "1 2", "-1 -1", NULL);
861 suite->add("m", "15", "-", "a(b)?c(d)?e", "xabcdey", "abcde", "b", "d", NULL);
862 suite->add("i", "16", "-", "a(b)?c(d)?e", "xacdey", "1 4", "-1 -1", "3 3", NULL);
863 suite->add("i", "17", "-", "a(b)?c(d)?e", "xabcey", "1 4", "2 2", "-1 -1", NULL);
864 suite->add("i", "18", "-", "a(b)?c(d)?e", "xacey", "1 3", "-1 -1", "-1 -1", NULL);
865 suite->add("m", "19", "-", "a(b)*c", "xabcy", "abc", "b", NULL);
866 suite->add("i", "20", "-", "a(b)*c", "xabbbcy", "1 5", "4 4", NULL);
867 suite->add("i", "21", "-", "a(b)*c", "xacy", "1 2", "-1 -1", NULL);
868 suite->add("m", "22", "-", "a(b*)c", "xabbbcy", "abbbc", "bbb", NULL);
869 suite->add("m", "23", "-", "a(b*)c", "xacy", "ac", "", NULL);
870 suite->add("f", "24", "-", "a(b)+c", "xacy", NULL);
871 suite->add("m", "25", "-", "a(b)+c", "xabcy", "abc", "b", NULL);
872 suite->add("i", "26", "-", "a(b)+c", "xabbbcy", "1 5", "4 4", NULL);
873 suite->add("m", "27", "-", "a(b+)c", "xabbbcy", "abbbc", "bbb", NULL);
874 suite->add("i", "28", "Q", "a(b){2,3}c", "xabbbcy", "1 5", "4 4", NULL);
875 suite->add("i", "29", "Q", "a(b){2,3}c", "xabbcy", "1 4", "3 3", NULL);
876 suite->add("f", "30", "Q", "a(b){2,3}c", "xabcy", NULL);
877 suite->add("m", "31", "LP", "\\y(\\w+)\\y", "-- abc-", "abc", "abc", NULL);
878 suite->add("m", "32", "-", "a((b|c)d+)+", "abacdbd", "acdbd", "bd", "b", NULL);
879 suite->add("m", "33", "N", "(.*).*", "abc", "abc", "abc", NULL);
880 suite->add("m", "34", "N", "(a*)*", "bc", "", "", NULL);
881
882 return suite;
883}
884
885CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_21, "regex.21");
886
887
888/*
889 * 22 multicharacter collating elements
890 */
891
892class regextest_22 : public RegExTestSuite
893{
894public:
895 regextest_22() : RegExTestSuite("regex.22") { }
896 static Test *suite();
897};
898
899Test *regextest_22::suite()
900{
901 RegExTestSuite *suite = new regextest_22;
902
903 suite->add("m", "1", "&+L", "a[c]e", "ace", "ace", NULL);
904 suite->add("f", "2", "&+IL", "a[c]h", "ach", NULL);
905 suite->add("m", "3", "&+L", "a[[.ch.]]", "ach", "ach", NULL);
906 suite->add("f", "4", "&+L", "a[[.ch.]]", "ace", NULL);
907 suite->add("m", "5", "&+L", "a[c[.ch.]]", "ac", "ac", NULL);
908 suite->add("m", "6", "&+L", "a[c[.ch.]]", "ace", "ac", NULL);
909 suite->add("m", "7", "&+L", "a[c[.ch.]]", "ache", "ach", NULL);
910 suite->add("f", "8", "&+L", "a[^c]e", "ace", NULL);
911 suite->add("m", "9", "&+L", "a[^c]e", "abe", "abe", NULL);
912 suite->add("m", "10", "&+L", "a[^c]e", "ache", "ache", NULL);
913 suite->add("f", "11", "&+L", "a[^[.ch.]]", "ach", NULL);
914 suite->add("m", "12", "&+L", "a[^[.ch.]]", "ace", "ac", NULL);
915 suite->add("m", "13", "&+L", "a[^[.ch.]]", "ac", "ac", NULL);
916 suite->add("m", "14", "&+L", "a[^[.ch.]]", "abe", "ab", NULL);
917 suite->add("f", "15", "&+L", "a[^c[.ch.]]", "ach", NULL);
918 suite->add("f", "16", "&+L", "a[^c[.ch.]]", "ace", NULL);
919 suite->add("f", "17", "&+L", "a[^c[.ch.]]", "ac", NULL);
920 suite->add("m", "18", "&+L", "a[^c[.ch.]]", "abe", "ab", NULL);
921 suite->add("m", "19", "&+L", "a[^b]", "ac", "ac", NULL);
922 suite->add("m", "20", "&+L", "a[^b]", "ace", "ac", NULL);
923 suite->add("m", "21", "&+L", "a[^b]", "ach", "ach", NULL);
924 suite->add("f", "22", "&+L", "a[^b]", "abe", NULL);
925
926 return suite;
927}
928
929CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_22, "regex.22");
930
931
932/*
933 * 23 lookahead constraints
934 */
935
936class regextest_23 : public RegExTestSuite
937{
938public:
939 regextest_23() : RegExTestSuite("regex.23") { }
940 static Test *suite();
941};
942
943Test *regextest_23::suite()
944{
945 RegExTestSuite *suite = new regextest_23;
946
947 suite->add("m", "1", "HP", "a(?=b)b*", "ab", "ab", NULL);
948 suite->add("f", "2", "HP", "a(?=b)b*", "a", NULL);
949 suite->add("m", "3", "HP", "a(?=b)b*(?=c)c*", "abc", "abc", NULL);
950 suite->add("f", "4", "HP", "a(?=b)b*(?=c)c*", "ab", NULL);
951 suite->add("f", "5", "HP", "a(?!b)b*", "ab", NULL);
952 suite->add("m", "6", "HP", "a(?!b)b*", "a", "a", NULL);
953 suite->add("m", "7", "HP", "(?=b)b", "b", "b", NULL);
954 suite->add("f", "8", "HP", "(?=b)b", "a", NULL);
955
956 return suite;
957}
958
959CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_23, "regex.23");
960
961
962/*
963 * 24 non-greedy quantifiers
964 */
965
966class regextest_24 : public RegExTestSuite
967{
968public:
969 regextest_24() : RegExTestSuite("regex.24") { }
970 static Test *suite();
971};
972
973Test *regextest_24::suite()
974{
975 RegExTestSuite *suite = new regextest_24;
976
977 suite->add("m", "1", "PT", "ab+?", "abb", "ab", NULL);
978 suite->add("m", "2", "PT", "ab+?c", "abbc", "abbc", NULL);
979 suite->add("m", "3", "PT", "ab*?", "abb", "a", NULL);
980 suite->add("m", "4", "PT", "ab*?c", "abbc", "abbc", NULL);
981 suite->add("m", "5", "PT", "ab??", "ab", "a", NULL);
982 suite->add("m", "6", "PT", "ab??c", "abc", "abc", NULL);
983 suite->add("m", "7", "PQT", "ab{2,4}?", "abbbb", "abb", NULL);
984 suite->add("m", "8", "PQT", "ab{2,4}?c", "abbbbc", "abbbbc", NULL);
985 suite->add("m", "9", "-", "3z*", "123zzzz456", "3zzzz", NULL);
986 suite->add("m", "10", "PT", "3z*?", "123zzzz456", "3", NULL);
987 suite->add("m", "11", "-", "z*4", "123zzzz456", "zzzz4", NULL);
988 suite->add("m", "12", "PT", "z*?4", "123zzzz456", "zzzz4", NULL);
989
990 return suite;
991}
992
993CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_24, "regex.24");
994
995
996/*
997 * 25 mixed quantifiers
998 */
999
1000class regextest_25 : public RegExTestSuite
1001{
1002public:
1003 regextest_25() : RegExTestSuite("regex.25") { }
1004 static Test *suite();
1005};
1006
1007Test *regextest_25::suite()
1008{
1009 RegExTestSuite *suite = new regextest_25;
1010
1011 suite->add("m", "1", "PNT", "^(.*?)(a*)$", "xyza", "xyza", "xyz", "a", NULL);
1012 suite->add("m", "2", "PNT", "^(.*?)(a*)$", "xyzaa", "xyzaa", "xyz", "aa", NULL);
1013 suite->add("m", "3", "PNT", "^(.*?)(a*)$", "xyz", "xyz", "xyz", "", NULL);
1014
1015 return suite;
1016}
1017
1018CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_25, "regex.25");
1019
1020
1021/*
1022 * 26 tricky cases
1023 */
1024
1025class regextest_26 : public RegExTestSuite
1026{
1027public:
1028 regextest_26() : RegExTestSuite("regex.26") { }
1029 static Test *suite();
1030};
1031
1032Test *regextest_26::suite()
1033{
1034 RegExTestSuite *suite = new regextest_26;
1035
1036 suite->add("m", "1", "-", "(week|wee)(night|knights)", "weeknights", "weeknights", "wee", "knights", NULL);
1037 suite->add("m", "2", "RP", "a(bc*).*\\1", "abccbccb", "abccbccb", "b", NULL);
1038 suite->add("m", "3", "-", "a(b.[bc]*)+", "abcbd", "abcbd", "bd", NULL);
1039
1040 return suite;
1041}
1042
1043CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_26, "regex.26");
1044
1045
1046/*
1047 * 27 implementation misc.
1048 */
1049
1050class regextest_27 : public RegExTestSuite
1051{
1052public:
1053 regextest_27() : RegExTestSuite("regex.27") { }
1054 static Test *suite();
1055};
1056
1057Test *regextest_27::suite()
1058{
1059 RegExTestSuite *suite = new regextest_27;
1060
1061 suite->add("m", "1", "P", "a(?:b|b)c", "abc", "abc", NULL);
1062 suite->add("m", "2", "&", "[ab][ab][ab]", "aba", "aba", NULL);
1063 suite->add("m", "3", "&", "[ab][ab][ab][ab][ab][ab][ab]", "abababa", "abababa", NULL);
1064
1065 return suite;
1066}
1067
1068CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_27, "regex.27");
1069
1070
1071/*
1072 * 28 boundary busters etc.
1073 */
1074
1075class regextest_28 : public RegExTestSuite
1076{
1077public:
1078 regextest_28() : RegExTestSuite("regex.28") { }
1079 static Test *suite();
1080};
1081
1082Test *regextest_28::suite()
1083{
1084 RegExTestSuite *suite = new regextest_28;
1085
1086 suite->add("m", "1", "&", "abcdefghijkl", "abcdefghijkl", "abcdefghijkl", NULL);
1087 suite->add("m", "2", "P", "a(?:b|c|d|e|f|g|h|i|j|k|l|m)n", "agn", "agn", NULL);
1088 suite->add("m", "3", "-", "a(((((((((((((b)))))))))))))c", "abc", "abc", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", NULL);
1089 suite->add("m", "4", "Q", "ab{1,100}c", "abbc", "abbc", NULL);
1090 suite->add("m", "5", "Q", "ab{1,100}c", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc", NULL);
1091 suite->add("m", "6", "Q", "ab{1,100}c", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc", "abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc", NULL);
1092 suite->add("m", "7", "LP", "\\w+abcdefgh", "xyzabcdefgh", "xyzabcdefgh", NULL);
1093 suite->add("m", "8", "%LP", "\\w+abcdefgh", "xyzabcdefgh", "xyzabcdefgh", NULL);
1094 suite->add("m", "9", "%LP", "\\w+abcdefghijklmnopqrst", "xyzabcdefghijklmnopqrst", "xyzabcdefghijklmnopqrst", NULL);
1095 suite->add("i", "10", "%LP", "\\w+(abcdefgh)?", "xyz", "0 2", "-1 -1", NULL);
1096 suite->add("i", "11", "%LP", "\\w+(abcdefgh)?", "xyzabcdefg", "0 9", "-1 -1", NULL);
1097 suite->add("i", "12", "%LP", "\\w+(abcdefghijklmnopqrst)?", "xyzabcdefghijklmnopqrs", "0 21", "-1 -1", NULL);
1098
1099 return suite;
1100}
1101
1102CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_28, "regex.28");
1103
1104
1105/*
1106 * 29 incomplete matches
1107 */
1108
1109class regextest_29 : public RegExTestSuite
1110{
1111public:
1112 regextest_29() : RegExTestSuite("regex.29") { }
1113 static Test *suite();
1114};
1115
1116Test *regextest_29::suite()
1117{
1118 RegExTestSuite *suite = new regextest_29;
1119
1120 suite->add("p", "1", "t", "def", "abc", "3 2", "", NULL);
1121 suite->add("p", "2", "t", "bcd", "abc", "1 2", "", NULL);
1122 suite->add("p", "3", "t", "abc", "abab", "0 3", "", NULL);
1123 suite->add("p", "4", "t", "abc", "abdab", "3 4", "", NULL);
1124 suite->add("i", "5", "t", "abc", "abc", "0 2", "0 2", NULL);
1125 suite->add("i", "6", "t", "abc", "xyabc", "2 4", "2 4", NULL);
1126 suite->add("p", "7", "t", "abc+", "xyab", "2 3", "", NULL);
1127 suite->add("i", "8", "t", "abc+", "xyabc", "2 4", "2 4", NULL);
1128 suite->add("i", "10", "t", "abc+", "xyabcdd", "2 4", "7 6", NULL);
1129 suite->add("p", "11", "tPT", "abc+?", "xyab", "2 3", "", NULL);
1130 suite->add("i", "12", "tPT", "abc+?", "xyabc", "2 4", "5 4", NULL);
1131 suite->add("i", "13", "tPT", "abc+?", "xyabcc", "2 4", "6 5", NULL);
1132 suite->add("i", "14", "tPT", "abc+?", "xyabcd", "2 4", "6 5", NULL);
1133 suite->add("i", "15", "tPT", "abc+?", "xyabcdd", "2 4", "7 6", NULL);
1134 suite->add("i", "16", "t", "abcd|bc", "xyabc", "3 4", "2 4", NULL);
1135 suite->add("p", "17", "tn", ".*k", "xx\nyyy", "3 5", "", NULL);
1136
1137 return suite;
1138}
1139
1140CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_29, "regex.29");
1141
1142
1143/*
1144 * 30 misc. oddities and old bugs
1145 */
1146
1147class regextest_30 : public RegExTestSuite
1148{
1149public:
1150 regextest_30() : RegExTestSuite("regex.30") { }
1151 static Test *suite();
1152};
1153
1154Test *regextest_30::suite()
1155{
1156 RegExTestSuite *suite = new regextest_30;
1157
1158 suite->add("e", "1", "&", "***", "BADRPT", NULL);
1159 suite->add("m", "2", "N", "a?b*", "abb", "abb", NULL);
1160 suite->add("m", "3", "N", "a?b*", "bb", "bb", NULL);
1161 suite->add("m", "4", "&", "a*b", "aab", "aab", NULL);
1162 suite->add("m", "5", "&", "^a*b", "aaaab", "aaaab", NULL);
1163 suite->add("m", "6", "&M", "[0-6][1-2][0-3][0-6][1-6][0-6]", "010010", "010010", NULL);
1164 suite->add("m", "7", "s", "abc", "abcd", "abc", NULL);
1165 suite->add("f", "8", "s", "abc", "xabcd", NULL);
1166 suite->add("m", "9", "HLP", "(?n)^(?![t#])\\S+", "tk\n\n#\n#\nit0", "it0", NULL);
1167
1168 return suite;
1169}
1170
1171CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_30, "regex.30");
1172
1173
1174/*
1175 * extra_1 checks for bug fixes
1176 */
1177
1178class regextest_extra_1 : public RegExTestSuite
1179{
1180public:
1181 regextest_extra_1() : RegExTestSuite("regex.extra_1") { }
1182 static Test *suite();
1183};
1184
1185Test *regextest_extra_1::suite()
1186{
1187 RegExTestSuite *suite = new regextest_extra_1;
1188
bc10103e 1189 suite->add("m", "Bug 230589", "o", "[ ]*(^|[^%])%V", "*%V2", NULL);
e70833fb 1190 suite->add("m", "Bug 504785", "-", "([^_.]*)([^.]*)\\.(..)(.).*", "bbcos_001_c01.q1la", "bbcos_001_c01.q1la", "bbcos", "_001_c01", "q1", "l", NULL);
bc10103e
VS
1191 suite->add("m", "Bug 505048", "o", "\\A\\s*[^<]*\\s*<([^>]+)>", "a<a>", NULL);
1192 suite->add("m", "Bug 505048", "o", "\\A\\s*([^b]*)b", "ab", NULL);
1193 suite->add("m", "Bug 505048", "o", "\\A\\s*[^b]*(b)", "ab", NULL);
1194 suite->add("m", "Bug 505048", "o", "\\A(\\s*)[^b]*(b)", "ab", NULL);
1195 suite->add("m", "Bug 505048", "o", "\\A\\s*[^b]*b", "ab", NULL);
e70833fb
VS
1196 suite->add("m", "Bug 505048", "-", "\\A\\s*[^b]*b", "ab", "ab", NULL);
1197 suite->add("i", "Bug 505048", "-", "\\A\\s*[^b]*b", "ab", "0 1", NULL);
1198
1199 return suite;
1200}
1201
1202CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_extra_1, "regex.extra_1");
1203
1204
1205/*
1206 * wx_1 character classification: ascii
1207 */
1208
1209class regextest_wx_1 : public RegExTestSuite
1210{
1211public:
1212 regextest_wx_1() : RegExTestSuite("regex.wx_1") { }
1213 static Test *suite();
1214};
1215
1216Test *regextest_wx_1::suite()
1217{
1218 RegExTestSuite *suite = new regextest_wx_1;
1219
1220 suite->add("m", "1", "&", "[^[:alnum:]]", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!", "!", NULL);
1221 suite->add("m", "2", "&", "[[:alnum:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~X", "X", NULL);
1222 suite->add("m", "3", "&", "[^[:alpha:]]", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!", "!", NULL);
1223 suite->add("m", "4", "&", "[[:alpha:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_`{|}~X", "X", NULL);
1224 suite->add("m", "5", "&", "[^[:cntrl:]]", "\a\b\t\n\v\f\r!", "!", NULL);
1225 suite->add("m", "6", "&", "[[:cntrl:]]", " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n", "\n", NULL);
1226 suite->add("m", "7", "&", "[^[:digit:]]", "0123456789!", "!", NULL);
1227 suite->add("m", "8", "&", "[[:digit:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 0", "0", NULL);
1228 suite->add("m", "9", "&", "[^[:graph:]]", "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n", "\n", NULL);
1229 suite->add("m", "10", "&", "[[:graph:]]", "\a\b\t\n\v\f\r !", "!", NULL);
1230 suite->add("m", "11", "&", "[^[:lower:]]", "abcdefghijklmnopqrstuvwxyz!", "!", NULL);
1231 suite->add("m", "12", "&", "[[:lower:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~x", "x", NULL);
1232 suite->add("m", "13", "&", "[^[:print:]]", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n", "\n", NULL);
1233 suite->add("m", "14", "&", "[[:print:]]", "\a\b\n\v\f\rX", "X", NULL);
1234 suite->add("m", "15", "&", "[^[:punct:]]", "!\"#%&'()*,-./:;?@[\\]_{}X", "X", NULL);
1235 suite->add("m", "16", "&", "[[:punct:]]", "\a\b\t\n\v\f\r 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!", "!", NULL);
1236 suite->add("m", "17", "&", "[^[:space:]]", "\t\n\v\f\r X", "X", NULL);
1237 suite->add("m", "18", "&", "[[:space:]]", "\a\b!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\n", "\n", NULL);
1238 suite->add("m", "19", "&", "[^[:upper:]]", "ABCDEFGHIJKLMNOPQRSTUVWXYZ!", "!", NULL);
1239 suite->add("m", "20", "&", "[[:upper:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~X", "X", NULL);
1240 suite->add("m", "21", "&", "[^[:xdigit:]]", "0123456789ABCDEFabcdef!", "!", NULL);
1241 suite->add("m", "22", "&", "[[:xdigit:]]", "\a\b\t\n\v\f\r !\"#$%&'()*+,-./:;<=>?@GHIJKLMNOPQRSTUVWXYZ[\\]^_`ghijklmnopqrstuvwxyz{|}~a", "a", NULL);
1242 suite->add("i", "23", "&i", "AbCdEfGhIjKlMnOpQrStUvWxYz", "aBcDeFgHiJkLmNoPqRsTuVwXyZ", "0 25", NULL);
1243
1244 return suite;
1245}
1246
1247CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_1, "regex.wx_1");
1248
1249
1250/*
1251 * wx_2 character classification: western european
1252 */
1253
1254class regextest_wx_2 : public RegExTestSuite
1255{
1256public:
1257 regextest_wx_2() : RegExTestSuite("regex.wx_2") { }
1258 static Test *suite();
1259};
1260
1261Test *regextest_wx_2::suite()
1262{
1263 RegExTestSuite *suite = new regextest_wx_2;
1264
0d95d20c
VS
1265 suite->add("m", "1", "&*", "[^[:alpha:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
1266 suite->add("m", "2", "&*", "[[:alpha:]]", " ¡¢£¤¥¦§¨©«¬­®¯°±²³´¶·¸¹»¼½¾¿×÷X", "X", NULL);
1267 suite->add("m", "3", "&*", "[^[:lower:]]", "ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ!", "!", NULL);
1268 suite->add("m", "4", "&*", "[[:lower:]]", " ¡¢£¤¥¦§¨©«¬­®¯°±²³´¶·¸¹»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞ÷x", "x", NULL);
1269 suite->add("m", "5", "&*", "[^[:upper:]]", "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ!", "!", NULL);
1270 suite->add("m", "6", "&*", "[[:upper:]]", " ¡¢£¤¥¦§¨©«¬­®¯°±²³´¶·¸¹»¼½¾¿×ßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿX", "X", NULL);
e70833fb
VS
1271 suite->add("i", "7", "&i*", "ÀáÂãÄåÆçÈéÊëÌíÎïÐñÒóÔõÖøÙúÛüÝþ", "àÁâÃäÅæÇèÉêËìÍîÏðÑòÓôÕöØùÚûÜýÞ", "0 29", NULL);
1272
1273 return suite;
1274}
1275
1276CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_2, "regex.wx_2");
1277
1278
1279/*
1280 * wx_3 character classification: cyrillic
1281 */
1282
1283class regextest_wx_3 : public RegExTestSuite
1284{
1285public:
1286 regextest_wx_3() : RegExTestSuite("regex.wx_3") { }
1287 static Test *suite();
1288};
1289
1290Test *regextest_wx_3::suite()
1291{
1292 RegExTestSuite *suite = new regextest_wx_3;
1293
0d95d20c
VS
1294 suite->add("m", "1", "&*", "[^[:alpha:]]", "ёЁюабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
1295 suite->add("m", "2", "&*", "[^[:lower:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъ!", "!", NULL);
1296 suite->add("m", "3", "&*", "[[:lower:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪx", "x", NULL);
1297 suite->add("m", "4", "&*", "[^[:upper:]]", "ЁЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ!", "!", NULL);
1298 suite->add("m", "5", "&*", "[[:upper:]]", "ёюабцдефгхийклмнопярстужвьызшэщчъX", "X", NULL);
e70833fb
VS
1299 suite->add("i", "6", "&i*", "ЁюАбЦдЕфГхИйКлМнОпЯрСтУжВьЫзШэЩчЪ", "ёЮаБцДеФгХиЙкЛмНоПяРсТуЖвЬыЗшЭщЧъ", "0 32", NULL);
1300
1301 return suite;
1302}
1303
1304CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_3, "regex.wx_3");
1305
1306
1307/*
1308 * A suite containing all the above suites
1309 */
1310
1311class regextest : public TestSuite
1312{
1313public:
1314 regextest() : TestSuite("regex") { }
1315 static Test *suite();
1316};
1317
1318Test *regextest::suite()
1319{
1320 TestSuite *suite = new regextest;
1321
1322 suite->addTest(regextest_1::suite());
1323 suite->addTest(regextest_2::suite());
1324 suite->addTest(regextest_3::suite());
1325 suite->addTest(regextest_4::suite());
1326 suite->addTest(regextest_5::suite());
1327 suite->addTest(regextest_6::suite());
1328 suite->addTest(regextest_7::suite());
1329 suite->addTest(regextest_8::suite());
1330 suite->addTest(regextest_9::suite());
1331 suite->addTest(regextest_10::suite());
1332 suite->addTest(regextest_11::suite());
1333 suite->addTest(regextest_12::suite());
1334 suite->addTest(regextest_13::suite());
1335 suite->addTest(regextest_14::suite());
1336 suite->addTest(regextest_15::suite());
1337 suite->addTest(regextest_16::suite());
1338 suite->addTest(regextest_17::suite());
1339 suite->addTest(regextest_18::suite());
1340 suite->addTest(regextest_19::suite());
1341 suite->addTest(regextest_20::suite());
1342 suite->addTest(regextest_21::suite());
1343 suite->addTest(regextest_22::suite());
1344 suite->addTest(regextest_23::suite());
1345 suite->addTest(regextest_24::suite());
1346 suite->addTest(regextest_25::suite());
1347 suite->addTest(regextest_26::suite());
1348 suite->addTest(regextest_27::suite());
1349 suite->addTest(regextest_28::suite());
1350 suite->addTest(regextest_29::suite());
1351 suite->addTest(regextest_30::suite());
1352 suite->addTest(regextest_extra_1::suite());
1353 suite->addTest(regextest_wx_1::suite());
1354 suite->addTest(regextest_wx_2::suite());
1355 suite->addTest(regextest_wx_3::suite());
1356
1357 return suite;
1358}
1359
1360CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest, "regex");
1361CPPUNIT_TEST_SUITE_REGISTRATION(regextest);