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

  ViewVC Help
Powered by ViewVC 1.1.5