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

Function TestMemoryTrackingDisabled

cel/memory_test.go:141–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func TestMemoryTrackingDisabled(t *testing.T) {
142 env := testEnv(t, Variable("a", ListType(IntType)))
143 ast, iss := env.Compile(`a + a`)
144 if iss.Err() != nil {
145 t.Fatalf("env.Compile() failed: %v", iss.Err())
146 }
147 program, err := env.Program(ast, EvalOptions(OptTrackState))
148 if err != nil {
149 t.Fatalf("env.Program() failed: %v", err)
150 }
151 _, details, err := program.Eval(map[string]any{"a": []int64{1, 2}})
152 if err != nil {
153 t.Fatalf("program.Eval() failed: %v", err)
154 }
155 if peak := details.PeakMemory(); peak != nil {
156 t.Errorf("EvalDetails.PeakMemory() got %d, wanted nil when tracking disabled", *peak)
157 }
158}
159
160func TestMemoryLimit(t *testing.T) {
161 tests := []struct {

Callers

nothing calls this directly

Calls 8

EvalOptionsFunction · 0.85
ErrMethod · 0.80
ProgramMethod · 0.80
PeakMemoryMethod · 0.80
testEnvFunction · 0.70
VariableFunction · 0.70
CompileMethod · 0.65
EvalMethod · 0.65

Tested by

no test coverage detected