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

Side by Side Diff: third_party/re2/re2/testing/tester.h

Issue 1530113002: Revert of Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/string_generator.cc ('k') | third_party/re2/re2/testing/tester.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 2008 The RE2 Authors. All Rights Reserved. 1 // Copyright 2008 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 // Comparative tester for regular expression matching. 5 // Comparative tester for regular expression matching.
6 // Checks all implementations against each other. 6 // Checks all implementations against each other.
7 7
8 #ifndef RE2_TESTING_TESTER_H__ 8 #ifndef RE2_TESTING_TESTER_H__
9 #define RE2_TESTING_TESTER_H__ 9 #define RE2_TESTING_TESTER_H__
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Regexp::ParseFlags flags_; // flags for parsing regexp_str_ 77 Regexp::ParseFlags flags_; // flags for parsing regexp_str_
78 bool error_; // error during constructor? 78 bool error_; // error during constructor?
79 79
80 Regexp* regexp_; // parsed regexp 80 Regexp* regexp_; // parsed regexp
81 int num_captures_; // regexp_->NumCaptures() cached 81 int num_captures_; // regexp_->NumCaptures() cached
82 Prog* prog_; // compiled program 82 Prog* prog_; // compiled program
83 Prog* rprog_; // compiled reverse program 83 Prog* rprog_; // compiled reverse program
84 PCRE* re_; // PCRE implementation 84 PCRE* re_; // PCRE implementation
85 RE2* re2_; // RE2 implementation 85 RE2* re2_; // RE2 implementation
86 86
87 DISALLOW_COPY_AND_ASSIGN(TestInstance); 87 DISALLOW_EVIL_CONSTRUCTORS(TestInstance);
88 }; 88 };
89 89
90 // A group of TestInstances for all possible configurations. 90 // A group of TestInstances for all possible configurations.
91 class Tester { 91 class Tester {
92 public: 92 public:
93 explicit Tester(const StringPiece& regexp); 93 explicit Tester(const StringPiece& regexp);
94 ~Tester(); 94 ~Tester();
95 95
96 bool error() { return error_; } 96 bool error() { return error_; }
97 97
98 // Runs a single test case: search in text, which is in context, 98 // Runs a single test case: search in text, which is in context,
99 // using the given anchoring. 99 // using the given anchoring.
100 bool TestCase(const StringPiece& text, const StringPiece& context, 100 bool TestCase(const StringPiece& text, const StringPiece& context,
101 Prog::Anchor anchor); 101 Prog::Anchor anchor);
102 102
103 // Run TestCase(text, text, anchor) for all anchoring modes. 103 // Run TestCase(text, text, anchor) for all anchoring modes.
104 bool TestInput(const StringPiece& text); 104 bool TestInput(const StringPiece& text);
105 105
106 // Run TestCase(text, context, anchor) for all anchoring modes. 106 // Run TestCase(text, context, anchor) for all anchoring modes.
107 bool TestInputInContext(const StringPiece& text, const StringPiece& context); 107 bool TestInputInContext(const StringPiece& text, const StringPiece& context);
108 108
109 private: 109 private:
110 bool error_; 110 bool error_;
111 vector<TestInstance*> v_; 111 vector<TestInstance*> v_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(Tester); 113 DISALLOW_EVIL_CONSTRUCTORS(Tester);
114 }; 114 };
115 115
116 // Run all possible tests using regexp and text. 116 // Run all possible tests using regexp and text.
117 bool TestRegexpOnText(const StringPiece& regexp, const StringPiece& text); 117 bool TestRegexpOnText(const StringPiece& regexp, const StringPiece& text);
118 118
119 } // namespace re2 119 } // namespace re2
120 120
121 #endif // RE2_TESTING_TESTER_H__ 121 #endif // RE2_TESTING_TESTER_H__
OLDNEW
« no previous file with comments | « third_party/re2/re2/testing/string_generator.cc ('k') | third_party/re2/re2/testing/tester.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698