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

Function TEST

extern/re2/re2/testing/simplify_test.cc:247–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245};
246
247TEST(TestSimplify, SimpleRegexps) {
248 for (size_t i = 0; i < arraysize(tests); i++) {
249 RegexpStatus status;
250 VLOG(1) << "Testing " << tests[i].regexp;
251 Regexp* re = Regexp::Parse(tests[i].regexp,
252 Regexp::MatchNL | (Regexp::LikePerl &
253 ~Regexp::OneLine),
254 &status);
255 ASSERT_TRUE(re != NULL) << " " << tests[i].regexp << " " << status.Text();
256 Regexp* sre = re->Simplify();
257 ASSERT_TRUE(sre != NULL);
258
259 // Check that already-simple regexps don't allocate new ones.
260 if (strcmp(tests[i].regexp, tests[i].simplified) == 0) {
261 ASSERT_TRUE(re == sre) << " " << tests[i].regexp
262 << " " << re->ToString() << " " << sre->ToString();
263 }
264
265 EXPECT_EQ(tests[i].simplified, sre->ToString())
266 << " " << tests[i].regexp << " " << sre->Dump();
267
268 re->Decref();
269 sre->Decref();
270 }
271}
272
273} // namespace re2

Callers

nothing calls this directly

Calls 6

ParseFunction · 0.85
TextMethod · 0.80
SimplifyMethod · 0.45
ToStringMethod · 0.45
DumpMethod · 0.45
DecrefMethod · 0.45

Tested by

no test coverage detected