Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: third_party/re2/re2/testing/exhaustive1_test.cc

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/re2/re2/testing/dump.cc ('k') | third_party/re2/re2/testing/exhaustive2_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2008 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Exhaustive testing of regular expression matching.
6
7 #include "util/test.h"
8 #include "re2/testing/exhaustive_tester.h"
9
10 DECLARE_string(regexp_engines);
11
12 namespace re2 {
13
14 // Test simple repetition operators
15 TEST(Repetition, Simple) {
16 vector<string> ops = Split(" ",
17 "%s{0} %s{0,} %s{1} %s{1,} %s{0,1} %s{0,2} "
18 "%s{1,2} %s{2} %s{2,} %s{3,4} %s{4,5} "
19 "%s* %s+ %s? %s*? %s+? %s??");
20 ExhaustiveTest(3, 2, Explode("abc."), ops,
21 6, Explode("ab"), "(?:%s)", "");
22 ExhaustiveTest(3, 2, Explode("abc."), ops,
23 40, Explode("a"), "(?:%s)", "");
24 }
25
26 // Test capturing parens -- (a) -- inside repetition operators
27 TEST(Repetition, Capturing) {
28 vector<string> ops = Split(" ",
29 "%s{0} %s{0,} %s{1} %s{1,} %s{0,1} %s{0,2} "
30 "%s{1,2} %s{2} %s{2,} %s{3,4} %s{4,5} "
31 "%s* %s+ %s? %s*? %s+? %s??");
32 ExhaustiveTest(3, 2, Split(" ", "a (a) b"), ops,
33 7, Explode("ab"), "(?:%s)", "");
34
35 // This would be a great test, but it runs forever when PCRE is enabled.
36 if (strstr("PCRE", FLAGS_regexp_engines.c_str()) == NULL)
37 ExhaustiveTest(4, 3, Split(" ", "a (a)"), ops,
38 100, Explode("a"), "(?:%s)", "");
39 }
40
41 } // namespace re2
42
OLDNEW
« no previous file with comments | « third_party/re2/re2/testing/dump.cc ('k') | third_party/re2/re2/testing/exhaustive2_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698