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

Function TEST

extern/re2/re2/testing/compile_test.cc:114–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112};
113
114TEST(TestRegexpCompileToProg, Simple) {
115 int failed = 0;
116 for (size_t i = 0; i < arraysize(tests); i++) {
117 const re2::Test& t = tests[i];
118 Regexp* re = Regexp::Parse(t.regexp, Regexp::PerlX|Regexp::Latin1, NULL);
119 if (re == NULL) {
120 LOG(ERROR) << "Cannot parse: " << t.regexp;
121 failed++;
122 continue;
123 }
124 Prog* prog = re->CompileToProg(0);
125 if (prog == NULL) {
126 LOG(ERROR) << "Cannot compile: " << t.regexp;
127 re->Decref();
128 failed++;
129 continue;
130 }
131 ASSERT_TRUE(re->CompileToProg(1) == NULL);
132 std::string s = prog->Dump();
133 if (s != t.code) {
134 LOG(ERROR) << "Incorrect compiled code for: " << t.regexp;
135 LOG(ERROR) << "Want:\n" << t.code;
136 LOG(ERROR) << "Got:\n" << s;
137 failed++;
138 }
139 delete prog;
140 re->Decref();
141 }
142 EXPECT_EQ(failed, 0);
143}
144
145static void DumpByteMap(StringPiece pattern, Regexp::ParseFlags flags,
146 std::string* bytemap) {

Callers

nothing calls this directly

Calls 6

ParseFunction · 0.85
DumpByteMapFunction · 0.85
DumpFunction · 0.85
CompileToProgMethod · 0.80
DecrefMethod · 0.45
DumpMethod · 0.45

Tested by

no test coverage detected