MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / TEST

Function TEST

tools/navigable_ast_test.cc:35–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33using ::testing::SizeIs;
34
35TEST(NavigableProtoAst, Basic) {
36 Expr const_node;
37 const_node.set_id(1);
38 const_node.mutable_const_expr()->set_int64_value(42);
39
40 NavigableProtoAst ast = NavigableProtoAst::Build(const_node);
41 EXPECT_TRUE(ast.IdsAreUnique());
42
43 const NavigableProtoAstNode& root = ast.Root();
44
45 EXPECT_EQ(root.expr(), &const_node);
46 EXPECT_THAT(root.children(), IsEmpty());
47 EXPECT_TRUE(root.parent() == nullptr);
48 EXPECT_EQ(root.child_index(), -1);
49 EXPECT_EQ(root.node_kind(), NodeKind::kConstant);
50 EXPECT_EQ(root.parent_relation(), ChildKind::kUnspecified);
51}
52
53TEST(NavigableProtoAst, DefaultCtorEmpty) {
54 Expr const_node;

Callers 1

ASSERT_OK_AND_ASSIGNFunction · 0.70

Calls 15

IdsAreUniqueMethod · 0.80
childrenMethod · 0.80
parentMethod · 0.80
child_indexMethod · 0.80
node_kindMethod · 0.80
parent_relationMethod · 0.80
FindIdMethod · 0.80
set_functionMethod · 0.80
FindExprMethod · 0.80
argsMethod · 0.80
heightMethod · 0.80
DescendantsPostorderMethod · 0.80

Tested by

no test coverage detected