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

Unified Diff: third_party/re2/re2/testing/set_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 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/search_test.cc ('k') | third_party/re2/re2/testing/simplify_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/testing/set_test.cc
diff --git a/third_party/re2/re2/testing/set_test.cc b/third_party/re2/re2/testing/set_test.cc
deleted file mode 100644
index 4e267ae0621d67ce8d91418c35372d0764d5a8d3..0000000000000000000000000000000000000000
--- a/third_party/re2/re2/testing/set_test.cc
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2010 The RE2 Authors. All Rights Reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <vector>
-
-#include "util/test.h"
-#include "re2/re2.h"
-#include "re2/set.h"
-
-namespace re2 {
-
-TEST(Set, Unanchored) {
- RE2::Set s(RE2::DefaultOptions, RE2::UNANCHORED);
-
- CHECK_EQ(s.Add("foo", NULL), 0);
- CHECK_EQ(s.Add("(", NULL), -1);
- CHECK_EQ(s.Add("bar", NULL), 1);
-
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("foobar", &v), true);
- CHECK_EQ(v.size(), 2);
- CHECK_EQ(v[0], 0);
- CHECK_EQ(v[1], 1);
-
- v.clear();
- CHECK_EQ(s.Match("fooba", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 0);
-
- v.clear();
- CHECK_EQ(s.Match("oobar", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 1);
-}
-
-TEST(Set, UnanchoredFactored) {
- RE2::Set s(RE2::DefaultOptions, RE2::UNANCHORED);
-
- CHECK_EQ(s.Add("foo", NULL), 0);
- CHECK_EQ(s.Add("(", NULL), -1);
- CHECK_EQ(s.Add("foobar", NULL), 1);
-
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("foobar", &v), true);
- CHECK_EQ(v.size(), 2);
- CHECK_EQ(v[0], 0);
- CHECK_EQ(v[1], 1);
-
- v.clear();
- CHECK_EQ(s.Match("obarfoobaroo", &v), true);
- CHECK_EQ(v.size(), 2);
- CHECK_EQ(v[0], 0);
- CHECK_EQ(v[1], 1);
-
- v.clear();
- CHECK_EQ(s.Match("fooba", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 0);
-
- v.clear();
- CHECK_EQ(s.Match("oobar", &v), false);
- CHECK_EQ(v.size(), 0);
-}
-
-TEST(Set, UnanchoredDollar) {
- RE2::Set s(RE2::DefaultOptions, RE2::UNANCHORED);
-
- CHECK_EQ(s.Add("foo$", NULL), 0);
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("foo", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 0);
-}
-
-TEST(Set, Anchored) {
- RE2::Set s(RE2::DefaultOptions, RE2::ANCHOR_BOTH);
-
- CHECK_EQ(s.Add("foo", NULL), 0);
- CHECK_EQ(s.Add("(", NULL), -1);
- CHECK_EQ(s.Add("bar", NULL), 1);
-
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("foobar", &v), false);
- CHECK_EQ(v.size(), 0);
-
- CHECK_EQ(s.Match("fooba", &v), false);
- CHECK_EQ(v.size(), 0);
-
- CHECK_EQ(s.Match("oobar", &v), false);
- CHECK_EQ(v.size(), 0);
-
- CHECK_EQ(s.Match("foo", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 0);
-
- CHECK_EQ(s.Match("bar", &v), true);
- CHECK_EQ(v.size(), 1);
- CHECK_EQ(v[0], 1);
-}
-
-TEST(Set, EmptyUnanchored) {
- RE2::Set s(RE2::DefaultOptions, RE2::UNANCHORED);
-
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("", &v), false);
- CHECK_EQ(v.size(), 0);
-
- v.clear();
- CHECK_EQ(s.Match("foobar", &v), false);
- CHECK_EQ(v.size(), 0);
-}
-
-TEST(Set, EmptyAnchored) {
- RE2::Set s(RE2::DefaultOptions, RE2::ANCHOR_BOTH);
-
- CHECK_EQ(s.Compile(), true);
-
- vector<int> v;
- CHECK_EQ(s.Match("", &v), false);
- CHECK_EQ(v.size(), 0);
-
- v.clear();
- CHECK_EQ(s.Match("foobar", &v), false);
- CHECK_EQ(v.size(), 0);
-}
-
-} // namespace re2
« no previous file with comments | « third_party/re2/re2/testing/search_test.cc ('k') | third_party/re2/re2/testing/simplify_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698