MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / TestParse

Function TestParse

extern/re2/re2/testing/parse_test.cc:230–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void TestParse(const Test* tests, int ntests, Regexp::ParseFlags flags,
231 const std::string& title) {
232 Regexp** re = new Regexp*[ntests];
233 for (int i = 0; i < ntests; i++) {
234 RegexpStatus status;
235 Regexp::ParseFlags f = flags;
236 if (tests[i].flags != 0) {
237 f = tests[i].flags & ~TestZeroFlags;
238 }
239 re[i] = Regexp::Parse(tests[i].regexp, f, &status);
240 ASSERT_TRUE(re[i] != NULL)
241 << " " << tests[i].regexp << " " << status.Text();
242 std::string s = re[i]->Dump();
243 EXPECT_EQ(std::string(tests[i].parse), s)
244 << "Regexp: " << tests[i].regexp
245 << "\nparse: " << std::string(tests[i].parse)
246 << " s: " << s << " flag=" << f;
247 }
248
249 for (int i = 0; i < ntests; i++) {
250 for (int j = 0; j < ntests; j++) {
251 EXPECT_EQ(std::string(tests[i].parse) == std::string(tests[j].parse),
252 RegexpEqualTestingOnly(re[i], re[j]))
253 << "Regexp: " << tests[i].regexp << " " << tests[j].regexp;
254 }
255 }
256
257 for (int i = 0; i < ntests; i++)
258 re[i]->Decref();
259 delete[] re;
260}
261
262// Test that regexps parse to expected structures.
263TEST(TestParse, SimpleRegexps) {

Callers 1

TESTFunction · 0.85

Calls 5

ParseFunction · 0.85
RegexpEqualTestingOnlyFunction · 0.85
TextMethod · 0.80
DumpMethod · 0.45
DecrefMethod · 0.45

Tested by

no test coverage detected