MCPcopy Create free account
hub / github.com/apache/kvrocks / TEST

Function TEST

tests/cppunit/ir_dot_dumper_test.cc:38–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36static auto Parse(const std::string& in) { return sql::ParseToIR(peg::string_input(in, "test")); }
37
38TEST(DotDumperTest, Simple) {
39 auto ir = *Parse("select a from b where c = 1 or d hastag \"x\" and 2 <= e order by e asc limit 0, 10");
40
41 std::stringstream ss;
42 DotDumper dumper{ss};
43
44 dumper.Dump(ir.get());
45
46 std::string dot = ss.str();
47 std::smatch matches;
48
49 std::regex_search(dot, matches, std::regex(R"((\w+) \[ label = "SearchStmt)"));
50 auto search_stmt = matches[1].str();
51
52 std::regex_search(dot, matches, std::regex(R"((\w+) \[ label = "OrExpr)"));
53 auto or_expr = matches[1].str();
54
55 std::regex_search(dot, matches, std::regex(R"((\w+) \[ label = "AndExpr)"));
56 auto and_expr = matches[1].str();
57
58 ASSERT_NE(dot.find(fmt::format("{} -> {}", search_stmt, or_expr)), std::string::npos);
59 ASSERT_NE(dot.find(fmt::format("{} -> {}", or_expr, and_expr)), std::string::npos);
60}
61
62static auto ParseS(SemaChecker& sc, const std::string& in) {
63 auto ir = *Parse(in);

Callers

nothing calls this directly

Calls 5

getMethod · 0.80
ParseFunction · 0.70
MakeIndexMapFunction · 0.70
ParseSFunction · 0.70
DumpMethod · 0.45

Tested by

no test coverage detected