MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestNavigateAST

Function TestNavigateAST

common/ast/navigable_test.go:33–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31)
32
33func TestNavigateAST(t *testing.T) {
34 tests := []struct {
35 expr string
36 descendantCount int
37 callCount int
38 maxDepth int
39 maxID int64
40 }{
41 {
42 expr: `'a' == 'b'`,
43 descendantCount: 3,
44 callCount: 1,
45 maxDepth: 1,
46 maxID: 4,
47 },
48 {
49 expr: `'a'.size()`,
50 descendantCount: 2,
51 callCount: 1,
52 maxDepth: 1,
53 maxID: 3,
54 },
55 {
56 expr: `[1, 2, 3]`,
57 descendantCount: 4,
58 callCount: 0,
59 maxDepth: 1,
60 maxID: 5,
61 },
62 {
63 expr: `[1, 2, 3][0]`,
64 descendantCount: 6,
65 callCount: 1,
66 maxDepth: 2,
67 maxID: 7,
68 },
69 {
70 expr: `{1u: 'hello'}`,
71 descendantCount: 3,
72 callCount: 0,
73 maxDepth: 1,
74 maxID: 5,
75 },
76 {
77 expr: `{'hello': 'world'}.hello`,
78 descendantCount: 4,
79 callCount: 0,
80 maxDepth: 2,
81 maxID: 6,
82 },
83 {
84 expr: `type(1) == int`,
85 descendantCount: 4,
86 callCount: 2,
87 maxDepth: 2,
88 maxID: 5,
89 },
90 {

Callers

nothing calls this directly

Calls 9

NavigateASTFunction · 0.92
MatchDescendantsFunction · 0.92
AllMatcherFunction · 0.92
MaxIDFunction · 0.92
MatchSubsetFunction · 0.92
KindMatcherFunction · 0.92
mustTypeCheckFunction · 0.85
ExprMethod · 0.65
DepthMethod · 0.65

Tested by

no test coverage detected