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

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

Issue 1516543002: Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated update instructions Created 5 years 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/backtrack.cc ('k') | third_party/re2/re2/testing/dfa_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
1 // Copyright 2007 The RE2 Authors. All Rights Reserved. 1 // Copyright 2007 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Test prog.cc, compile.cc 5 // Test prog.cc, compile.cc
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include "util/test.h" 9 #include "util/test.h"
10 #include "re2/regexp.h" 10 #include "re2/regexp.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 { "[^ab]", 92 { "[^ab]",
93 "5. alt -> 3 | 4\n" 93 "5. alt -> 3 | 4\n"
94 "3. alt -> 1 | 2\n" 94 "3. alt -> 1 | 2\n"
95 "4. byte [63-ff] -> 6\n" 95 "4. byte [63-ff] -> 6\n"
96 "1. byte [00-09] -> 6\n" 96 "1. byte [00-09] -> 6\n"
97 "2. byte [0b-60] -> 6\n" 97 "2. byte [0b-60] -> 6\n"
98 "6. match! 0\n" }, 98 "6. match! 0\n" },
99 { "[Aa]", 99 { "[Aa]",
100 "1. byte/i [61-61] -> 2\n" 100 "1. byte/i [61-61] -> 2\n"
101 "2. match! 0\n" }, 101 "2. match! 0\n" },
102 // Issue 20992936
103 { "[[-`]",
104 "1. byte [5b-60] -> 2\n"
105 "2. match! 0\n" },
102 }; 106 };
103 107
104 TEST(TestRegexpCompileToProg, Simple) { 108 TEST(TestRegexpCompileToProg, Simple) {
105 int failed = 0; 109 int failed = 0;
106 for (int i = 0; i < arraysize(tests); i++) { 110 for (int i = 0; i < arraysize(tests); i++) {
107 const re2::Test& t = tests[i]; 111 const re2::Test& t = tests[i];
108 Regexp* re = Regexp::Parse(t.regexp, Regexp::PerlX|Regexp::Latin1, NULL); 112 Regexp* re = Regexp::Parse(t.regexp, Regexp::PerlX|Regexp::Latin1, NULL);
109 if (re == NULL) { 113 if (re == NULL) {
110 LOG(ERROR) << "Cannot parse: " << t.regexp; 114 LOG(ERROR) << "Cannot parse: " << t.regexp;
111 failed++; 115 failed++;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 EXPECT_TRUE(prog != NULL); 166 EXPECT_TRUE(prog != NULL);
163 EXPECT_EQ(prog->bytemap_range(), arraysize(utf8ranges)); 167 EXPECT_EQ(prog->bytemap_range(), arraysize(utf8ranges));
164 for (int i = 0; i < arraysize(utf8ranges); i++) 168 for (int i = 0; i < arraysize(utf8ranges); i++)
165 for (int j = utf8ranges[i].lo; j <= utf8ranges[i].hi; j++) 169 for (int j = utf8ranges[i].lo; j <= utf8ranges[i].hi; j++)
166 EXPECT_EQ(prog->bytemap()[j], i) << " byte " << j; 170 EXPECT_EQ(prog->bytemap()[j], i) << " byte " << j;
167 delete prog; 171 delete prog;
168 re->Decref(); 172 re->Decref();
169 } 173 }
170 174
171 } // namespace re2 175 } // namespace re2
OLDNEW
« no previous file with comments | « third_party/re2/re2/testing/backtrack.cc ('k') | third_party/re2/re2/testing/dfa_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698