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

Function TestNavigateAST

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

Source from the content-addressed store, hash-verified

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

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