/[pcre]/code/trunk/pcre_jit_test.c
ViewVC logotype

Contents of /code/trunk/pcre_jit_test.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1533 - (show annotations)
Tue Mar 24 08:22:29 2015 UTC (4 years, 7 months ago) by zherczeg
File MIME type: text/plain
File size: 72331 byte(s)
Fix JIT compilation of conditional blocks, which assertion is converted to (*FAIL).
1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
4
5 /* PCRE is a library of functions to support regular expressions whose syntax
6 and semantics are as close as possible to those of the Perl 5 language.
7
8 Main Library written by Philip Hazel
9 Copyright (c) 1997-2012 University of Cambridge
10
11 This JIT compiler regression test program was written by Zoltan Herczeg
12 Copyright (c) 2010-2012
13
14 -----------------------------------------------------------------------------
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17
18 * Redistributions of source code must retain the above copyright notice,
19 this list of conditions and the following disclaimer.
20
21 * Redistributions in binary form must reproduce the above copyright
22 notice, this list of conditions and the following disclaimer in the
23 documentation and/or other materials provided with the distribution.
24
25 * Neither the name of the University of Cambridge nor the names of its
26 contributors may be used to endorse or promote products derived from
27 this software without specific prior written permission.
28
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
33 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
40 -----------------------------------------------------------------------------
41 */
42
43 #ifdef HAVE_CONFIG_H
44 #include "config.h"
45 #endif
46
47 #include <stdio.h>
48 #include <string.h>
49 #include "pcre.h"
50
51
52 #include "pcre_internal.h"
53
54 /*
55 Letter characters:
56 \xe6\x92\xad = 0x64ad = 25773 (kanji)
57 Non-letter characters:
58 \xc2\xa1 = 0xa1 = (Inverted Exclamation Mark)
59 \xf3\xa9\xb7\x80 = 0xe9dc0 = 957888
60 \xed\xa0\x80 = 55296 = 0xd800 (Invalid UTF character)
61 \xed\xb0\x80 = 56320 = 0xdc00 (Invalid UTF character)
62 Newlines:
63 \xc2\x85 = 0x85 = 133 (NExt Line = NEL)
64 \xe2\x80\xa8 = 0x2028 = 8232 (Line Separator)
65 Othercase pairs:
66 \xc3\xa9 = 0xe9 = 233 (e')
67 \xc3\x89 = 0xc9 = 201 (E')
68 \xc3\xa1 = 0xe1 = 225 (a')
69 \xc3\x81 = 0xc1 = 193 (A')
70 \x53 = 0x53 = S
71 \x73 = 0x73 = s
72 \xc5\xbf = 0x17f = 383 (long S)
73 \xc8\xba = 0x23a = 570
74 \xe2\xb1\xa5 = 0x2c65 = 11365
75 \xe1\xbd\xb8 = 0x1f78 = 8056
76 \xe1\xbf\xb8 = 0x1ff8 = 8184
77 \xf0\x90\x90\x80 = 0x10400 = 66560
78 \xf0\x90\x90\xa8 = 0x10428 = 66600
79 \xc7\x84 = 0x1c4 = 452
80 \xc7\x85 = 0x1c5 = 453
81 \xc7\x86 = 0x1c6 = 454
82 Caseless sets:
83 ucp_Armenian - \x{531}-\x{556} -> \x{561}-\x{586}
84 ucp_Coptic - \x{2c80}-\x{2ce3} -> caseless: XOR 0x1
85 ucp_Latin - \x{ff21}-\x{ff3a} -> \x{ff41]-\x{ff5a}
86
87 Mark property:
88 \xcc\x8d = 0x30d = 781
89 Special:
90 \xc2\x80 = 0x80 = 128 (lowest 2 byte character)
91 \xdf\xbf = 0x7ff = 2047 (highest 2 byte character)
92 \xe0\xa0\x80 = 0x800 = 2048 (lowest 2 byte character)
93 \xef\xbf\xbf = 0xffff = 65535 (highest 3 byte character)
94 \xf0\x90\x80\x80 = 0x10000 = 65536 (lowest 4 byte character)
95 \xf4\x8f\xbf\xbf = 0x10ffff = 1114111 (highest allowed utf character)
96 */
97
98 static int regression_tests(void);
99
100 int main(void)
101 {
102 int jit = 0;
103 #if defined SUPPORT_PCRE8
104 pcre_config(PCRE_CONFIG_JIT, &jit);
105 #elif defined SUPPORT_PCRE16
106 pcre16_config(PCRE_CONFIG_JIT, &jit);
107 #elif defined SUPPORT_PCRE32
108 pcre32_config(PCRE_CONFIG_JIT, &jit);
109 #endif
110 if (!jit) {
111 printf("JIT must be enabled to run pcre_jit_test\n");
112 return 1;
113 }
114 return regression_tests();
115 }
116
117 /* --------------------------------------------------------------------------------------- */
118
119 #if !(defined SUPPORT_PCRE8) && !(defined SUPPORT_PCRE16) && !(defined SUPPORT_PCRE32)
120 #error SUPPORT_PCRE8 or SUPPORT_PCRE16 or SUPPORT_PCRE32 must be defined
121 #endif
122
123 #define MUA (PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF)
124 #define MUAP (PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF | PCRE_UCP)
125 #define CMUA (PCRE_CASELESS | PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF)
126 #define CMUAP (PCRE_CASELESS | PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF | PCRE_UCP)
127 #define MA (PCRE_MULTILINE | PCRE_NEWLINE_ANYCRLF)
128 #define MAP (PCRE_MULTILINE | PCRE_NEWLINE_ANYCRLF | PCRE_UCP)
129 #define CMA (PCRE_CASELESS | PCRE_MULTILINE | PCRE_NEWLINE_ANYCRLF)
130
131 #define OFFSET_MASK 0x00ffff
132 #define F_NO8 0x010000
133 #define F_NO16 0x020000
134 #define F_NO32 0x020000
135 #define F_NOMATCH 0x040000
136 #define F_DIFF 0x080000
137 #define F_FORCECONV 0x100000
138 #define F_PROPERTY 0x200000
139 #define F_STUDY 0x400000
140
141 struct regression_test_case {
142 int flags;
143 int start_offset;
144 const char *pattern;
145 const char *input;
146 };
147
148 static struct regression_test_case regression_test_cases[] = {
149 /* Constant strings. */
150 { MUA, 0, "AbC", "AbAbC" },
151 { MUA, 0, "ACCEPT", "AACACCACCEACCEPACCEPTACCEPTT" },
152 { CMUA, 0, "aA#\xc3\xa9\xc3\x81", "aA#Aa#\xc3\x89\xc3\xa1" },
153 { MA, 0, "[^a]", "aAbB" },
154 { CMA, 0, "[^m]", "mMnN" },
155 { MA, 0, "a[^b][^#]", "abacd" },
156 { CMA, 0, "A[^B][^E]", "abacd" },
157 { CMUA, 0, "[^x][^#]", "XxBll" },
158 { MUA, 0, "[^a]", "aaa\xc3\xa1#Ab" },
159 { CMUA, 0, "[^A]", "aA\xe6\x92\xad" },
160 { MUA, 0, "\\W(\\W)?\\w", "\r\n+bc" },
161 { MUA, 0, "\\W(\\W)?\\w", "\n\r+bc" },
162 { MUA, 0, "\\W(\\W)?\\w", "\r\r+bc" },
163 { MUA, 0, "\\W(\\W)?\\w", "\n\n+bc" },
164 { MUA, 0, "[axd]", "sAXd" },
165 { CMUA, 0, "[axd]", "sAXd" },
166 { CMUA, 0 | F_NOMATCH, "[^axd]", "DxA" },
167 { MUA, 0, "[a-dA-C]", "\xe6\x92\xad\xc3\xa9.B" },
168 { MUA, 0, "[^a-dA-C]", "\xe6\x92\xad\xc3\xa9" },
169 { CMUA, 0, "[^\xc3\xa9]", "\xc3\xa9\xc3\x89." },
170 { MUA, 0, "[^\xc3\xa9]", "\xc3\xa9\xc3\x89." },
171 { MUA, 0, "[^a]", "\xc2\x80[]" },
172 { CMUA, 0, "\xf0\x90\x90\xa7", "\xf0\x90\x91\x8f" },
173 { CMA, 0, "1a2b3c4", "1a2B3c51A2B3C4" },
174 { PCRE_CASELESS, 0, "\xff#a", "\xff#\xff\xfe##\xff#A" },
175 { PCRE_CASELESS, 0, "\xfe", "\xff\xfc#\xfe\xfe" },
176 { PCRE_CASELESS, 0, "a1", "Aa1" },
177 { MA, 0, "\\Ca", "cda" },
178 { CMA, 0, "\\Ca", "CDA" },
179 { MA, 0 | F_NOMATCH, "\\Cx", "cda" },
180 { CMA, 0 | F_NOMATCH, "\\Cx", "CDA" },
181 { CMUAP, 0, "\xf0\x90\x90\x80\xf0\x90\x90\xa8", "\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
182 { CMUAP, 0, "\xf0\x90\x90\x80{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
183 { CMUAP, 0, "\xf0\x90\x90\xa8{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
184 { CMUAP, 0, "\xe1\xbd\xb8\xe1\xbf\xb8", "\xe1\xbf\xb8\xe1\xbd\xb8" },
185
186 /* Assertions. */
187 { MUA, 0, "\\b[^A]", "A_B#" },
188 { MA, 0 | F_NOMATCH, "\\b\\W", "\n*" },
189 { MUA, 0, "\\B[^,]\\b[^s]\\b", "#X" },
190 { MAP, 0, "\\B", "_\xa1" },
191 { MAP, 0, "\\b_\\b[,A]\\B", "_," },
192 { MUAP, 0, "\\b", "\xe6\x92\xad!" },
193 { MUAP, 0, "\\B", "_\xc2\xa1\xc3\xa1\xc2\x85" },
194 { MUAP, 0, "\\b[^A]\\B[^c]\\b[^_]\\B", "_\xc3\xa1\xe2\x80\xa8" },
195 { MUAP, 0, "\\b\\w+\\B", "\xc3\x89\xc2\xa1\xe6\x92\xad\xc3\x81\xc3\xa1" },
196 { MUA, 0 | F_NOMATCH, "\\b.", "\xcd\xbe" },
197 { CMUAP, 0, "\\By", "\xf0\x90\x90\xa8y" },
198 { MA, 0 | F_NOMATCH, "\\R^", "\n" },
199 { MA, 1 | F_NOMATCH, "^", "\n" },
200 { 0, 0, "^ab", "ab" },
201 { 0, 0 | F_NOMATCH, "^ab", "aab" },
202 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 0, "^a", "\r\raa\n\naa\r\naa" },
203 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF, 0, "^-", "\xe2\x80\xa8--\xc2\x85-\r\n-" },
204 { PCRE_MULTILINE | PCRE_NEWLINE_ANY, 0, "^-", "a--b--\x85--" },
205 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANY, 0, "^-", "a--\xe2\x80\xa8--" },
206 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANY, 0, "^-", "a--\xc2\x85--" },
207 { 0, 0, "ab$", "ab" },
208 { 0, 0 | F_NOMATCH, "ab$", "abab\n\n" },
209 { PCRE_DOLLAR_ENDONLY, 0 | F_NOMATCH, "ab$", "abab\r\n" },
210 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 0, "a$", "\r\raa\n\naa\r\naa" },
211 { PCRE_MULTILINE | PCRE_NEWLINE_ANY, 0, "a$", "aaa" },
212 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANYCRLF, 0, "#$", "#\xc2\x85###\r#" },
213 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANY, 0, "#$", "#\xe2\x80\xa9" },
214 { PCRE_NOTBOL | PCRE_NEWLINE_ANY, 0 | F_NOMATCH, "^a", "aa\naa" },
215 { PCRE_NOTBOL | PCRE_MULTILINE | PCRE_NEWLINE_ANY, 0, "^a", "aa\naa" },
216 { PCRE_NOTEOL | PCRE_NEWLINE_ANY, 0 | F_NOMATCH, "a$", "aa\naa" },
217 { PCRE_NOTEOL | PCRE_NEWLINE_ANY, 0 | F_NOMATCH, "a$", "aa\r\n" },
218 { PCRE_UTF8 | PCRE_DOLLAR_ENDONLY | PCRE_NEWLINE_ANY, 0 | F_PROPERTY, "\\p{Any}{2,}$", "aa\r\n" },
219 { PCRE_NOTEOL | PCRE_MULTILINE | PCRE_NEWLINE_ANY, 0, "a$", "aa\naa" },
220 { PCRE_NEWLINE_CR, 0, ".\\Z", "aaa" },
221 { PCRE_NEWLINE_CR | PCRE_UTF8, 0, "a\\Z", "aaa\r" },
222 { PCRE_NEWLINE_CR, 0, ".\\Z", "aaa\n" },
223 { PCRE_NEWLINE_CRLF, 0, ".\\Z", "aaa\r" },
224 { PCRE_NEWLINE_CRLF | PCRE_UTF8, 0, ".\\Z", "aaa\n" },
225 { PCRE_NEWLINE_CRLF, 0, ".\\Z", "aaa\r\n" },
226 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa" },
227 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\r" },
228 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\n" },
229 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\r\n" },
230 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\xe2\x80\xa8" },
231 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa" },
232 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\r" },
233 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\n" },
234 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".\\Z", "aaa\r\n" },
235 { PCRE_NEWLINE_ANY | PCRE_UTF8, 0, ".\\Z", "aaa\xc2\x85" },
236 { PCRE_NEWLINE_ANY | PCRE_UTF8, 0, ".\\Z", "aaa\xe2\x80\xa8" },
237 { MA, 0, "\\Aa", "aaa" },
238 { MA, 1 | F_NOMATCH, "\\Aa", "aaa" },
239 { MA, 1, "\\Ga", "aaa" },
240 { MA, 1 | F_NOMATCH, "\\Ga", "aba" },
241 { MA, 0, "a\\z", "aaa" },
242 { MA, 0 | F_NOMATCH, "a\\z", "aab" },
243
244 /* Brackets. */
245 { MUA, 0, "(ab|bb|cd)", "bacde" },
246 { MUA, 0, "(?:ab|a)(bc|c)", "ababc" },
247 { MUA, 0, "((ab|(cc))|(bb)|(?:cd|efg))", "abac" },
248 { CMUA, 0, "((aB|(Cc))|(bB)|(?:cd|EFg))", "AcCe" },
249 { MUA, 0, "((ab|(cc))|(bb)|(?:cd|ebg))", "acebebg" },
250 { MUA, 0, "(?:(a)|(?:b))(cc|(?:d|e))(a|b)k", "accabdbbccbk" },
251
252 /* Greedy and non-greedy ? operators. */
253 { MUA, 0, "(?:a)?a", "laab" },
254 { CMUA, 0, "(A)?A", "llaab" },
255 { MUA, 0, "(a)?\?a", "aab" }, /* ?? is the prefix of trygraphs in GCC. */
256 { MUA, 0, "(a)?a", "manm" },
257 { CMUA, 0, "(a|b)?\?d((?:e)?)", "ABABdx" },
258 { MUA, 0, "(a|b)?\?d((?:e)?)", "abcde" },
259 { MUA, 0, "((?:ab)?\?g|b(?:g(nn|d)?\?)?)?\?(?:n)?m", "abgnbgnnbgdnmm" },
260
261 /* Greedy and non-greedy + operators */
262 { MUA, 0, "(aa)+aa", "aaaaaaa" },
263 { MUA, 0, "(aa)+?aa", "aaaaaaa" },
264 { MUA, 0, "(?:aba|ab|a)+l", "ababamababal" },
265 { MUA, 0, "(?:aba|ab|a)+?l", "ababamababal" },
266 { MUA, 0, "(a(?:bc|cb|b|c)+?|ss)+e", "accssabccbcacbccbbXaccssabccbcacbccbbe" },
267 { MUA, 0, "(a(?:bc|cb|b|c)+|ss)+?e", "accssabccbcacbccbbXaccssabccbcacbccbbe" },
268 { MUA, 0, "(?:(b(c)+?)+)?\?(?:(bc)+|(cb)+)+(?:m)+", "bccbcccbcbccbcbPbccbcccbcbccbcbmmn" },
269
270 /* Greedy and non-greedy * operators */
271 { CMUA, 0, "(?:AA)*AB", "aaaaaaamaaaaaaab" },
272 { MUA, 0, "(?:aa)*?ab", "aaaaaaamaaaaaaab" },
273 { MUA, 0, "(aa|ab)*ab", "aaabaaab" },
274 { CMUA, 0, "(aa|Ab)*?aB", "aaabaaab" },
275 { MUA, 0, "(a|b)*(?:a)*(?:b)*m", "abbbaaababanabbbaaababamm" },
276 { MUA, 0, "(a|b)*?(?:a)*?(?:b)*?m", "abbbaaababanabbbaaababamm" },
277 { MA, 0, "a(a(\\1*)a|(b)b+){0}a", "aa" },
278 { MA, 0, "((?:a|)*){0}a", "a" },
279
280 /* Combining ? + * operators */
281 { MUA, 0, "((bm)+)?\?(?:a)*(bm)+n|((am)+?)?(?:a)+(am)*n", "bmbmabmamaaamambmaman" },
282 { MUA, 0, "(((ab)?cd)*ef)+g", "abcdcdefcdefefmabcdcdefcdefefgg" },
283 { MUA, 0, "(((ab)?\?cd)*?ef)+?g", "abcdcdefcdefefmabcdcdefcdefefgg" },
284 { MUA, 0, "(?:(ab)?c|(?:ab)+?d)*g", "ababcdccababddg" },
285 { MUA, 0, "(?:(?:ab)?\?c|(ab)+d)*?g", "ababcdccababddg" },
286
287 /* Single character iterators. */
288 { MUA, 0, "(a+aab)+aaaab", "aaaabcaaaabaabcaabcaaabaaaab" },
289 { MUA, 0, "(a*a*aab)+x", "aaaaabaabaaabmaabx" },
290 { MUA, 0, "(a*?(b|ab)a*?)+x", "aaaabcxbbaabaacbaaabaabax" },
291 { MUA, 0, "(a+(ab|ad)a+)+x", "aaabaaaadaabaaabaaaadaaax" },
292 { MUA, 0, "(a?(a)a?)+(aaa)", "abaaabaaaaaaaa" },
293 { MUA, 0, "(a?\?(a)a?\?)+(b)", "aaaacaaacaacacbaaab" },
294 { MUA, 0, "(a{0,4}(b))+d", "aaaaaabaabcaaaaabaaaaabd" },
295 { MUA, 0, "(a{0,4}?[^b])+d+(a{0,4}[^b])d+", "aaaaadaaaacaadddaaddd" },
296 { MUA, 0, "(ba{2})+c", "baabaaabacbaabaac" },
297 { MUA, 0, "(a*+bc++)+", "aaabbcaaabcccab" },
298 { MUA, 0, "(a?+[^b])+", "babaacacb" },
299 { MUA, 0, "(a{0,3}+b)(a{0,3}+b)(a{0,3}+)[^c]", "abaabaaacbaabaaaac" },
300 { CMUA, 0, "([a-c]+[d-f]+?)+?g", "aBdacdehAbDaFgA" },
301 { CMUA, 0, "[c-f]+k", "DemmFke" },
302 { MUA, 0, "([DGH]{0,4}M)+", "GGDGHDGMMHMDHHGHM" },
303 { MUA, 0, "([a-c]{4,}s)+", "abasabbasbbaabsbba" },
304 { CMUA, 0, "[ace]{3,7}", "AcbDAcEEcEd" },
305 { CMUA, 0, "[ace]{3,7}?", "AcbDAcEEcEd" },
306 { CMUA, 0, "[ace]{3,}", "AcbDAcEEcEd" },
307 { CMUA, 0, "[ace]{3,}?", "AcbDAcEEcEd" },
308 { MUA, 0, "[ckl]{2,}?g", "cdkkmlglglkcg" },
309 { CMUA, 0, "[ace]{5}?", "AcCebDAcEEcEd" },
310 { MUA, 0, "([AbC]{3,5}?d)+", "BACaAbbAEAACCbdCCbdCCAAbb" },
311 { MUA, 0, "([^ab]{0,}s){2}", "abaabcdsABamsDDs" },
312 { MUA, 0, "\\b\\w+\\B", "x,a_cd" },
313 { MUAP, 0, "\\b[^\xc2\xa1]+\\B", "\xc3\x89\xc2\xa1\xe6\x92\xad\xc3\x81\xc3\xa1" },
314 { CMUA, 0, "[^b]+(a*)([^c]?d{3})", "aaaaddd" },
315 { CMUAP, 0, "\xe1\xbd\xb8{2}", "\xe1\xbf\xb8#\xe1\xbf\xb8\xe1\xbd\xb8" },
316 { CMUA, 0, "[^\xf0\x90\x90\x80]{2,4}@", "\xf0\x90\x90\xa8\xf0\x90\x90\x80###\xf0\x90\x90\x80@@@" },
317 { CMUA, 0, "[^\xe1\xbd\xb8][^\xc3\xa9]", "\xe1\xbd\xb8\xe1\xbf\xb8\xc3\xa9\xc3\x89#" },
318 { MUA, 0, "[^\xe1\xbd\xb8][^\xc3\xa9]", "\xe1\xbd\xb8\xe1\xbf\xb8\xc3\xa9\xc3\x89#" },
319 { MUA, 0, "[^\xe1\xbd\xb8]{3,}?", "##\xe1\xbd\xb8#\xe1\xbd\xb8#\xc3\x89#\xe1\xbd\xb8" },
320
321 /* Bracket repeats with limit. */
322 { MUA, 0, "(?:(ab){2}){5}M", "abababababababababababM" },
323 { MUA, 0, "(?:ab|abab){1,5}M", "abababababababababababM" },
324 { MUA, 0, "(?>ab|abab){1,5}M", "abababababababababababM" },
325 { MUA, 0, "(?:ab|abab){1,5}?M", "abababababababababababM" },
326 { MUA, 0, "(?>ab|abab){1,5}?M", "abababababababababababM" },
327 { MUA, 0, "(?:(ab){1,4}?){1,3}?M", "abababababababababababababM" },
328 { MUA, 0, "(?:(ab){1,4}){1,3}abababababababababababM", "ababababababababababababM" },
329 { MUA, 0 | F_NOMATCH, "(?:(ab){1,4}){1,3}abababababababababababM", "abababababababababababM" },
330 { MUA, 0, "(ab){4,6}?M", "abababababababM" },
331
332 /* Basic character sets. */
333 { MUA, 0, "(?:\\s)+(?:\\S)+", "ab \t\xc3\xa9\xe6\x92\xad " },
334 { MUA, 0, "(\\w)*(k)(\\W)?\?", "abcdef abck11" },
335 { MUA, 0, "\\((\\d)+\\)\\D", "a() (83 (8)2 (9)ab" },
336 { MUA, 0, "\\w(\\s|(?:\\d)*,)+\\w\\wb", "a 5, 4,, bb 5, 4,, aab" },
337 { MUA, 0, "(\\v+)(\\V+)", "\x0e\xc2\x85\xe2\x80\xa8\x0b\x09\xe2\x80\xa9" },
338 { MUA, 0, "(\\h+)(\\H+)", "\xe2\x80\xa8\xe2\x80\x80\x20\xe2\x80\x8a\xe2\x81\x9f\xe3\x80\x80\x09\x20\xc2\xa0\x0a" },
339 { MUA, 0, "x[bcef]+", "xaxdxecbfg" },
340 { MUA, 0, "x[bcdghij]+", "xaxexfxdgbjk" },
341 { MUA, 0, "x[^befg]+", "xbxexacdhg" },
342 { MUA, 0, "x[^bcdl]+", "xlxbxaekmd" },
343 { MUA, 0, "x[^bcdghi]+", "xbxdxgxaefji" },
344 { MUA, 0, "x[B-Fb-f]+", "xaxAxgxbfBFG" },
345 { CMUA, 0, "\\x{e9}+", "#\xf0\x90\x90\xa8\xc3\xa8\xc3\xa9\xc3\x89\xc3\x88" },
346 { CMUA, 0, "[^\\x{e9}]+", "\xc3\xa9#\xf0\x90\x90\xa8\xc3\xa8\xc3\x88\xc3\x89" },
347 { MUA, 0, "[\\x02\\x7e]+", "\xc3\x81\xe1\xbf\xb8\xf0\x90\x90\xa8\x01\x02\x7e\x7f" },
348 { MUA, 0, "[^\\x02\\x7e]+", "\x02\xc3\x81\xe1\xbf\xb8\xf0\x90\x90\xa8\x01\x7f\x7e" },
349 { MUA, 0, "[\\x{81}-\\x{7fe}]+", "#\xe1\xbf\xb8\xf0\x90\x90\xa8\xc2\x80\xc2\x81\xdf\xbe\xdf\xbf" },
350 { MUA, 0, "[^\\x{81}-\\x{7fe}]+", "\xc2\x81#\xe1\xbf\xb8\xf0\x90\x90\xa8\xc2\x80\xdf\xbf\xdf\xbe" },
351 { MUA, 0, "[\\x{801}-\\x{fffe}]+", "#\xc3\xa9\xf0\x90\x90\x80\xe0\xa0\x80\xe0\xa0\x81\xef\xbf\xbe\xef\xbf\xbf" },
352 { MUA, 0, "[^\\x{801}-\\x{fffe}]+", "\xe0\xa0\x81#\xc3\xa9\xf0\x90\x90\x80\xe0\xa0\x80\xef\xbf\xbf\xef\xbf\xbe" },
353 { MUA, 0, "[\\x{10001}-\\x{10fffe}]+", "#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf0\x90\x80\x81\xf4\x8f\xbf\xbe\xf4\x8f\xbf\xbf" },
354 { MUA, 0, "[^\\x{10001}-\\x{10fffe}]+", "\xf0\x90\x80\x81#\xc3\xa9\xe2\xb1\xa5\xf0\x90\x80\x80\xf4\x8f\xbf\xbf\xf4\x8f\xbf\xbe" },
355
356 /* Unicode properties. */
357 { MUAP, 0, "[1-5\xc3\xa9\\w]", "\xc3\xa1_" },
358 { MUAP, 0 | F_PROPERTY, "[\xc3\x81\\p{Ll}]", "A_\xc3\x89\xc3\xa1" },
359 { MUAP, 0, "[\\Wd-h_x-z]+", "a\xc2\xa1#_yhzdxi" },
360 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[\\P{Any}]", "abc" },
361 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[^\\p{Any}]", "abc" },
362 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[\\P{Any}\xc3\xa1-\xc3\xa8]", "abc" },
363 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[^\\p{Any}\xc3\xa1-\xc3\xa8]", "abc" },
364 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[\xc3\xa1-\xc3\xa8\\P{Any}]", "abc" },
365 { MUAP, 0 | F_NOMATCH | F_PROPERTY, "[^\xc3\xa1-\xc3\xa8\\p{Any}]", "abc" },
366 { MUAP, 0 | F_PROPERTY, "[\xc3\xa1-\xc3\xa8\\p{Any}]", "abc" },
367 { MUAP, 0 | F_PROPERTY, "[^\xc3\xa1-\xc3\xa8\\P{Any}]", "abc" },
368 { MUAP, 0, "[b-\xc3\xa9\\s]", "a\xc\xe6\x92\xad" },
369 { CMUAP, 0, "[\xc2\x85-\xc2\x89\xc3\x89]", "\xc2\x84\xc3\xa9" },
370 { MUAP, 0, "[^b-d^&\\s]{3,}", "db^ !a\xe2\x80\xa8_ae" },
371 { MUAP, 0 | F_PROPERTY, "[^\\S\\P{Any}][\\sN]{1,3}[\\P{N}]{4}", "\xe2\x80\xaa\xa N\x9\xc3\xa9_0" },
372 { MUA, 0 | F_PROPERTY, "[^\\P{L}\x9!D-F\xa]{2,3}", "\x9,.DF\xa.CG\xc3\x81" },
373 { CMUAP, 0, "[\xc3\xa1-\xc3\xa9_\xe2\x80\xa0-\xe2\x80\xaf]{1,5}[^\xe2\x80\xa0-\xe2\x80\xaf]", "\xc2\xa1\xc3\x89\xc3\x89\xe2\x80\xaf_\xe2\x80\xa0" },
374 { MUAP, 0 | F_PROPERTY, "[\xc3\xa2-\xc3\xa6\xc3\x81-\xc3\x84\xe2\x80\xa8-\xe2\x80\xa9\xe6\x92\xad\\p{Zs}]{2,}", "\xe2\x80\xa7\xe2\x80\xa9\xe6\x92\xad \xe6\x92\xae" },
375 { MUAP, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" },
376 { PCRE_UCP, 0, "[a-b\\s]{2,5}[^a]", "AB baaa" },
377
378 /* Possible empty brackets. */
379 { MUA, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
380 { MUA, 0, "(|ab||bc|a)+d", "abcxabcabd" },
381 { MUA, 0, "(?:|ab||bc|a)*d", "abcxabcabd" },
382 { MUA, 0, "(|ab||bc|a)*d", "abcxabcabd" },
383 { MUA, 0, "(?:|ab||bc|a)+?d", "abcxabcabd" },
384 { MUA, 0, "(|ab||bc|a)+?d", "abcxabcabd" },
385 { MUA, 0, "(?:|ab||bc|a)*?d", "abcxabcabd" },
386 { MUA, 0, "(|ab||bc|a)*?d", "abcxabcabd" },
387 { MUA, 0, "(((a)*?|(?:ba)+)+?|(?:|c|ca)*)*m", "abaacaccabacabalabaacaccabacabamm" },
388 { MUA, 0, "(?:((?:a)*|(ba)+?)+|(|c|ca)*?)*?m", "abaacaccabacabalabaacaccabacabamm" },
389
390 /* Start offset. */
391 { MUA, 3, "(\\d|(?:\\w)*\\w)+", "0ac01Hb" },
392 { MUA, 4 | F_NOMATCH, "(\\w\\W\\w)+", "ab#d" },
393 { MUA, 2 | F_NOMATCH, "(\\w\\W\\w)+", "ab#d" },
394 { MUA, 1, "(\\w\\W\\w)+", "ab#d" },
395
396 /* Newline. */
397 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 0, "\\W{0,2}[^#]{3}", "\r\n#....." },
398 { PCRE_MULTILINE | PCRE_NEWLINE_CR, 0, "\\W{0,2}[^#]{3}", "\r\n#....." },
399 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 0, "\\W{1,3}[^#]", "\r\n##...." },
400 { MUA | PCRE_NO_UTF8_CHECK, 1, "^.a", "\n\x80\nxa" },
401 { MUA, 1, "^", "\r\n" },
402 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 1 | F_NOMATCH, "^", "\r\n" },
403 { PCRE_MULTILINE | PCRE_NEWLINE_CRLF, 1, "^", "\r\na" },
404
405 /* Any character except newline or any newline. */
406 { PCRE_NEWLINE_CRLF, 0, ".", "\r" },
407 { PCRE_NEWLINE_CRLF | PCRE_UTF8, 0, ".(.).", "a\xc3\xa1\r\n\n\r\r" },
408 { PCRE_NEWLINE_ANYCRLF, 0, ".(.)", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa8" },
409 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0, ".(.)", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa8" },
410 { PCRE_NEWLINE_ANY | PCRE_UTF8, 0, "(.).", "a\rb\nc\r\n\xc2\x85\xe2\x80\xa9$de" },
411 { PCRE_NEWLINE_ANYCRLF | PCRE_UTF8, 0 | F_NOMATCH, ".(.).", "\xe2\x80\xa8\nb\r" },
412 { PCRE_NEWLINE_ANY, 0, "(.)(.)", "#\x85#\r#\n#\r\n#\x84" },
413 { PCRE_NEWLINE_ANY | PCRE_UTF8, 0, "(.+)#", "#\rMn\xc2\x85#\n###" },
414 { PCRE_BSR_ANYCRLF, 0, "\\R", "\r" },
415 { PCRE_BSR_ANYCRLF, 0, "\\R", "\x85#\r\n#" },
416 { PCRE_BSR_UNICODE | PCRE_UTF8, 0, "\\R", "ab\xe2\x80\xa8#c" },
417 { PCRE_BSR_UNICODE | PCRE_UTF8, 0, "\\R", "ab\r\nc" },
418 { PCRE_NEWLINE_CRLF | PCRE_BSR_UNICODE | PCRE_UTF8, 0, "(\\R.)+", "\xc2\x85\r\n#\xe2\x80\xa8\n\r\n\r" },
419 { MUA, 0 | F_NOMATCH, "\\R+", "ab" },
420 { MUA, 0, "\\R+", "ab\r\n\r" },
421 { MUA, 0, "\\R*", "ab\r\n\r" },
422 { MUA, 0, "\\R*", "\r\n\r" },
423 { MUA, 0, "\\R{2,4}", "\r\nab\r\r" },
424 { MUA, 0, "\\R{2,4}", "\r\nab\n\n\n\r\r\r" },
425 { MUA, 0, "\\R{2,}", "\r\nab\n\n\n\r\r\r" },
426 { MUA, 0, "\\R{0,3}", "\r\n\r\n\r\n\r\n\r\n" },
427 { MUA, 0 | F_NOMATCH, "\\R+\\R\\R", "\r\n\r\n" },
428 { MUA, 0, "\\R+\\R\\R", "\r\r\r" },
429 { MUA, 0, "\\R*\\R\\R", "\n\r" },
430 { MUA, 0 | F_NOMATCH, "\\R{2,4}\\R\\R", "\r\r\r" },
431 { MUA, 0, "\\R{2,4}\\R\\R", "\r\r\r\r" },
432
433 /* Atomic groups (no fallback from "next" direction). */
434 { MUA, 0 | F_NOMATCH, "(?>ab)ab", "bab" },
435 { MUA, 0 | F_NOMATCH, "(?>(ab))ab", "bab" },
436 { MUA, 0, "(?>ab)+abc(?>de)*def(?>gh)?ghe(?>ij)+?k(?>lm)*?n(?>op)?\?op",
437 "bababcdedefgheijijklmlmnop" },
438 { MUA, 0, "(?>a(b)+a|(ab)?\?(b))an", "abban" },
439 { MUA, 0, "(?>ab+a|(?:ab)?\?b)an", "abban" },
440 { MUA, 0, "((?>ab|ad|)*?)(?>|c)*abad", "abababcababad" },
441 { MUA, 0, "(?>(aa|b|)*+(?>(##)|###)*d|(aa)(?>(baa)?)m)", "aabaa#####da" },
442 { MUA, 0, "((?>a|)+?)b", "aaacaaab" },
443 { MUA, 0, "(?>x|)*$", "aaa" },
444 { MUA, 0, "(?>(x)|)*$", "aaa" },
445 { MUA, 0, "(?>x|())*$", "aaa" },
446 { MUA, 0, "((?>[cxy]a|[a-d])*?)b", "aaa+ aaab" },
447 { MUA, 0, "((?>[cxy](a)|[a-d])*?)b", "aaa+ aaab" },
448 { MUA, 0, "(?>((?>(a+))))bab|(?>((?>(a+))))bb", "aaaabaaabaabab" },
449 { MUA, 0, "(?>(?>a+))bab|(?>(?>a+))bb", "aaaabaaabaabab" },
450 { MUA, 0, "(?>(a)c|(?>(c)|(a))a)b*?bab", "aaaabaaabaabab" },
451 { MUA, 0, "(?>ac|(?>c|a)a)b*?bab", "aaaabaaabaabab" },
452 { MUA, 0, "(?>(b)b|(a))*b(?>(c)|d)?x", "ababcaaabdbx" },
453 { MUA, 0, "(?>bb|a)*b(?>c|d)?x", "ababcaaabdbx" },
454 { MUA, 0, "(?>(bb)|a)*b(?>c|(d))?x", "ababcaaabdbx" },
455 { MUA, 0, "(?>(a))*?(?>(a))+?(?>(a))??x", "aaaaaacccaaaaabax" },
456 { MUA, 0, "(?>a)*?(?>a)+?(?>a)??x", "aaaaaacccaaaaabax" },
457 { MUA, 0, "(?>(a)|)*?(?>(a)|)+?(?>(a)|)??x", "aaaaaacccaaaaabax" },
458 { MUA, 0, "(?>a|)*?(?>a|)+?(?>a|)??x", "aaaaaacccaaaaabax" },
459 { MUA, 0, "(?>a(?>(a{0,2}))*?b|aac)+b", "aaaaaaacaaaabaaaaacaaaabaacaaabb" },
460 { CMA, 0, "(?>((?>a{32}|b+|(a*))?(?>c+|d*)?\?)+e)+?f", "aaccebbdde bbdaaaccebbdee bbdaaaccebbdeef" },
461 { MUA, 0, "(?>(?:(?>aa|a||x)+?b|(?>aa|a||(x))+?c)?(?>[ad]{0,2})*?d)+d", "aaacdbaabdcabdbaaacd aacaabdbdcdcaaaadaabcbaadd" },
462 { MUA, 0, "(?>(?:(?>aa|a||(x))+?b|(?>aa|a||x)+?c)?(?>[ad]{0,2})*?d)+d", "aaacdbaabdcabdbaaacd aacaabdbdcdcaaaadaabcbaadd" },
463 { MUA, 0 | F_PROPERTY, "\\X", "\xcc\x8d\xcc\x8d" },
464 { MUA, 0 | F_PROPERTY, "\\X", "\xcc\x8d\xcc\x8d#\xcc\x8d\xcc\x8d" },
465 { MUA, 0 | F_PROPERTY, "\\X+..", "\xcc\x8d#\xcc\x8d#\xcc\x8d\xcc\x8d" },
466 { MUA, 0 | F_PROPERTY, "\\X{2,4}", "abcdef" },
467 { MUA, 0 | F_PROPERTY, "\\X{2,4}?", "abcdef" },
468 { MUA, 0 | F_NOMATCH | F_PROPERTY, "\\X{2,4}..", "#\xcc\x8d##" },
469 { MUA, 0 | F_PROPERTY, "\\X{2,4}..", "#\xcc\x8d#\xcc\x8d##" },
470 { MUA, 0, "(c(ab)?+ab)+", "cabcababcab" },
471 { MUA, 0, "(?>(a+)b)+aabab", "aaaabaaabaabab" },
472
473 /* Possessive quantifiers. */
474 { MUA, 0, "(?:a|b)++m", "mababbaaxababbaam" },
475 { MUA, 0, "(?:a|b)*+m", "mababbaaxababbaam" },
476 { MUA, 0, "(?:a|b)*+m", "ababbaaxababbaam" },
477 { MUA, 0, "(a|b)++m", "mababbaaxababbaam" },
478 { MUA, 0, "(a|b)*+m", "mababbaaxababbaam" },
479 { MUA, 0, "(a|b)*+m", "ababbaaxababbaam" },
480 { MUA, 0, "(a|b(*ACCEPT))++m", "maaxab" },
481 { MUA, 0, "(?:b*)++m", "bxbbxbbbxm" },
482 { MUA, 0, "(?:b*)++m", "bxbbxbbbxbbm" },
483 { MUA, 0, "(?:b*)*+m", "bxbbxbbbxm" },
484 { MUA, 0, "(?:b*)*+m", "bxbbxbbbxbbm" },
485 { MUA, 0, "(b*)++m", "bxbbxbbbxm" },
486 { MUA, 0, "(b*)++m", "bxbbxbbbxbbm" },
487 { MUA, 0, "(b*)*+m", "bxbbxbbbxm" },
488 { MUA, 0, "(b*)*+m", "bxbbxbbbxbbm" },
489 { MUA, 0, "(?:a|(b))++m", "mababbaaxababbaam" },
490 { MUA, 0, "(?:(a)|b)*+m", "mababbaaxababbaam" },
491 { MUA, 0, "(?:(a)|(b))*+m", "ababbaaxababbaam" },
492 { MUA, 0, "(a|(b))++m", "mababbaaxababbaam" },
493 { MUA, 0, "((a)|b)*+m", "mababbaaxababbaam" },
494 { MUA, 0, "((a)|(b))*+m", "ababbaaxababbaam" },
495 { MUA, 0, "(a|(b)(*ACCEPT))++m", "maaxab" },
496 { MUA, 0, "(?:(b*))++m", "bxbbxbbbxm" },
497 { MUA, 0, "(?:(b*))++m", "bxbbxbbbxbbm" },
498 { MUA, 0, "(?:(b*))*+m", "bxbbxbbbxm" },
499 { MUA, 0, "(?:(b*))*+m", "bxbbxbbbxbbm" },
500 { MUA, 0, "((b*))++m", "bxbbxbbbxm" },
501 { MUA, 0, "((b*))++m", "bxbbxbbbxbbm" },
502 { MUA, 0, "((b*))*+m", "bxbbxbbbxm" },
503 { MUA, 0, "((b*))*+m", "bxbbxbbbxbbm" },
504 { MUA, 0 | F_NOMATCH, "(?>(b{2,4}))(?:(?:(aa|c))++m|(?:(aa|c))+n)", "bbaacaaccaaaacxbbbmbn" },
505 { MUA, 0, "((?:b)++a)+(cd)*+m", "bbababbacdcdnbbababbacdcdm" },
506 { MUA, 0, "((?:(b))++a)+((c)d)*+m", "bbababbacdcdnbbababbacdcdm" },
507 { MUA, 0, "(?:(?:(?:ab)*+k)++(?:n(?:cd)++)*+)*+m", "ababkkXababkkabkncXababkkabkncdcdncdXababkkabkncdcdncdkkabkncdXababkkabkncdcdncdkkabkncdm" },
508 { MUA, 0, "(?:((ab)*+(k))++(n(?:c(d))++)*+)*+m", "ababkkXababkkabkncXababkkabkncdcdncdXababkkabkncdcdncdkkabkncdXababkkabkncdcdncdkkabkncdm" },
509
510 /* Back references. */
511 { MUA, 0, "(aa|bb)(\\1*)(ll|)(\\3*)bbbbbbc", "aaaaaabbbbbbbbc" },
512 { CMUA, 0, "(aa|bb)(\\1+)(ll|)(\\3+)bbbbbbc", "bBbbBbCbBbbbBbbcbbBbbbBBbbC" },
513 { CMA, 0, "(a{2,4})\\1", "AaAaaAaA" },
514 { MUA, 0, "(aa|bb)(\\1?)aa(\\1?)(ll|)(\\4+)bbc", "aaaaaaaabbaabbbbaabbbbc" },
515 { MUA, 0, "(aa|bb)(\\1{0,5})(ll|)(\\3{0,5})cc", "bbxxbbbbxxaaaaaaaaaaaaaaaacc" },
516 { MUA, 0, "(aa|bb)(\\1{3,5})(ll|)(\\3{3,5})cc", "bbbbbbbbbbbbaaaaaaccbbbbbbbbbbbbbbcc" },
517 { MUA, 0, "(aa|bb)(\\1{3,})(ll|)(\\3{3,})cc", "bbbbbbbbbbbbaaaaaaccbbbbbbbbbbbbbbcc" },
518 { MUA, 0, "(\\w+)b(\\1+)c", "GabGaGaDbGaDGaDc" },
519 { MUA, 0, "(?:(aa)|b)\\1?b", "bb" },
520 { CMUA, 0, "(aa|bb)(\\1*?)aa(\\1+?)", "bBBbaaAAaaAAaa" },
521 { MUA, 0, "(aa|bb)(\\1*?)(dd|)cc(\\3+?)", "aaaaaccdd" },
522 { CMUA, 0, "(?:(aa|bb)(\\1?\?)cc){2}(\\1?\?)", "aAaABBbbAAaAcCaAcCaA" },
523 { MUA, 0, "(?:(aa|bb)(\\1{3,5}?)){2}(dd|)(\\3{3,5}?)", "aaaaaabbbbbbbbbbaaaaaaaaaaaaaa" },
524 { CMA, 0, "(?:(aa|bb)(\\1{3,}?)){2}(dd|)(\\3{3,}?)", "aaaaaabbbbbbbbbbaaaaaaaaaaaaaa" },
525 { MUA, 0, "(?:(aa|bb)(\\1{0,3}?)){2}(dd|)(\\3{0,3}?)b(\\1{0,3}?)(\\1{0,3})", "aaaaaaaaaaaaaaabaaaaa" },
526 { MUA, 0, "(a(?:\\1|)a){3}b", "aaaaaaaaaaab" },
527 { MA, 0, "(a?)b(\\1\\1*\\1+\\1?\\1*?\\1+?\\1??\\1*+\\1++\\1?+\\1{4}\\1{3,5}\\1{4,}\\1{0,5}\\1{3,5}?\\1{4,}?\\1{0,5}?\\1{3,5}+\\1{4,}+\\1{0,5}+#){2}d", "bb#b##d" },
528 { MUAP, 0 | F_PROPERTY, "(\\P{N})\\1{2,}", ".www." },
529 { MUAP, 0 | F_PROPERTY, "(\\P{N})\\1{0,2}", "wwwww." },
530 { MUAP, 0 | F_PROPERTY, "(\\P{N})\\1{1,2}ww", "wwww" },
531 { MUAP, 0 | F_PROPERTY, "(\\P{N})\\1{1,2}ww", "wwwww" },
532 { PCRE_UCP, 0 | F_PROPERTY, "(\\P{N})\\1{2,}", ".www." },
533 { CMUAP, 0, "(\xf0\x90\x90\x80)\\1", "\xf0\x90\x90\xa8\xf0\x90\x90\xa8" },
534 { MUA | PCRE_DUPNAMES, 0 | F_NOMATCH, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
535 { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
536 { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>*(?<A>aa)(?<A>bb)", "aabb" },
537 { MUA | PCRE_DUPNAMES, 0, "(?<A>aa)(?<A>bb)\\k<A>{0,3}aaaaaa", "aabbaaaaaa" },
538 { MUA | PCRE_DUPNAMES, 0, "(?<A>aa)(?<A>bb)\\k<A>{2,5}bb", "aabbaaaabb" },
539 { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}m", "aaaaaaaabbbbaabbbbm" },
540 { MUA | PCRE_DUPNAMES, 0 | F_NOMATCH, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
541 { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
542 { MUA | PCRE_DUPNAMES, 0, "\\k<A>*?(?<A>aa)(?<A>bb)", "aabb" },
543 { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
544 { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>*?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
545 { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
546 { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}M", "aaaaaaaabbbbaabbbbm" },
547 { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{1,3}M", "aaaaaaaabbbbaabbbbm" },
548 { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}?M", "aaaaaabbbbbbaabbbbbbbbbbm" },
549 { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
550
551 /* Assertions. */
552 { MUA, 0, "(?=xx|yy|zz)\\w{4}", "abczzdefg" },
553 { MUA, 0, "(?=((\\w+)b){3}|ab)", "dbbbb ab" },
554 { MUA, 0, "(?!ab|bc|cd)[a-z]{2}", "Xabcdef" },
555 { MUA, 0, "(?<=aaa|aa|a)a", "aaa" },
556 { MUA, 2, "(?<=aaa|aa|a)a", "aaa" },
557 { MA, 0, "(?<=aaa|aa|a)a", "aaa" },
558 { MA, 2, "(?<=aaa|aa|a)a", "aaa" },
559 { MUA, 0, "(\\d{2})(?!\\w+c|(((\\w?)m){2}n)+|\\1)", "x5656" },
560 { MUA, 0, "((?=((\\d{2,6}\\w){2,}))\\w{5,20}K){2,}", "567v09708K12l00M00 567v09708K12l00M00K45K" },
561 { MUA, 0, "(?=(?:(?=\\S+a)\\w*(b)){3})\\w+\\d", "bba bbab nbbkba nbbkba0kl" },
562 { MUA, 0, "(?>a(?>(b+))a(?=(..)))*?k", "acabbcabbaabacabaabbakk" },
563 { MUA, 0, "((?(?=(a))a)+k)", "bbak" },
564 { MUA, 0, "((?(?=a)a)+k)", "bbak" },
565 { MUA, 0 | F_NOMATCH, "(?=(?>(a))m)amk", "a k" },
566 { MUA, 0 | F_NOMATCH, "(?!(?>(a))m)amk", "a k" },
567 { MUA, 0 | F_NOMATCH, "(?>(?=(a))am)amk", "a k" },
568 { MUA, 0, "(?=(?>a|(?=(?>(b+))a|c)[a-c]+)*?m)[a-cm]+k", "aaam bbam baaambaam abbabba baaambaamk" },
569 { MUA, 0, "(?> ?\?\\b(?(?=\\w{1,4}(a))m)\\w{0,8}bc){2,}?", "bca ssbc mabd ssbc mabc" },
570 { MUA, 0, "(?:(?=ab)?[^n][^n])+m", "ababcdabcdcdabnababcdabcdcdabm" },
571 { MUA, 0, "(?:(?=a(b))?[^n][^n])+m", "ababcdabcdcdabnababcdabcdcdabm" },
572 { MUA, 0, "(?:(?=.(.))??\\1.)+m", "aabbbcbacccanaabbbcbacccam" },
573 { MUA, 0, "(?:(?=.)??[a-c])+m", "abacdcbacacdcaccam" },
574 { MUA, 0, "((?!a)?(?!([^a]))?)+$", "acbab" },
575 { MUA, 0, "((?!a)?\?(?!([^a]))?\?)+$", "acbab" },
576
577 /* Not empty, ACCEPT, FAIL */
578 { MUA | PCRE_NOTEMPTY, 0 | F_NOMATCH, "a*", "bcx" },
579 { MUA | PCRE_NOTEMPTY, 0, "a*", "bcaad" },
580 { MUA | PCRE_NOTEMPTY, 0, "a*?", "bcaad" },
581 { MUA | PCRE_NOTEMPTY_ATSTART, 0, "a*", "bcaad" },
582 { MUA, 0, "a(*ACCEPT)b", "ab" },
583 { MUA | PCRE_NOTEMPTY, 0 | F_NOMATCH, "a*(*ACCEPT)b", "bcx" },
584 { MUA | PCRE_NOTEMPTY, 0, "a*(*ACCEPT)b", "bcaad" },
585 { MUA | PCRE_NOTEMPTY, 0, "a*?(*ACCEPT)b", "bcaad" },
586 { MUA | PCRE_NOTEMPTY, 0 | F_NOMATCH, "(?:z|a*(*ACCEPT)b)", "bcx" },
587 { MUA | PCRE_NOTEMPTY, 0, "(?:z|a*(*ACCEPT)b)", "bcaad" },
588 { MUA | PCRE_NOTEMPTY, 0, "(?:z|a*?(*ACCEPT)b)", "bcaad" },
589 { MUA | PCRE_NOTEMPTY_ATSTART, 0, "a*(*ACCEPT)b", "bcx" },
590 { MUA | PCRE_NOTEMPTY_ATSTART, 0 | F_NOMATCH, "a*(*ACCEPT)b", "" },
591 { MUA, 0, "((a(*ACCEPT)b))", "ab" },
592 { MUA, 0, "(a(*FAIL)a|a)", "aaa" },
593 { MUA, 0, "(?=ab(*ACCEPT)b)a", "ab" },
594 { MUA, 0, "(?=(?:x|ab(*ACCEPT)b))", "ab" },
595 { MUA, 0, "(?=(a(b(*ACCEPT)b)))a", "ab" },
596 { MUA | PCRE_NOTEMPTY, 0, "(?=a*(*ACCEPT))c", "c" },
597
598 /* Conditional blocks. */
599 { MUA, 0, "(?(?=(a))a|b)+k", "ababbalbbadabak" },
600 { MUA, 0, "(?(?!(b))a|b)+k", "ababbalbbadabak" },
601 { MUA, 0, "(?(?=a)a|b)+k", "ababbalbbadabak" },
602 { MUA, 0, "(?(?!b)a|b)+k", "ababbalbbadabak" },
603 { MUA, 0, "(?(?=(a))a*|b*)+k", "ababbalbbadabak" },
604 { MUA, 0, "(?(?!(b))a*|b*)+k", "ababbalbbadabak" },
605 { MUA, 0, "(?(?!(b))(?:aaaaaa|a)|(?:bbbbbb|b))+aaaak", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb aaaaaaak" },
606 { MUA, 0, "(?(?!b)(?:aaaaaa|a)|(?:bbbbbb|b))+aaaak", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb aaaaaaak" },
607 { MUA, 0 | F_DIFF, "(?(?!(b))(?:aaaaaa|a)|(?:bbbbbb|b))+bbbbk", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb bbbbbbbk" },
608 { MUA, 0, "(?(?!b)(?:aaaaaa|a)|(?:bbbbbb|b))+bbbbk", "aaaaaaaaaaaaaa bbbbbbbbbbbbbbb bbbbbbbk" },
609 { MUA, 0, "(?(?=a)a*|b*)+k", "ababbalbbadabak" },
610 { MUA, 0, "(?(?!b)a*|b*)+k", "ababbalbbadabak" },
611 { MUA, 0, "(?(?=a)ab)", "a" },
612 { MUA, 0, "(?(?<!b)c)", "b" },
613 { MUA, 0, "(?(DEFINE)a(b))", "a" },
614 { MUA, 0, "a(?(DEFINE)(?:b|(?:c?)+)*)", "a" },
615 { MUA, 0, "(?(?=.[a-c])[k-l]|[A-D])", "kdB" },
616 { MUA, 0, "(?(?!.{0,4}[cd])(aa|bb)|(cc|dd))+", "aabbccddaa" },
617 { MUA, 0, "(?(?=[^#@]*@)(aaab|aa|aba)|(aba|aab)){3,}", "aaabaaaba#aaabaaaba#aaabaaaba@" },
618 { MUA, 0, "((?=\\w{5})\\w(?(?=\\w*k)\\d|[a-f_])*\\w\\s)+", "mol m10kk m088k _f_a_ mbkkl" },
619 { MUA, 0, "(c)?\?(?(1)a|b)", "cdcaa" },
620 { MUA, 0, "(c)?\?(?(1)a|b)", "cbb" },
621 { MUA, 0 | F_DIFF, "(?(?=(a))(aaaa|a?))+aak", "aaaaab aaaaak" },
622 { MUA, 0, "(?(?=a)(aaaa|a?))+aak", "aaaaab aaaaak" },
623 { MUA, 0, "(?(?!(b))(aaaa|a?))+aak", "aaaaab aaaaak" },
624 { MUA, 0, "(?(?!b)(aaaa|a?))+aak", "aaaaab aaaaak" },
625 { MUA, 0 | F_DIFF, "(?(?=(a))a*)+aak", "aaaaab aaaaak" },
626 { MUA, 0, "(?(?=a)a*)+aak", "aaaaab aaaaak" },
627 { MUA, 0, "(?(?!(b))a*)+aak", "aaaaab aaaaak" },
628 { MUA, 0, "(?(?!b)a*)+aak", "aaaaab aaaaak" },
629 { MUA, 0, "(?(?=(?=(?!(x))a)aa)aaa|(?(?=(?!y)bb)bbb))*k", "abaabbaaabbbaaabbb abaabbaaabbbaaabbbk" },
630 { MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)*l", "bc ddd abccabccl" },
631 { MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+?dd", "bcabcacdb bdddd" },
632 { MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+l", "ababccddabdbccd abcccl" },
633 { MUA, 0, "((?:a|aa)(?(1)aaa))x", "aax" },
634 { MUA, 0, "(?(?!)a|b)", "ab" },
635 { MUA, 0, "(?(?!)a)", "ab" },
636 { MUA, 0 | F_NOMATCH, "(?(?!)a|b)", "ac" },
637
638 /* Set start of match. */
639 { MUA, 0, "(?:\\Ka)*aaaab", "aaaaaaaa aaaaaaabb" },
640 { MUA, 0, "(?>\\Ka\\Ka)*aaaab", "aaaaaaaa aaaaaaaaaabb" },
641 { MUA, 0, "a+\\K(?<=\\Gaa)a", "aaaaaa" },
642 { MUA | PCRE_NOTEMPTY, 0 | F_NOMATCH, "a\\K(*ACCEPT)b", "aa" },
643 { MUA | PCRE_NOTEMPTY_ATSTART, 0, "a\\K(*ACCEPT)b", "aa" },
644
645 /* First line. */
646 { MUA | PCRE_FIRSTLINE, 0 | F_PROPERTY, "\\p{Any}a", "bb\naaa" },
647 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH | F_PROPERTY, "\\p{Any}a", "bb\r\naaa" },
648 { MUA | PCRE_FIRSTLINE, 0, "(?<=a)", "a" },
649 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH, "[^a][^b]", "ab" },
650 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH, "a", "\na" },
651 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH, "[abc]", "\na" },
652 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH, "^a", "\na" },
653 { MUA | PCRE_FIRSTLINE, 0 | F_NOMATCH, "^(?<=\n)", "\na" },
654 { MUA | PCRE_FIRSTLINE, 0, "\xf0\x90\x90\x80", "\xf0\x90\x90\x80" },
655 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANY | PCRE_FIRSTLINE, 0 | F_NOMATCH, "#", "\xc2\x85#" },
656 { PCRE_MULTILINE | PCRE_NEWLINE_ANY | PCRE_FIRSTLINE, 0 | F_NOMATCH, "#", "\x85#" },
657 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_ANY | PCRE_FIRSTLINE, 0 | F_NOMATCH, "^#", "\xe2\x80\xa8#" },
658 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 0 | F_PROPERTY, "\\p{Any}", "\r\na" },
659 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 0, ".", "\r" },
660 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 0, "a", "\ra" },
661 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 0 | F_NOMATCH, "ba", "bbb\r\nba" },
662 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 0 | F_NOMATCH | F_PROPERTY, "\\p{Any}{4}|a", "\r\na" },
663 { PCRE_MULTILINE | PCRE_UTF8 | PCRE_NEWLINE_CRLF | PCRE_FIRSTLINE, 1, ".", "\r\n" },
664 { PCRE_FIRSTLINE | PCRE_NEWLINE_LF | PCRE_DOTALL, 0 | F_NOMATCH, "ab.", "ab" },
665 { MUA | PCRE_FIRSTLINE, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
666
667 /* Recurse. */
668 { MUA, 0, "(a)(?1)", "aa" },
669 { MUA, 0, "((a))(?1)", "aa" },
670 { MUA, 0, "(b|a)(?1)", "aa" },
671 { MUA, 0, "(b|(a))(?1)", "aa" },
672 { MUA, 0 | F_NOMATCH, "((a)(b)(?:a*))(?1)", "aba" },
673 { MUA, 0, "((a)(b)(?:a*))(?1)", "abab" },
674 { MUA, 0, "((a+)c(?2))b(?1)", "aacaabaca" },
675 { MUA, 0, "((?2)b|(a)){2}(?1)", "aabab" },
676 { MUA, 0, "(?1)(a)*+(?2)(b(?1))", "aababa" },
677 { MUA, 0, "(?1)(((a(*ACCEPT)))b)", "axaa" },
678 { MUA, 0, "(?1)(?(DEFINE) (((ac(*ACCEPT)))b) )", "akaac" },
679 { MUA, 0, "(a+)b(?1)b\\1", "abaaabaaaaa" },
680 { MUA, 0 | F_NOMATCH, "(?(DEFINE)(aa|a))(?1)ab", "aab" },
681 { MUA, 0, "(?(DEFINE)(a\\Kb))(?1)+ababc", "abababxabababc" },
682 { MUA, 0, "(a\\Kb)(?1)+ababc", "abababxababababc" },
683 { MUA, 0 | F_NOMATCH, "(a\\Kb)(?1)+ababc", "abababxababababxc" },
684 { MUA, 0, "b|<(?R)*>", "<<b>" },
685 { MUA, 0, "(a\\K){0}(?:(?1)b|ac)", "ac" },
686 { MUA, 0, "(?(DEFINE)(a(?2)|b)(b(?1)|(a)))(?:(?1)|(?2))m", "ababababnababababaam" },
687 { MUA, 0, "(a)((?(R)a|b))(?2)", "aabbabaa" },
688 { MUA, 0, "(a)((?(R2)a|b))(?2)", "aabbabaa" },
689 { MUA, 0, "(a)((?(R1)a|b))(?2)", "ababba" },
690 { MUA, 0, "(?(R0)aa|bb(?R))", "abba aabb bbaa" },
691 { MUA, 0, "((?(R)(?:aaaa|a)|(?:(aaaa)|(a)))+)(?1)$", "aaaaaaaaaa aaaa" },
692 { MUA, 0, "(?P<Name>a(?(R&Name)a|b))(?1)", "aab abb abaa" },
693 { MUA, 0, "((?(R)a|(?1)){3})", "XaaaaaaaaaX" },
694 { MUA, 0, "((?:(?(R)a|(?1))){3})", "XaaaaaaaaaX" },
695 { MUA, 0, "((?(R)a|(?1)){1,3})aaaaaa", "aaaaaaaaXaaaaaaaaa" },
696 { MUA, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
697
698 /* 16 bit specific tests. */
699 { CMA, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" },
700 { CMA, 0 | F_FORCECONV, "\xe1\xbd\xb8", "\xe1\xbf\xb8\xe1\xbd\xb8" },
701 { CMA, 0 | F_FORCECONV, "[\xc3\xa1]", "\xc3\x81\xc3\xa1" },
702 { CMA, 0 | F_FORCECONV, "[\xe1\xbd\xb8]", "\xe1\xbf\xb8\xe1\xbd\xb8" },
703 { CMA, 0 | F_FORCECONV, "[a-\xed\xb0\x80]", "A" },
704 { CMA, 0 | F_NO8 | F_FORCECONV, "[a-\\x{dc00}]", "B" },
705 { CMA, 0 | F_NO8 | F_NOMATCH | F_FORCECONV, "[b-\\x{dc00}]", "a" },
706 { CMA, 0 | F_NO8 | F_FORCECONV, "\xed\xa0\x80\\x{d800}\xed\xb0\x80\\x{dc00}", "\xed\xa0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80" },
707 { CMA, 0 | F_NO8 | F_FORCECONV, "[\xed\xa0\x80\\x{d800}]{1,2}?[\xed\xb0\x80\\x{dc00}]{1,2}?#", "\xed\xa0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80#" },
708 { CMA, 0 | F_FORCECONV, "[\xed\xa0\x80\xed\xb0\x80#]{0,3}(?<=\xed\xb0\x80.)", "\xed\xa0\x80#\xed\xa0\x80##\xed\xb0\x80\xed\xa0\x80" },
709 { CMA, 0 | F_FORCECONV, "[\xed\xa0\x80-\xed\xb3\xbf]", "\xed\x9f\xbf\xed\xa0\x83" },
710 { CMA, 0 | F_FORCECONV, "[\xed\xa0\x80-\xed\xb3\xbf]", "\xed\xb4\x80\xed\xb3\xb0" },
711 { CMA, 0 | F_NO8 | F_FORCECONV, "[\\x{d800}-\\x{dcff}]", "\xed\x9f\xbf\xed\xa0\x83" },
712 { CMA, 0 | F_NO8 | F_FORCECONV, "[\\x{d800}-\\x{dcff}]", "\xed\xb4\x80\xed\xb3\xb0" },
713 { CMA, 0 | F_FORCECONV, "[\xed\xa0\x80-\xef\xbf\xbf]+[\x1-\xed\xb0\x80]+#", "\xed\xa0\x85\xc3\x81\xed\xa0\x85\xef\xbf\xb0\xc2\x85\xed\xa9\x89#" },
714 { CMA, 0 | F_FORCECONV, "[\xed\xa0\x80][\xed\xb0\x80]{2,}", "\xed\xa0\x80\xed\xb0\x80\xed\xa0\x80\xed\xb0\x80\xed\xb0\x80\xed\xb0\x80" },
715 { MA, 0 | F_FORCECONV, "[^\xed\xb0\x80]{3,}?", "##\xed\xb0\x80#\xed\xb0\x80#\xc3\x89#\xed\xb0\x80" },
716 { MA, 0 | F_NO8 | F_FORCECONV, "[^\\x{dc00}]{3,}?", "##\xed\xb0\x80#\xed\xb0\x80#\xc3\x89#\xed\xb0\x80" },
717 { CMA, 0 | F_FORCECONV, ".\\B.", "\xed\xa0\x80\xed\xb0\x80" },
718 { CMA, 0 | F_FORCECONV, "\\D+(?:\\d+|.)\\S+(?:\\s+|.)\\W+(?:\\w+|.)\xed\xa0\x80\xed\xa0\x80", "\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80" },
719 { CMA, 0 | F_FORCECONV, "\\d*\\s*\\w*\xed\xa0\x80\xed\xa0\x80", "\xed\xa0\x80\xed\xa0\x80" },
720 { CMA, 0 | F_FORCECONV | F_NOMATCH, "\\d*?\\D*?\\s*?\\S*?\\w*?\\W*?##", "\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80\xed\xa0\x80#" },
721 { CMA | PCRE_EXTENDED, 0 | F_FORCECONV, "\xed\xa0\x80 \xed\xb0\x80 !", "\xed\xa0\x80\xed\xb0\x80!" },
722 { CMA, 0 | F_FORCECONV, "\xed\xa0\x80+#[^#]+\xed\xa0\x80", "\xed\xa0\x80#a\xed\xa0\x80" },
723 { CMA, 0 | F_FORCECONV, "(\xed\xa0\x80+)#\\1", "\xed\xa0\x80\xed\xa0\x80#\xed\xa0\x80\xed\xa0\x80" },
724 { PCRE_MULTILINE | PCRE_NEWLINE_ANY, 0 | F_NO8 | F_FORCECONV, "^-", "a--\xe2\x80\xa8--" },
725 { PCRE_BSR_UNICODE, 0 | F_NO8 | F_FORCECONV, "\\R", "ab\xe2\x80\xa8" },
726 { 0, 0 | F_NO8 | F_FORCECONV, "\\v", "ab\xe2\x80\xa9" },
727 { 0, 0 | F_NO8 | F_FORCECONV, "\\h", "ab\xe1\xa0\x8e" },
728 { 0, 0 | F_NO8 | F_FORCECONV, "\\v+?\\V+?#", "\xe2\x80\xa9\xe2\x80\xa9\xef\xbf\xbf\xef\xbf\xbf#" },
729 { 0, 0 | F_NO8 | F_FORCECONV, "\\h+?\\H+?#", "\xe1\xa0\x8e\xe1\xa0\x8e\xef\xbf\xbf\xef\xbf\xbf#" },
730
731 /* Partial matching. */
732 { MUA | PCRE_PARTIAL_SOFT, 0, "ab", "a" },
733 { MUA | PCRE_PARTIAL_SOFT, 0, "ab|a", "a" },
734 { MUA | PCRE_PARTIAL_HARD, 0, "ab|a", "a" },
735 { MUA | PCRE_PARTIAL_SOFT, 0, "\\b#", "a" },
736 { MUA | PCRE_PARTIAL_SOFT, 0, "(?<=a)b", "a" },
737 { MUA | PCRE_PARTIAL_SOFT, 0, "abc|(?<=xxa)bc", "xxab" },
738 { MUA | PCRE_PARTIAL_SOFT, 0, "a\\B", "a" },
739 { MUA | PCRE_PARTIAL_HARD, 0, "a\\b", "a" },
740
741 /* (*MARK) verb. */
742 { MUA, 0, "a(*MARK:aa)a", "ababaa" },
743 { MUA, 0 | F_NOMATCH, "a(*:aa)a", "abab" },
744 { MUA, 0, "a(*:aa)(b(*:bb)b|bc)", "abc" },
745 { MUA, 0 | F_NOMATCH, "a(*:1)x|b(*:2)y", "abc" },
746 { MUA, 0, "(?>a(*:aa))b|ac", "ac" },
747 { MUA, 0, "(?(DEFINE)(a(*:aa)))(?1)", "a" },
748 { MUA, 0 | F_NOMATCH, "(?(DEFINE)((a)(*:aa)))(?1)b", "aa" },
749 { MUA, 0, "(?(DEFINE)(a(*:aa)))a(?1)b|aac", "aac" },
750 { MUA, 0, "(a(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
751 { MUA, 0, "(a(*:aa)){0}(?:b(?1)b)+", "babba" },
752 { MUA, 0 | F_NOMATCH | F_STUDY, "(a(*:aa)){0}(?:b(?1)b)+", "ba" },
753 { MUA, 0, "(a\\K(*:aa)){0}(?:b(?1)b|c)+c", "babbab cc" },
754 { MUA, 0, "(a\\K(*:aa)){0}(?:b(?1)b)+", "babba" },
755 { MUA, 0 | F_NOMATCH | F_STUDY, "(a\\K(*:aa)){0}(?:b(?1)b)+", "ba" },
756 { MUA, 0 | F_NOMATCH | F_STUDY, "(*:mark)m", "a" },
757
758 /* (*COMMIT) verb. */
759 { MUA, 0 | F_NOMATCH, "a(*COMMIT)b", "ac" },
760 { MUA, 0, "aa(*COMMIT)b", "xaxaab" },
761 { MUA, 0 | F_NOMATCH, "a(*COMMIT)(*:msg)b|ac", "ac" },
762 { MUA, 0 | F_NOMATCH, "(a(*COMMIT)b)++", "abac" },
763 { MUA, 0 | F_NOMATCH, "((a)(*COMMIT)b)++", "abac" },
764 { MUA, 0 | F_NOMATCH, "(?=a(*COMMIT)b)ab|ad", "ad" },
765
766 /* (*PRUNE) verb. */
767 { MUA, 0, "aa\\K(*PRUNE)b", "aaab" },
768 { MUA, 0, "aa(*PRUNE:bb)b|a", "aa" },
769 { MUA, 0, "(a)(a)(*PRUNE)b|(a)", "aa" },
770 { MUA, 0, "(a)(a)(a)(a)(a)(a)(a)(a)(*PRUNE)b|(a)", "aaaaaaaa" },
771 { MUA | PCRE_PARTIAL_SOFT, 0, "a(*PRUNE)a|", "a" },
772 { MUA | PCRE_PARTIAL_SOFT, 0, "a(*PRUNE)a|m", "a" },
773 { MUA, 0 | F_NOMATCH, "(?=a(*PRUNE)b)ab|ad", "ad" },
774 { MUA, 0, "a(*COMMIT)(*PRUNE)d|bc", "abc" },
775 { MUA, 0, "(?=a(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
776 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?=a(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
777 { MUA, 0, "(?=(a)(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
778 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?=(a)(*COMMIT)b)a(*PRUNE)c|bc", "abc" },
779 { MUA, 0, "(a(*COMMIT)b){0}a(?1)(*PRUNE)c|bc", "abc" },
780 { MUA, 0 | F_NOMATCH, "(a(*COMMIT)b){0}a(*COMMIT)(?1)(*PRUNE)c|bc", "abc" },
781 { MUA, 0, "(a(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
782 { MUA, 0 | F_NOMATCH, "(*COMMIT)(a(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
783 { MUA, 0, "((a)(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
784 { MUA, 0 | F_NOMATCH, "(*COMMIT)((a)(*COMMIT)b)++(*PRUNE)d|c", "ababc" },
785 { MUA, 0, "(?>a(*COMMIT)b)*abab(*PRUNE)d|ba", "ababab" },
786 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)*abab(*PRUNE)d|ba", "ababab" },
787 { MUA, 0, "(?>a(*COMMIT)b)+abab(*PRUNE)d|ba", "ababab" },
788 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)+abab(*PRUNE)d|ba", "ababab" },
789 { MUA, 0, "(?>a(*COMMIT)b)?ab(*PRUNE)d|ba", "aba" },
790 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)?ab(*PRUNE)d|ba", "aba" },
791 { MUA, 0, "(?>a(*COMMIT)b)*?n(*PRUNE)d|ba", "abababn" },
792 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)*?n(*PRUNE)d|ba", "abababn" },
793 { MUA, 0, "(?>a(*COMMIT)b)+?n(*PRUNE)d|ba", "abababn" },
794 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)+?n(*PRUNE)d|ba", "abababn" },
795 { MUA, 0, "(?>a(*COMMIT)b)??n(*PRUNE)d|bn", "abn" },
796 { MUA, 0 | F_NOMATCH, "(*COMMIT)(?>a(*COMMIT)b)??n(*PRUNE)d|bn", "abn" },
797
798 /* (*SKIP) verb. */
799 { MUA, 0 | F_NOMATCH, "(?=a(*SKIP)b)ab|ad", "ad" },
800
801 /* (*THEN) verb. */
802 { MUA, 0, "((?:a(*THEN)|aab)(*THEN)c|a+)+m", "aabcaabcaabcaabcnacm" },
803 { MUA, 0 | F_NOMATCH, "((?:a(*THEN)|aab)(*THEN)c|a+)+m", "aabcm" },
804 { MUA, 0, "((?:a(*THEN)|aab)c|a+)+m", "aabcaabcnmaabcaabcm" },
805 { MUA, 0, "((?:a|aab)(*THEN)c|a+)+m", "aam" },
806 { MUA, 0, "((?:a(*COMMIT)|aab)(*THEN)c|a+)+m", "aam" },
807 { MUA, 0, "(?(?=a(*THEN)b)ab|ad)", "ad" },
808 { MUA, 0, "(?(?!a(*THEN)b)ad|add)", "add" },
809 { MUA, 0 | F_NOMATCH, "(?(?=a)a(*THEN)b|ad)", "ad" },
810 { MUA, 0, "(?!(?(?=a)ab|b(*THEN)d))bn|bnn", "bnn" },
811
812 /* Deep recursion. */
813 { MUA, 0, "((((?:(?:(?:\\w)+)?)*|(?>\\w)+?)+|(?>\\w)?\?)*)?\\s", "aaaaa+ " },
814 { MUA, 0, "(?:((?:(?:(?:\\w*?)+)??|(?>\\w)?|\\w*+)*)+)+?\\s", "aa+ " },
815 { MUA, 0, "((a?)+)+b", "aaaaaaaaaaaa b" },
816
817 /* Deep recursion: Stack limit reached. */
818 { MA, 0 | F_NOMATCH, "a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaa" },
819 { MA, 0 | F_NOMATCH, "(?:a+)+b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
820 { MA, 0 | F_NOMATCH, "(?:a+?)+?b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
821 { MA, 0 | F_NOMATCH, "(?:a*)*b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
822 { MA, 0 | F_NOMATCH, "(?:a*?)*?b", "aaaaaaaaaaaaaaaaaaaaaaaa b" },
823
824 { 0, 0, NULL, NULL }
825 };
826
827 static const unsigned char *tables(int mode)
828 {
829 /* The purpose of this function to allow valgrind
830 for reporting invalid reads and writes. */
831 static unsigned char *tables_copy;
832 const char *errorptr;
833 int erroroffset;
834 unsigned char *default_tables;
835 #if defined SUPPORT_PCRE8
836 pcre *regex;
837 char null_str[1] = { 0 };
838 #elif defined SUPPORT_PCRE16
839 pcre16 *regex;
840 PCRE_UCHAR16 null_str[1] = { 0 };
841 #elif defined SUPPORT_PCRE32
842 pcre32 *regex;
843 PCRE_UCHAR32 null_str[1] = { 0 };
844 #endif
845
846 if (mode) {
847 if (tables_copy)
848 free(tables_copy);
849 tables_copy = NULL;
850 return NULL;
851 }
852
853 if (tables_copy)
854 return tables_copy;
855
856 default_tables = NULL;
857 #if defined SUPPORT_PCRE8
858 regex = pcre_compile(null_str, 0, &errorptr, &erroroffset, NULL);
859 if (regex) {
860 pcre_fullinfo(regex, NULL, PCRE_INFO_DEFAULT_TABLES, &default_tables);
861 pcre_free(regex);
862 }
863 #elif defined SUPPORT_PCRE16
864 regex = pcre16_compile(null_str, 0, &errorptr, &erroroffset, NULL);
865 if (regex) {
866 pcre16_fullinfo(regex, NULL, PCRE_INFO_DEFAULT_TABLES, &default_tables);
867 pcre16_free(regex);
868 }
869 #elif defined SUPPORT_PCRE32
870 regex = pcre32_compile(null_str, 0, &errorptr, &erroroffset, NULL);
871 if (regex) {
872 pcre32_fullinfo(regex, NULL, PCRE_INFO_DEFAULT_TABLES, &default_tables);
873 pcre32_free(regex);
874 }
875 #endif
876 /* Shouldn't ever happen. */
877 if (!default_tables)
878 return NULL;
879
880 /* Unfortunately this value cannot get from pcre_fullinfo.
881 Since this is a test program, this is acceptable at the moment. */
882 tables_copy = (unsigned char *)malloc(1088);
883 if (!tables_copy)
884 return NULL;
885
886 memcpy(tables_copy, default_tables, 1088);
887 return tables_copy;
888 }
889
890 #ifdef SUPPORT_PCRE8
891 static pcre_jit_stack* callback8(void *arg)
892 {
893 return (pcre_jit_stack *)arg;
894 }
895 #endif
896
897 #ifdef SUPPORT_PCRE16
898 static pcre16_jit_stack* callback16(void *arg)
899 {
900 return (pcre16_jit_stack *)arg;
901 }
902 #endif
903
904 #ifdef SUPPORT_PCRE32
905 static pcre32_jit_stack* callback32(void *arg)
906 {
907 return (pcre32_jit_stack *)arg;
908 }
909 #endif
910
911 #ifdef SUPPORT_PCRE8
912 static pcre_jit_stack *stack8;
913
914 static pcre_jit_stack *getstack8(void)
915 {
916 if (!stack8)
917 stack8 = pcre_jit_stack_alloc(1, 1024 * 1024);
918 return stack8;
919 }
920
921 static void setstack8(pcre_extra *extra)
922 {
923 if (!extra) {
924 if (stack8)
925 pcre_jit_stack_free(stack8);
926 stack8 = NULL;
927 return;
928 }
929
930 pcre_assign_jit_stack(extra, callback8, getstack8());
931 }
932 #endif /* SUPPORT_PCRE8 */
933
934 #ifdef SUPPORT_PCRE16
935 static pcre16_jit_stack *stack16;
936
937 static pcre16_jit_stack *getstack16(void)
938 {
939 if (!stack16)
940 stack16 = pcre16_jit_stack_alloc(1, 1024 * 1024);
941 return stack16;
942 }
943
944 static void setstack16(pcre16_extra *extra)
945 {
946 if (!extra) {
947 if (stack16)
948 pcre16_jit_stack_free(stack16);
949 stack16 = NULL;
950 return;
951 }
952
953 pcre16_assign_jit_stack(extra, callback16, getstack16());
954 }
955 #endif /* SUPPORT_PCRE16 */
956
957 #ifdef SUPPORT_PCRE32
958 static pcre32_jit_stack *stack32;
959
960 static pcre32_jit_stack *getstack32(void)
961 {
962 if (!stack32)
963 stack32 = pcre32_jit_stack_alloc(1, 1024 * 1024);
964 return stack32;
965 }
966
967 static void setstack32(pcre32_extra *extra)
968 {
969 if (!extra) {
970 if (stack32)
971 pcre32_jit_stack_free(stack32);
972 stack32 = NULL;
973 return;
974 }
975
976 pcre32_assign_jit_stack(extra, callback32, getstack32());
977 }
978 #endif /* SUPPORT_PCRE32 */
979
980 #ifdef SUPPORT_PCRE16
981
982 static int convert_utf8_to_utf16(const char *input, PCRE_UCHAR16 *output, int *offsetmap, int max_length)
983 {
984 unsigned char *iptr = (unsigned char*)input;
985 PCRE_UCHAR16 *optr = output;
986 unsigned int c;
987
988 if (max_length == 0)
989 return 0;
990
991 while (*iptr && max_length > 1) {
992 c = 0;
993 if (offsetmap)
994 *offsetmap++ = (int)(iptr - (unsigned char*)input);
995
996 if (*iptr < 0xc0)
997 c = *iptr++;
998 else if (!(*iptr & 0x20)) {
999 c = ((iptr[0] & 0x1f) << 6) | (iptr[1] & 0x3f);
1000 iptr += 2;
1001 } else if (!(*iptr & 0x10)) {
1002 c = ((iptr[0] & 0x0f) << 12) | ((iptr[1] & 0x3f) << 6) | (iptr[2] & 0x3f);
1003 iptr += 3;
1004 } else if (!(*iptr & 0x08)) {
1005 c = ((iptr[0] & 0x07) << 18) | ((iptr[1] & 0x3f) << 12) | ((iptr[2] & 0x3f) << 6) | (iptr[3] & 0x3f);
1006 iptr += 4;
1007 }
1008
1009 if (c < 65536) {
1010 *optr++ = c;
1011 max_length--;
1012 } else if (max_length <= 2) {
1013 *optr = '\0';
1014 return (int)(optr - output);
1015 } else {
1016 c -= 0x10000;
1017 *optr++ = 0xd800 | ((c >> 10) & 0x3ff);
1018 *optr++ = 0xdc00 | (c & 0x3ff);
1019 max_length -= 2;
1020 if (offsetmap)
1021 offsetmap++;
1022 }
1023 }
1024 if (offsetmap)
1025 *offsetmap = (int)(iptr - (unsigned char*)input);
1026 *optr = '\0';
1027 return (int)(optr - output);
1028 }
1029
1030 static int copy_char8_to_char16(const char *input, PCRE_UCHAR16 *output, int max_length)
1031 {
1032 unsigned char *iptr = (unsigned char*)input;
1033 PCRE_UCHAR16 *optr = output;
1034
1035 if (max_length == 0)
1036 return 0;
1037
1038 while (*iptr && max_length > 1) {
1039 *optr++ = *iptr++;
1040 max_length--;
1041 }
1042 *optr = '\0';
1043 return (int)(optr - output);
1044 }
1045
1046 #define REGTEST_MAX_LENGTH16 4096
1047 static PCRE_UCHAR16 regtest_buf16[REGTEST_MAX_LENGTH16];
1048 static int regtest_offsetmap16[REGTEST_MAX_LENGTH16];
1049
1050 #endif /* SUPPORT_PCRE16 */
1051
1052 #ifdef SUPPORT_PCRE32
1053
1054 static int convert_utf8_to_utf32(const char *input, PCRE_UCHAR32 *output, int *offsetmap, int max_length)
1055 {
1056 unsigned char *iptr = (unsigned char*)input;
1057 PCRE_UCHAR32 *optr = output;
1058 unsigned int c;
1059
1060 if (max_length == 0)
1061 return 0;
1062
1063 while (*iptr && max_length > 1) {
1064 c = 0;
1065 if (offsetmap)
1066 *offsetmap++ = (int)(iptr - (unsigned char*)input);
1067
1068 if (*iptr < 0xc0)
1069 c = *iptr++;
1070 else if (!(*iptr & 0x20)) {
1071 c = ((iptr[0] & 0x1f) << 6) | (iptr[1] & 0x3f);
1072 iptr += 2;
1073 } else if (!(*iptr & 0x10)) {
1074 c = ((iptr[0] & 0x0f) << 12) | ((iptr[1] & 0x3f) << 6) | (iptr[2] & 0x3f);
1075 iptr += 3;
1076 } else if (!(*iptr & 0x08)) {
1077 c = ((iptr[0] & 0x07) << 18) | ((iptr[1] & 0x3f) << 12) | ((iptr[2] & 0x3f) << 6) | (iptr[3] & 0x3f);
1078 iptr += 4;
1079 }
1080
1081 *optr++ = c;
1082 max_length--;
1083 }
1084 if (offsetmap)
1085 *offsetmap = (int)(iptr - (unsigned char*)input);
1086 *optr = 0;
1087 return (int)(optr - output);
1088 }
1089
1090 static int copy_char8_to_char32(const char *input, PCRE_UCHAR32 *output, int max_length)
1091 {
1092 unsigned char *iptr = (unsigned char*)input;
1093 PCRE_UCHAR32 *optr = output;
1094
1095 if (max_length == 0)
1096 return 0;
1097
1098 while (*iptr && max_length > 1) {
1099 *optr++ = *iptr++;
1100 max_length--;
1101 }
1102 *optr = '\0';
1103 return (int)(optr - output);
1104 }
1105
1106 #define REGTEST_MAX_LENGTH32 4096
1107 static PCRE_UCHAR32 regtest_buf32[REGTEST_MAX_LENGTH32];
1108 static int regtest_offsetmap32[REGTEST_MAX_LENGTH32];
1109
1110 #endif /* SUPPORT_PCRE32 */
1111
1112 static int check_ascii(const char *input)
1113 {
1114 const unsigned char *ptr = (unsigned char *)input;
1115 while (*ptr) {
1116 if (*ptr > 127)
1117 return 0;
1118 ptr++;
1119 }
1120 return 1;
1121 }
1122
1123 static int regression_tests(void)
1124 {
1125 struct regression_test_case *current = regression_test_cases;
1126 const char *error;
1127 char *cpu_info;
1128 int i, err_offs;
1129 int is_successful, is_ascii;
1130 int total = 0;
1131 int successful = 0;
1132 int successful_row = 0;
1133 int counter = 0;
1134 int study_mode;
1135 int utf = 0, ucp = 0;
1136 int disabled_flags = 0;
1137 #ifdef SUPPORT_PCRE8
1138 pcre *re8;
1139 pcre_extra *extra8;
1140 pcre_extra dummy_extra8;
1141 int ovector8_1[32];
1142 int ovector8_2[32];
1143 int return_value8[2];
1144 unsigned char *mark8_1, *mark8_2;
1145 #endif
1146 #ifdef SUPPORT_PCRE16
1147 pcre16 *re16;
1148 pcre16_extra *extra16;
1149 pcre16_extra dummy_extra16;
1150 int ovector16_1[32];
1151 int ovector16_2[32];
1152 int return_value16[2];
1153 PCRE_UCHAR16 *mark16_1, *mark16_2;
1154 int length16;
1155 #endif
1156 #ifdef SUPPORT_PCRE32
1157 pcre32 *re32;
1158 pcre32_extra *extra32;
1159 pcre32_extra dummy_extra32;
1160 int ovector32_1[32];
1161 int ovector32_2[32];
1162 int return_value32[2];
1163 PCRE_UCHAR32 *mark32_1, *mark32_2;
1164 int length32;
1165 #endif
1166
1167 /* This test compares the behaviour of interpreter and JIT. Although disabling
1168 utf or ucp may make tests fail, if the pcre_exec result is the SAME, it is
1169 still considered successful from pcre_jit_test point of view. */
1170
1171 #if defined SUPPORT_PCRE8
1172 pcre_config(PCRE_CONFIG_JITTARGET, &cpu_info);
1173 #elif defined SUPPORT_PCRE16
1174 pcre16_config(PCRE_CONFIG_JITTARGET, &cpu_info);
1175 #elif defined SUPPORT_PCRE32
1176 pcre32_config(PCRE_CONFIG_JITTARGET, &cpu_info);
1177 #endif
1178
1179 printf("Running JIT regression tests\n");
1180 printf(" target CPU of SLJIT compiler: %s\n", cpu_info);
1181
1182 #if defined SUPPORT_PCRE8
1183 pcre_config(PCRE_CONFIG_UTF8, &utf);
1184 pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &ucp);
1185 #elif defined SUPPORT_PCRE16
1186 pcre16_config(PCRE_CONFIG_UTF16, &utf);
1187 pcre16_config(PCRE_CONFIG_UNICODE_PROPERTIES, &ucp);
1188 #elif defined SUPPORT_PCRE32
1189 pcre32_config(PCRE_CONFIG_UTF32, &utf);
1190 pcre32_config(PCRE_CONFIG_UNICODE_PROPERTIES, &ucp);
1191 #endif
1192
1193 if (!utf)
1194 disabled_flags |= PCRE_UTF8 | PCRE_UTF16 | PCRE_UTF32;
1195 if (!ucp)
1196 disabled_flags |= PCRE_UCP;
1197 #ifdef SUPPORT_PCRE8
1198 printf(" in 8 bit mode with UTF-8 %s and ucp %s:\n", utf ? "enabled" : "disabled", ucp ? "enabled" : "disabled");
1199 #endif
1200 #ifdef SUPPORT_PCRE16
1201 printf(" in 16 bit mode with UTF-16 %s and ucp %s:\n", utf ? "enabled" : "disabled", ucp ? "enabled" : "disabled");
1202 #endif
1203 #ifdef SUPPORT_PCRE32
1204 printf(" in 32 bit mode with UTF-32 %s and ucp %s:\n", utf ? "enabled" : "disabled", ucp ? "enabled" : "disabled");
1205 #endif
1206
1207 while (current->pattern) {
1208 /* printf("\nPattern: %s :\n", current->pattern); */
1209 total++;
1210 is_ascii = 0;
1211 if (!(current->start_offset & F_PROPERTY))
1212 is_ascii = check_ascii(current->pattern) && check_ascii(current->input);
1213
1214 if (current->flags & PCRE_PARTIAL_SOFT)
1215 study_mode = PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE;
1216 else if (current->flags & PCRE_PARTIAL_HARD)
1217 study_mode = PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE;
1218 else
1219 study_mode = PCRE_STUDY_JIT_COMPILE;
1220 error = NULL;
1221 #ifdef SUPPORT_PCRE8
1222 re8 = NULL;
1223 if (!(current->start_offset & F_NO8))
1224 re8 = pcre_compile(current->pattern,
1225 current->flags & ~(PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | disabled_flags),
1226 &error, &err_offs, tables(0));
1227
1228 extra8 = NULL;
1229 if (re8) {
1230 error = NULL;
1231 extra8 = pcre_study(re8, study_mode, &error);
1232 if (!extra8) {
1233 printf("\n8 bit: Cannot study pattern: %s\n", current->pattern);
1234 pcre_free(re8);
1235 re8 = NULL;
1236 }
1237 else if (!(extra8->flags & PCRE_EXTRA_EXECUTABLE_JIT)) {
1238 printf("\n8 bit: JIT compiler does not support: %s\n", current->pattern);
1239 pcre_free_study(extra8);
1240 pcre_free(re8);
1241 re8 = NULL;
1242 }
1243 extra8->flags |= PCRE_EXTRA_MARK;
1244 } else if (((utf && ucp) || is_ascii) && !(current->start_offset & F_NO8))
1245 printf("\n8 bit: Cannot compile pattern \"%s\": %s\n", current->pattern, error);
1246 #endif
1247 #ifdef SUPPORT_PCRE16
1248 if ((current->flags & PCRE_UTF16) || (current->start_offset & F_FORCECONV))
1249 convert_utf8_to_utf16(current->pattern, regtest_buf16, NULL, REGTEST_MAX_LENGTH16);
1250 else
1251 copy_char8_to_char16(current->pattern, regtest_buf16, REGTEST_MAX_LENGTH16);
1252
1253 re16 = NULL;
1254 if (!(current->start_offset & F_NO16))
1255 re16 = pcre16_compile(regtest_buf16,
1256 current->flags & ~(PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | disabled_flags),
1257 &error, &err_offs, tables(0));
1258
1259 extra16 = NULL;
1260 if (re16) {
1261 error = NULL;
1262 extra16 = pcre16_study(re16, study_mode, &error);
1263 if (!extra16) {
1264 printf("\n16 bit: Cannot study pattern: %s\n", current->pattern);
1265 pcre16_free(re16);
1266 re16 = NULL;
1267 }
1268 else if (!(extra16->flags & PCRE_EXTRA_EXECUTABLE_JIT)) {
1269 printf("\n16 bit: JIT compiler does not support: %s\n", current->pattern);
1270 pcre16_free_study(extra16);
1271 pcre16_free(re16);
1272 re16 = NULL;
1273 }
1274 extra16->flags |= PCRE_EXTRA_MARK;
1275 } else if (((utf && ucp) || is_ascii) && !(current->start_offset & F_NO16))
1276 printf("\n16 bit: Cannot compile pattern \"%s\": %s\n", current->pattern, error);
1277 #endif
1278 #ifdef SUPPORT_PCRE32
1279 if ((current->flags & PCRE_UTF32) || (current->start_offset & F_FORCECONV))
1280 convert_utf8_to_utf32(current->pattern, regtest_buf32, NULL, REGTEST_MAX_LENGTH32);
1281 else
1282 copy_char8_to_char32(current->pattern, regtest_buf32, REGTEST_MAX_LENGTH32);
1283
1284 re32 = NULL;
1285 if (!(current->start_offset & F_NO32))
1286 re32 = pcre32_compile(regtest_buf32,
1287 current->flags & ~(PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | disabled_flags),
1288 &error, &err_offs, tables(0));
1289
1290 extra32 = NULL;
1291 if (re32) {
1292 error = NULL;
1293 extra32 = pcre32_study(re32, study_mode, &error);
1294 if (!extra32) {
1295 printf("\n32 bit: Cannot study pattern: %s\n", current->pattern);
1296 pcre32_free(re32);
1297 re32 = NULL;
1298 }
1299 if (!(extra32->flags & PCRE_EXTRA_EXECUTABLE_JIT)) {
1300 printf("\n32 bit: JIT compiler does not support: %s\n", current->pattern);
1301 pcre32_free_study(extra32);
1302 pcre32_free(re32);
1303 re32 = NULL;
1304 }
1305 extra32->flags |= PCRE_EXTRA_MARK;
1306 } else if (((utf && ucp) || is_ascii) && !(current->start_offset & F_NO32))
1307 printf("\n32 bit: Cannot compile pattern \"%s\": %s\n", current->pattern, error);
1308 #endif
1309
1310 counter++;
1311 if ((counter & 0x3) != 0) {
1312 #ifdef SUPPORT_PCRE8
1313 setstack8(NULL);
1314 #endif
1315 #ifdef SUPPORT_PCRE16
1316 setstack16(NULL);
1317 #endif
1318 #ifdef SUPPORT_PCRE32
1319 setstack32(NULL);
1320 #endif
1321 }
1322
1323 #ifdef SUPPORT_PCRE8
1324 return_value8[0] = -1000;
1325 return_value8[1] = -1000;
1326 for (i = 0; i < 32; ++i)
1327 ovector8_1[i] = -2;
1328 for (i = 0; i < 32; ++i)
1329 ovector8_2[i] = -2;
1330 if (re8) {
1331 mark8_1 = NULL;
1332 mark8_2 = NULL;
1333 extra8->mark = &mark8_1;
1334
1335 if ((counter & 0x1) != 0) {
1336 setstack8(extra8);
1337 return_value8[0] = pcre_exec(re8, extra8, current->input, strlen(current->input), current->start_offset & OFFSET_MASK,
1338 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector8_1, 32);
1339 } else
1340 return_value8[0] = pcre_jit_exec(re8, extra8, current->input, strlen(current->input), current->start_offset & OFFSET_MASK,
1341 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector8_1, 32, getstack8());
1342 memset(&dummy_extra8, 0, sizeof(pcre_extra));
1343 dummy_extra8.flags = PCRE_EXTRA_MARK;
1344 if (current->start_offset & F_STUDY) {
1345 dummy_extra8.flags |= PCRE_EXTRA_STUDY_DATA;
1346 dummy_extra8.study_data = extra8->study_data;
1347 }
1348 dummy_extra8.mark = &mark8_2;
1349 return_value8[1] = pcre_exec(re8, &dummy_extra8, current->input, strlen(current->input), current->start_offset & OFFSET_MASK,
1350 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector8_2, 32);
1351 }
1352 #endif
1353
1354 #ifdef SUPPORT_PCRE16
1355 return_value16[0] = -1000;
1356 return_value16[1] = -1000;
1357 for (i = 0; i < 32; ++i)
1358 ovector16_1[i] = -2;
1359 for (i = 0; i < 32; ++i)
1360 ovector16_2[i] = -2;
1361 if (re16) {
1362 mark16_1 = NULL;
1363 mark16_2 = NULL;
1364 if ((current->flags & PCRE_UTF16) || (current->start_offset & F_FORCECONV))
1365 length16 = convert_utf8_to_utf16(current->input, regtest_buf16, regtest_offsetmap16, REGTEST_MAX_LENGTH16);
1366 else
1367 length16 = copy_char8_to_char16(current->input, regtest_buf16, REGTEST_MAX_LENGTH16);
1368 extra16->mark = &mark16_1;
1369 if ((counter & 0x1) != 0) {
1370 setstack16(extra16);
1371 return_value16[0] = pcre16_exec(re16, extra16, regtest_buf16, length16, current->start_offset & OFFSET_MASK,
1372 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector16_1, 32);
1373 } else
1374 return_value16[0] = pcre16_jit_exec(re16, extra16, regtest_buf16, length16, current->start_offset & OFFSET_MASK,
1375 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector16_1, 32, getstack16());
1376 memset(&dummy_extra16, 0, sizeof(pcre16_extra));
1377 dummy_extra16.flags = PCRE_EXTRA_MARK;
1378 if (current->start_offset & F_STUDY) {
1379 dummy_extra16.flags |= PCRE_EXTRA_STUDY_DATA;
1380 dummy_extra16.study_data = extra16->study_data;
1381 }
1382 dummy_extra16.mark = &mark16_2;
1383 return_value16[1] = pcre16_exec(re16, &dummy_extra16, regtest_buf16, length16, current->start_offset & OFFSET_MASK,
1384 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector16_2, 32);
1385 }
1386 #endif
1387
1388 #ifdef SUPPORT_PCRE32
1389 return_value32[0] = -1000;
1390 return_value32[1] = -1000;
1391 for (i = 0; i < 32; ++i)
1392 ovector32_1[i] = -2;
1393 for (i = 0; i < 32; ++i)
1394 ovector32_2[i] = -2;
1395 if (re32) {
1396 mark32_1 = NULL;
1397 mark32_2 = NULL;
1398 if ((current->flags & PCRE_UTF32) || (current->start_offset & F_FORCECONV))
1399 length32 = convert_utf8_to_utf32(current->input, regtest_buf32, regtest_offsetmap32, REGTEST_MAX_LENGTH32);
1400 else
1401 length32 = copy_char8_to_char32(current->input, regtest_buf32, REGTEST_MAX_LENGTH32);
1402 extra32->mark = &mark32_1;
1403 if ((counter & 0x1) != 0) {
1404 setstack32(extra32);
1405 return_value32[0] = pcre32_exec(re32, extra32, regtest_buf32, length32, current->start_offset & OFFSET_MASK,
1406 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector32_1, 32);
1407 } else
1408 return_value32[0] = pcre32_jit_exec(re32, extra32, regtest_buf32, length32, current->start_offset & OFFSET_MASK,
1409 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector32_1, 32, getstack32());
1410 memset(&dummy_extra32, 0, sizeof(pcre32_extra));
1411 dummy_extra32.flags = PCRE_EXTRA_MARK;
1412 if (current->start_offset & F_STUDY) {
1413 dummy_extra32.flags |= PCRE_EXTRA_STUDY_DATA;
1414 dummy_extra32.study_data = extra32->study_data;
1415 }
1416 dummy_extra32.mark = &mark32_2;
1417 return_value32[1] = pcre32_exec(re32, &dummy_extra32, regtest_buf32, length32, current->start_offset & OFFSET_MASK,
1418 current->flags & (PCRE_NOTBOL | PCRE_NOTEOL | PCRE_NOTEMPTY | PCRE_NOTEMPTY_ATSTART | PCRE_PARTIAL_SOFT | PCRE_PARTIAL_HARD | PCRE_NO_UTF8_CHECK), ovector32_2, 32);
1419 }
1420 #endif
1421
1422 /* printf("[%d-%d-%d|%d-%d|%d-%d|%d-%d]%s",
1423 return_value8[0], return_value16[0], return_value32[0],
1424 ovector8_1[0], ovector8_1[1],
1425 ovector16_1[0], ovector16_1[1],
1426 ovector32_1[0], ovector32_1[1],
1427 (current->flags & PCRE_CASELESS) ? "C" : ""); */
1428
1429 /* If F_DIFF is set, just run the test, but do not compare the results.
1430 Segfaults can still be captured. */
1431
1432 is_successful = 1;
1433 if (!(current->start_offset & F_DIFF)) {
1434 #if defined SUPPORT_UTF && ((defined(SUPPORT_PCRE8) + defined(SUPPORT_PCRE16) + defined(SUPPORT_PCRE32)) >= 2)
1435 if (!(current->start_offset & F_FORCECONV)) {
1436 int return_value;
1437
1438 /* All results must be the same. */
1439 #ifdef SUPPORT_PCRE8
1440 if ((return_value = return_value8[0]) != return_value8[1]) {
1441 printf("\n8 bit: Return value differs(J8:%d,I8:%d): [%d] '%s' @ '%s'\n",
1442 return_value8[0], return_value8[1], total, current->pattern, current->input);
1443 is_successful = 0;
1444 } else
1445 #endif
1446 #ifdef SUPPORT_PCRE16
1447 if ((return_value = return_value16[0]) != return_value16[1]) {
1448 printf("\n16 bit: Return value differs(J16:%d,I16:%d): [%d] '%s' @ '%s'\n",
1449 return_value16[0], return_value16[1], total, current->pattern, current->input);
1450 is_successful = 0;
1451 } else
1452 #endif
1453 #ifdef SUPPORT_PCRE32
1454 if ((return_value = return_value32[0]) != return_value32[1]) {
1455 printf("\n32 bit: Return value differs(J32:%d,I32:%d): [%d] '%s' @ '%s'\n",
1456 return_value32[0], return_value32[1], total, current->pattern, current->input);
1457 is_successful = 0;
1458 } else
1459 #endif
1460 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
1461 if (return_value8[0] != return_value16[0]) {
1462 printf("\n8 and 16 bit: Return value differs(J8:%d,J16:%d): [%d] '%s' @ '%s'\n",
1463 return_value8[0], return_value16[0],
1464 total, current->pattern, current->input);
1465 is_successful = 0;
1466 } else
1467 #endif
1468 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE32
1469 if (return_value8[0] != return_value32[0]) {
1470 printf("\n8 and 32 bit: Return value differs(J8:%d,J32:%d): [%d] '%s' @ '%s'\n",
1471 return_value8[0], return_value32[0],
1472 total, current->pattern, current->input);
1473 is_successful = 0;
1474 } else
1475 #endif
1476 #if defined SUPPORT_PCRE16 && defined SUPPORT_PCRE32
1477 if (return_value16[0] != return_value32[0]) {
1478 printf("\n16 and 32 bit: Return value differs(J16:%d,J32:%d): [%d] '%s' @ '%s'\n",
1479 return_value16[0], return_value32[0],
1480 total, current->pattern, current->input);
1481 is_successful = 0;
1482 } else
1483 #endif
1484 if (return_value >= 0 || return_value == PCRE_ERROR_PARTIAL) {
1485 if (return_value == PCRE_ERROR_PARTIAL) {
1486 return_value = 2;
1487 } else {
1488 return_value *= 2;
1489 }
1490 #ifdef SUPPORT_PCRE8
1491 return_value8[0] = return_value;
1492 #endif
1493 #ifdef SUPPORT_PCRE16
1494 return_value16[0] = return_value;
1495 #endif
1496 #ifdef SUPPORT_PCRE32
1497 return_value32[0] = return_value;
1498 #endif
1499 /* Transform back the results. */
1500 if (current->flags & PCRE_UTF8) {
1501 #ifdef SUPPORT_PCRE16
1502 for (i = 0; i < return_value; ++i) {
1503 if (ovector16_1[i] >= 0)
1504 ovector16_1[i] = regtest_offsetmap16[ovector16_1[i]];
1505 if (ovector16_2[i] >= 0)
1506 ovector16_2[i] = regtest_offsetmap16[ovector16_2[i]];
1507 }
1508 #endif
1509 #ifdef SUPPORT_PCRE32
1510 for (i = 0; i < return_value; ++i) {
1511 if (ovector32_1[i] >= 0)
1512 ovector32_1[i] = regtest_offsetmap32[ovector32_1[i]];
1513 if (ovector32_2[i] >= 0)
1514 ovector32_2[i] = regtest_offsetmap32[ovector32_2[i]];
1515 }
1516 #endif
1517 }
1518
1519 for (i = 0; i < return_value; ++i) {
1520 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE16
1521 if (ovector8_1[i] != ovector8_2[i] || ovector8_1[i] != ovector16_1[i] || ovector8_1[i] != ovector16_2[i]) {
1522 printf("\n8 and 16 bit: Ovector[%d] value differs(J8:%d,I8:%d,J16:%d,I16:%d): [%d] '%s' @ '%s' \n",
1523 i, ovector8_1[i], ovector8_2[i], ovector16_1[i], ovector16_2[i],
1524 total, current->pattern, current->input);
1525 is_successful = 0;
1526 }
1527 #endif
1528 #if defined SUPPORT_PCRE8 && defined SUPPORT_PCRE32
1529 if (ovector8_1[i] != ovector8_2[i] || ovector8_1[i] != ovector32_1[i] || ovector8_1[i] != ovector32_2[i]) {
1530 printf("\n8 and 32 bit: Ovector[%d] value differs(J8:%d,I8:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
1531 i, ovector8_1[i], ovector8_2[i], ovector32_1[i], ovector32_2[i],
1532 total, current->pattern, current->input);
1533 is_successful = 0;
1534 }
1535 #endif
1536 #if defined SUPPORT_PCRE16 && defined SUPPORT_PCRE16
1537 if (ovector16_1[i] != ovector16_2[i] || ovector16_1[i] != ovector16_1[i] || ovector16_1[i] != ovector16_2[i]) {
1538 printf("\n16 and 16 bit: Ovector[%d] value differs(J16:%d,I16:%d,J32:%d,I32:%d): [%d] '%s' @ '%s' \n",
1539 i, ovector16_1[i], ovector16_2[i], ovector16_1[i], ovector16_2[i],
1540 total, current->pattern, current->input);
1541 is_successful = 0;
1542 }
1543 #endif
1544 }
1545 }
1546 } else
1547 #endif /* more than one of SUPPORT_PCRE8, SUPPORT_PCRE16 and SUPPORT_PCRE32 */
1548 {
1549 /* Only the 8 bit and 16 bit results must be equal. */
1550 #ifdef SUPPORT_PCRE8
1551 if (return_value8[0] != return_value8[1]) {
1552 printf("\n8 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
1553 return_value8[0], return_value8[1], total, current->pattern, current->input);
1554 is_successful = 0;
1555 } else if (return_value8[0] >= 0 || return_value8[0] == PCRE_ERROR_PARTIAL) {
1556 if (return_value8[0] == PCRE_ERROR_PARTIAL)
1557 return_value8[0] = 2;
1558 else
1559 return_value8[0] *= 2;
1560
1561 for (i = 0; i < return_value8[0]; ++i)
1562 if (ovector8_1[i] != ovector8_2[i]) {
1563 printf("\n8 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
1564 i, ovector8_1[i], ovector8_2[i], total, current->pattern, current->input);
1565 is_successful = 0;
1566 }
1567 }
1568 #endif
1569
1570 #ifdef SUPPORT_PCRE16
1571 if (return_value16[0] != return_value16[1]) {
1572 printf("\n16 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
1573 return_value16[0], return_value16[1], total, current->pattern, current->input);
1574 is_successful = 0;
1575 } else if (return_value16[0] >= 0 || return_value16[0] == PCRE_ERROR_PARTIAL) {
1576 if (return_value16[0] == PCRE_ERROR_PARTIAL)
1577 return_value16[0] = 2;
1578 else
1579 return_value16[0] *= 2;
1580
1581 for (i = 0; i < return_value16[0]; ++i)
1582 if (ovector16_1[i] != ovector16_2[i]) {
1583 printf("\n16 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
1584 i, ovector16_1[i], ovector16_2[i], total, current->pattern, current->input);
1585 is_successful = 0;
1586 }
1587 }
1588 #endif
1589
1590 #ifdef SUPPORT_PCRE32
1591 if (return_value32[0] != return_value32[1]) {
1592 printf("\n32 bit: Return value differs(%d:%d): [%d] '%s' @ '%s'\n",
1593 return_value32[0], return_value32[1], total, current->pattern, current->input);
1594 is_successful = 0;
1595 } else if (return_value32[0] >= 0 || return_value32[0] == PCRE_ERROR_PARTIAL) {
1596 if (return_value32[0] == PCRE_ERROR_PARTIAL)
1597 return_value32[0] = 2;
1598 else
1599 return_value32[0] *= 2;
1600
1601 for (i = 0; i < return_value32[0]; ++i)
1602 if (ovector32_1[i] != ovector32_2[i]) {
1603 printf("\n32 bit: Ovector[%d] value differs(%d:%d): [%d] '%s' @ '%s'\n",
1604 i, ovector32_1[i], ovector32_2[i], total, current->pattern, current->input);
1605 is_successful = 0;
1606 }
1607 }
1608 #endif
1609 }
1610 }
1611
1612 if (is_successful) {
1613 #ifdef SUPPORT_PCRE8
1614 if (!(current->start_offset & F_NO8) && ((utf && ucp) || is_ascii)) {
1615 if (return_value8[0] < 0 && !(current->start_offset & F_NOMATCH)) {
1616 printf("8 bit: Test should match: [%d] '%s' @ '%s'\n",
1617 total, current->pattern, current->input);
1618 is_successful = 0;
1619 }
1620
1621 if (return_value8[0] >= 0 && (current->start_offset & F_NOMATCH)) {
1622 printf("8 bit: Test should not match: [%d] '%s' @ '%s'\n",
1623 total, current->pattern, current->input);
1624 is_successful = 0;
1625 }
1626 }
1627 #endif
1628 #ifdef SUPPORT_PCRE16
1629 if (!(current->start_offset & F_NO16) && ((utf && ucp) || is_ascii)) {
1630 if (return_value16[0] < 0 && !(current->start_offset & F_NOMATCH)) {
1631 printf("16 bit: Test should match: [%d] '%s' @ '%s'\n",
1632 total, current->pattern, current->input);
1633 is_successful = 0;
1634 }
1635
1636 if (return_value16[0] >= 0 && (current->start_offset & F_NOMATCH)) {
1637 printf("16 bit: Test should not match: [%d] '%s' @ '%s'\n",
1638 total, current->pattern, current->input);
1639 is_successful = 0;
1640 }
1641 }
1642 #endif
1643 #ifdef SUPPORT_PCRE32
1644 if (!(current->start_offset & F_NO32) && ((utf && ucp) || is_ascii)) {
1645 if (return_value32[0] < 0 && !(current->start_offset & F_NOMATCH)) {
1646 printf("32 bit: Test should match: [%d] '%s' @ '%s'\n",
1647 total, current->pattern, current->input);
1648 is_successful = 0;
1649 }
1650
1651 if (return_value32[0] >= 0 && (current->start_offset & F_NOMATCH)) {
1652 printf("32 bit: Test should not match: [%d] '%s' @ '%s'\n",
1653 total, current->pattern, current->input);
1654 is_successful = 0;
1655 }
1656 }
1657 #endif
1658 }
1659
1660 if (is_successful) {
1661 #ifdef SUPPORT_PCRE8
1662 if (mark8_1 != mark8_2) {
1663 printf("8 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
1664 total, current->pattern, current->input);
1665 is_successful = 0;
1666 }
1667 #endif
1668 #ifdef SUPPORT_PCRE16
1669 if (mark16_1 != mark16_2) {
1670 printf("16 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
1671 total, current->pattern, current->input);
1672 is_successful = 0;
1673 }
1674 #endif
1675 #ifdef SUPPORT_PCRE32
1676 if (mark32_1 != mark32_2) {
1677 printf("32 bit: Mark value mismatch: [%d] '%s' @ '%s'\n",
1678 total, current->pattern, current->input);
1679 is_successful = 0;
1680 }
1681 #endif
1682 }
1683
1684 #ifdef SUPPORT_PCRE8
1685 if (re8) {
1686 pcre_free_study(extra8);
1687 pcre_free(re8);
1688 }
1689 #endif
1690 #ifdef SUPPORT_PCRE16
1691 if (re16) {
1692 pcre16_free_study(extra16);
1693 pcre16_free(re16);
1694 }
1695 #endif
1696 #ifdef SUPPORT_PCRE32
1697 if (re32) {
1698 pcre32_free_study(extra32);
1699 pcre32_free(re32);
1700 }
1701 #endif
1702
1703 if (is_successful) {
1704 successful++;
1705 successful_row++;
1706 printf(".");
1707 if (successful_row >= 60) {
1708 successful_row = 0;
1709 printf("\n");
1710 }
1711 } else
1712 successful_row = 0;
1713
1714 fflush(stdout);
1715 current++;
1716 }
1717 tables(1);
1718 #ifdef SUPPORT_PCRE8
1719 setstack8(NULL);
1720 #endif
1721 #ifdef SUPPORT_PCRE16
1722 setstack16(NULL);
1723 #endif
1724 #ifdef SUPPORT_PCRE32
1725 setstack32(NULL);
1726 #endif
1727
1728 if (total == successful) {
1729 printf("\nAll JIT regression tests are successfully passed.\n");
1730 return 0;
1731 } else {
1732 printf("\nSuccessful test ratio: %d%% (%d failed)\n", successful * 100 / total, total - successful);
1733 return 1;
1734 }
1735 }
1736
1737 /* End of pcre_jit_test.c */

  ViewVC Help
Powered by ViewVC 1.1.5