2 * Test data for wxRegEx (UTF-8 encoded)
4 * Generated Sun Apr 25 15:30:23 2004 by regex.pl from the following files:
6 * reg.test: Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
7 * wxreg.test: Copyright (c) 2004 Mike Wetherell.
10 * e compile error expected
11 * f match failure expected
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)
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
26 * & test as both ARE and BRE
29 * a turn advanced-features bit on (error unless ERE already)
30 * q literal string, no metacharacters at all
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
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)
58 * 1 basic sanity checks
61 class regextest_1 : public RegExTestSuite
64 regextest_1() : RegExTestSuite("regex.1") { }
68 Test *regextest_1::suite()
70 RegExTestSuite *suite = new regextest_1;
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);
79 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_1, "regex.1");
83 * 2 invalid option combinations
86 class regextest_2 : public RegExTestSuite
89 regextest_2() : RegExTestSuite("regex.2") { }
93 Test *regextest_2::suite()
95 RegExTestSuite *suite = new regextest_2;
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);
106 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_2, "regex.2");
113 class regextest_3 : public RegExTestSuite
116 regextest_3() : RegExTestSuite("regex.3") { }
117 static Test *suite();
120 Test *regextest_3::suite()
122 RegExTestSuite *suite = new regextest_3;
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);
134 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_3, "regex.3");
141 class regextest_4 : public RegExTestSuite
144 regextest_4() : RegExTestSuite("regex.4") { }
145 static Test *suite();
148 Test *regextest_4::suite()
150 RegExTestSuite *suite = new regextest_4;
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);
172 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_4, "regex.4");
176 * 5 simple one-char matching
179 class regextest_5 : public RegExTestSuite
182 regextest_5() : RegExTestSuite("regex.5") { }
183 static Test *suite();
186 Test *regextest_5::suite()
188 RegExTestSuite *suite = new regextest_5;
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);
202 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_5, "regex.5");
206 * 6 context-dependent syntax
209 class regextest_6 : public RegExTestSuite
212 regextest_6() : RegExTestSuite("regex.6") { }
213 static Test *suite();
216 Test *regextest_6::suite()
218 RegExTestSuite *suite = new regextest_6;
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);
244 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_6, "regex.6");
248 * 7 simple quantifiers
251 class regextest_7 : public RegExTestSuite
254 regextest_7() : RegExTestSuite("regex.7") { }
255 static Test *suite();
258 Test *regextest_7::suite()
260 RegExTestSuite *suite = new regextest_7;
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);
281 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_7, "regex.7");
288 class regextest_8 : public RegExTestSuite
291 regextest_8() : RegExTestSuite("regex.8") { }
292 static Test *suite();
295 Test *regextest_8::suite()
297 RegExTestSuite *suite = new regextest_8;
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);
330 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_8, "regex.8");
337 class regextest_9 : public RegExTestSuite
340 regextest_9() : RegExTestSuite("regex.9") { }
341 static Test *suite();
344 Test *regextest_9::suite()
346 RegExTestSuite *suite = new regextest_9;
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);
396 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_9, "regex.9");
400 * 10 anchors and newlines
403 class regextest_10 : public RegExTestSuite
406 regextest_10() : RegExTestSuite("regex.10") { }
407 static Test *suite();
410 Test *regextest_10::suite()
412 RegExTestSuite *suite = new regextest_10;
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);
450 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_10, "regex.10");
454 * 11 boundary constraints
457 class regextest_11 : public RegExTestSuite
460 regextest_11() : RegExTestSuite("regex.11") { }
461 static Test *suite();
464 Test *regextest_11::suite()
466 RegExTestSuite *suite = new regextest_11;
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);
504 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_11, "regex.11");
508 * 12 character classes
511 class regextest_12 : public RegExTestSuite
514 regextest_12() : RegExTestSuite("regex.12") { }
515 static Test *suite();
518 Test *regextest_12::suite()
520 RegExTestSuite *suite = new regextest_12;
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);
544 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_12, "regex.12");
551 class regextest_13 : public RegExTestSuite
554 regextest_13() : RegExTestSuite("regex.13") { }
555 static Test *suite();
558 Test *regextest_13::suite()
560 RegExTestSuite *suite = new regextest_13;
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);
592 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_13, "regex.13");
599 class regextest_14 : public RegExTestSuite
602 regextest_14() : RegExTestSuite("regex.14") { }
603 static Test *suite();
606 Test *regextest_14::suite()
608 RegExTestSuite *suite = new regextest_14;
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);
634 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_14, "regex.14");
638 * 15 octal escapes vs back references
641 class regextest_15 : public RegExTestSuite
644 regextest_15() : RegExTestSuite("regex.15") { }
645 static Test *suite();
648 Test *regextest_15::suite()
650 RegExTestSuite *suite = new regextest_15;
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);
668 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_15, "regex.15");
675 class regextest_16 : public RegExTestSuite
678 regextest_16() : RegExTestSuite("regex.16") { }
679 static Test *suite();
682 Test *regextest_16::suite()
684 RegExTestSuite *suite = new regextest_16;
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);
699 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_16, "regex.16");
706 class regextest_17 : public RegExTestSuite
709 regextest_17() : RegExTestSuite("regex.17") { }
710 static Test *suite();
713 Test *regextest_17::suite()
715 RegExTestSuite *suite = new regextest_17;
717 suite->add("m", "1", "P", "a(?#comment)b", "ab", "ab", NULL);
722 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_17, "regex.17");
729 class regextest_18 : public RegExTestSuite
732 regextest_18() : RegExTestSuite("regex.18") { }
733 static Test *suite();
736 Test *regextest_18::suite()
738 RegExTestSuite *suite = new regextest_18;
740 suite->add("f", "1", "I", "a^b", "ab", NULL);
745 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_18, "regex.18");
749 * 19 case independence
752 class regextest_19 : public RegExTestSuite
755 regextest_19() : RegExTestSuite("regex.19") { }
756 static Test *suite();
759 Test *regextest_19::suite()
761 RegExTestSuite *suite = new regextest_19;
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);
772 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_19, "regex.19");
776 * 20 directors and embedded options
779 class regextest_20 : public RegExTestSuite
782 regextest_20() : RegExTestSuite("regex.20") { }
783 static Test *suite();
786 Test *regextest_20::suite()
788 RegExTestSuite *suite = new regextest_20;
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);
829 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_20, "regex.20");
836 class regextest_21 : public RegExTestSuite
839 regextest_21() : RegExTestSuite("regex.21") { }
840 static Test *suite();
843 Test *regextest_21::suite()
845 RegExTestSuite *suite = new regextest_21;
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);
885 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_21, "regex.21");
889 * 22 multicharacter collating elements
892 class regextest_22 : public RegExTestSuite
895 regextest_22() : RegExTestSuite("regex.22") { }
896 static Test *suite();
899 Test *regextest_22::suite()
901 RegExTestSuite *suite = new regextest_22;
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);
929 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_22, "regex.22");
933 * 23 lookahead constraints
936 class regextest_23 : public RegExTestSuite
939 regextest_23() : RegExTestSuite("regex.23") { }
940 static Test *suite();
943 Test *regextest_23::suite()
945 RegExTestSuite *suite = new regextest_23;
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);
959 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_23, "regex.23");
963 * 24 non-greedy quantifiers
966 class regextest_24 : public RegExTestSuite
969 regextest_24() : RegExTestSuite("regex.24") { }
970 static Test *suite();
973 Test *regextest_24::suite()
975 RegExTestSuite *suite = new regextest_24;
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);
993 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_24, "regex.24");
997 * 25 mixed quantifiers
1000 class regextest_25 : public RegExTestSuite
1003 regextest_25() : RegExTestSuite("regex.25") { }
1004 static Test *suite();
1007 Test *regextest_25::suite()
1009 RegExTestSuite *suite = new regextest_25;
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);
1018 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_25, "regex.25");
1025 class regextest_26 : public RegExTestSuite
1028 regextest_26() : RegExTestSuite("regex.26") { }
1029 static Test *suite();
1032 Test *regextest_26::suite()
1034 RegExTestSuite *suite = new regextest_26;
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);
1043 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_26, "regex.26");
1047 * 27 implementation misc.
1050 class regextest_27 : public RegExTestSuite
1053 regextest_27() : RegExTestSuite("regex.27") { }
1054 static Test *suite();
1057 Test *regextest_27::suite()
1059 RegExTestSuite *suite = new regextest_27;
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);
1068 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_27, "regex.27");
1072 * 28 boundary busters etc.
1075 class regextest_28 : public RegExTestSuite
1078 regextest_28() : RegExTestSuite("regex.28") { }
1079 static Test *suite();
1082 Test *regextest_28::suite()
1084 RegExTestSuite *suite = new regextest_28;
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);
1102 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_28, "regex.28");
1106 * 29 incomplete matches
1109 class regextest_29 : public RegExTestSuite
1112 regextest_29() : RegExTestSuite("regex.29") { }
1113 static Test *suite();
1116 Test *regextest_29::suite()
1118 RegExTestSuite *suite = new regextest_29;
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);
1140 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_29, "regex.29");
1144 * 30 misc. oddities and old bugs
1147 class regextest_30 : public RegExTestSuite
1150 regextest_30() : RegExTestSuite("regex.30") { }
1151 static Test *suite();
1154 Test *regextest_30::suite()
1156 RegExTestSuite *suite = new regextest_30;
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);
1171 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_30, "regex.30");
1175 * extra_1 checks for bug fixes
1178 class regextest_extra_1 : public RegExTestSuite
1181 regextest_extra_1() : RegExTestSuite("regex.extra_1") { }
1182 static Test *suite();
1185 Test *regextest_extra_1::suite()
1187 RegExTestSuite *suite = new regextest_extra_1;
1189 suite->add("m", "Bug 230589", "o", "[ ]*(^|[^%])%V", "*%V2", NULL);
1190 suite->add("m", "Bug 504785", "-", "([^_.]*)([^.]*)\\.(..)(.).*", "bbcos_001_c01.q1la", "bbcos_001_c01.q1la", "bbcos", "_001_c01", "q1", "l", NULL);
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);
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);
1202 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_extra_1, "regex.extra_1");
1206 * wx_1 character classification: ascii
1209 class regextest_wx_1 : public RegExTestSuite
1212 regextest_wx_1() : RegExTestSuite("regex.wx_1") { }
1213 static Test *suite();
1216 Test *regextest_wx_1::suite()
1218 RegExTestSuite *suite = new regextest_wx_1;
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);
1247 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_1, "regex.wx_1");
1251 * wx_2 character classification: western european
1254 class regextest_wx_2 : public RegExTestSuite
1257 regextest_wx_2() : RegExTestSuite("regex.wx_2") { }
1258 static Test *suite();
1261 Test *regextest_wx_2::suite()
1263 RegExTestSuite *suite = new regextest_wx_2;
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);
1271 suite->add("i", "7", "&i*", "ÀáÂãÄåÆçÈéÊëÌíÎïÐñÒóÔõÖøÙúÛüÝþ", "àÁâÃäÅæÇèÉêËìÍîÏðÑòÓôÕöØùÚûÜýÞ", "0 29", NULL);
1276 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_2, "regex.wx_2");
1280 * wx_3 character classification: cyrillic
1283 class regextest_wx_3 : public RegExTestSuite
1286 regextest_wx_3() : RegExTestSuite("regex.wx_3") { }
1287 static Test *suite();
1290 Test *regextest_wx_3::suite()
1292 RegExTestSuite *suite = new regextest_wx_3;
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);
1299 suite->add("i", "6", "&i*", "ЁюАбЦдЕфГхИйКлМнОпЯрСтУжВьЫзШэЩчЪ", "ёЮаБцДеФгХиЙкЛмНоПяРсТуЖвЬыЗшЭщЧъ", "0 32", NULL);
1304 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest_wx_3, "regex.wx_3");
1308 * A suite containing all the above suites
1311 class regextest : public TestSuite
1314 regextest() : TestSuite("regex") { }
1315 static Test *suite();
1318 Test *regextest::suite()
1320 TestSuite *suite = new regextest;
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());
1360 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(regextest, "regex");
1361 CPPUNIT_TEST_SUITE_REGISTRATION(regextest);