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

Function TEST

common/navigable_ast_test.cc:45–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45TEST(NavigableAst, Basic) {
46 Expr const_node;
47 const_node.set_id(1);
48 const_node.mutable_const_expr().set_int_value(42);
49
50 NavigableAst ast = NavigableAst::Build(const_node);
51 EXPECT_TRUE(ast.IdsAreUnique());
52
53 const NavigableAstNode& root = ast.Root();
54
55 EXPECT_EQ(root.expr(), &const_node);
56 EXPECT_THAT(root.children(), IsEmpty());
57 EXPECT_TRUE(root.parent() == nullptr);
58 EXPECT_EQ(root.child_index(), -1);
59 EXPECT_EQ(root.node_kind(), NodeKind::kConstant);
60 EXPECT_EQ(root.parent_relation(), ChildKind::kUnspecified);
61}
62
63TEST(NavigableAst, DefaultCtorEmpty) {
64 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
atMethod · 0.80
argsMethod · 0.80
heightMethod · 0.80

Tested by

no test coverage detected