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

Function Test

extern/re2/re2/testing/regexp_benchmark.cc:36–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace re2 {
35
36void Test() {
37 Regexp* re = Regexp::Parse("(\\d+)-(\\d+)-(\\d+)", Regexp::LikePerl, NULL);
38 CHECK(re);
39 Prog* prog = re->CompileToProg(0);
40 CHECK(prog);
41 CHECK(prog->IsOnePass());
42 CHECK(prog->CanBitState());
43 const char* text = "650-253-0001";
44 StringPiece sp[4];
45 CHECK(prog->SearchOnePass(text, text, Prog::kAnchored, Prog::kFullMatch, sp, 4));
46 CHECK_EQ(sp[0], "650-253-0001");
47 CHECK_EQ(sp[1], "650");
48 CHECK_EQ(sp[2], "253");
49 CHECK_EQ(sp[3], "0001");
50 delete prog;
51 re->Decref();
52 LOG(INFO) << "test passed\n";
53}
54
55void MemoryUsage() {
56 const char* regexp = "(\\d+)-(\\d+)-(\\d+)";

Callers

nothing calls this directly

Calls 6

ParseFunction · 0.85
CompileToProgMethod · 0.80
IsOnePassMethod · 0.80
CanBitStateMethod · 0.80
SearchOnePassMethod · 0.80
DecrefMethod · 0.45

Tested by

no test coverage detected