MCPcopy Create free account
hub / github.com/expr-lang/expr / TestOptimize_sum_array

Function TestOptimize_sum_array

optimizer/sum_array_test.go:38–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestOptimize_sum_array(t *testing.T) {
39 tree, err := parser.Parse(`sum([a, b])`)
40 require.NoError(t, err)
41
42 err = optimizer.Optimize(&tree.Node, nil)
43 require.NoError(t, err)
44
45 expected := &ast.BinaryNode{
46 Operator: "+",
47 Left: &ast.IdentifierNode{Value: "a"},
48 Right: &ast.IdentifierNode{Value: "b"},
49 }
50
51 assert.Equal(t, ast.Dump(expected), ast.Dump(tree.Node))
52}
53
54func TestOptimize_sum_array_3(t *testing.T) {
55 tree, err := parser.Parse(`sum([a, b, c])`)

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.92
NoErrorFunction · 0.92
OptimizeFunction · 0.92
EqualFunction · 0.92
DumpFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…