| 33 | using ::testing::SizeIs; |
| 34 | |
| 35 | TEST(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 | |
| 53 | TEST(NavigableProtoAst, DefaultCtorEmpty) { |
| 54 | Expr const_node; |
no test coverage detected