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

Unified Diff: third_party/re2/re2/testing/filtered_re2_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/re2/testing/exhaustive_tester.cc ('k') | third_party/re2/re2/testing/null_walker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/testing/filtered_re2_test.cc
diff --git a/third_party/re2/re2/testing/filtered_re2_test.cc b/third_party/re2/re2/testing/filtered_re2_test.cc
index e3a0dd1376c1d6253401e27427b7154f76ec6950..76c1284d2fc9e5f4b3bec8235004af2ef79e6252 100644
--- a/third_party/re2/re2/testing/filtered_re2_test.cc
+++ b/third_party/re2/re2/testing/filtered_re2_test.cc
@@ -44,7 +44,7 @@ TEST(FilteredRE2Test, SmallLatinTest) {
FilterTestVars v;
int id;
- v.opts.set_utf8(false);
+ v.opts.set_encoding(RE2::Options::EncodingLatin1);
v.f.Add("\xde\xadQ\xbe\xef", v.opts, &id);
v.f.Compile(&v.atoms);
EXPECT_EQ(1, v.atoms.size());
@@ -158,10 +158,10 @@ bool CheckExpectedAtoms(const char* atoms[],
if (!pass) {
LOG(WARNING) << "Failed " << testname;
LOG(WARNING) << "Expected #atoms = " << expected.size();
- for (int i = 0; i < expected.size(); i++)
+ for (size_t i = 0; i < expected.size(); i++)
LOG(WARNING) << expected[i];
LOG(WARNING) << "Found #atoms = " << v->atoms.size();
- for (int i = 0; i < v->atoms.size(); i++)
+ for (size_t i = 0; i < v->atoms.size(); i++)
LOG(WARNING) << v->atoms[i];
}
@@ -189,18 +189,16 @@ TEST(FilteredRE2Test, AtomTests) {
EXPECT_EQ(0, nfail);
}
-void FindAtomIndices(const vector<string> atoms,
- const vector<string> matched_atoms,
+void FindAtomIndices(const vector<string>& atoms,
+ const vector<string>& matched_atoms,
vector<int>* atom_indices) {
atom_indices->clear();
- for (int i = 0; i < matched_atoms.size(); i++) {
- int j = 0;
- for (; j < atoms.size(); j++) {
+ for (size_t i = 0; i < matched_atoms.size(); i++) {
+ for (size_t j = 0; j < atoms.size(); j++) {
if (matched_atoms[i] == atoms[j]) {
- atom_indices->push_back(j);
+ atom_indices->push_back(static_cast<int>(j));
break;
}
- EXPECT_LT(j, atoms.size());
}
}
}
@@ -266,7 +264,7 @@ TEST(FilteredRE2Test, MatchTests) {
atoms.push_back("yyyzzz");
FindAtomIndices(v.atoms, atoms, &atom_ids);
LOG(INFO) << "S: " << atom_ids.size();
- for (int i = 0; i < atom_ids.size(); i++)
+ for (size_t i = 0; i < atom_ids.size(); i++)
LOG(INFO) << "i: " << i << " : " << atom_ids[i];
v.f.AllMatches(text, atom_ids, &matching_regexps);
EXPECT_EQ(2, matching_regexps.size());
« no previous file with comments | « third_party/re2/re2/testing/exhaustive_tester.cc ('k') | third_party/re2/re2/testing/null_walker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698