(t *testing.T)
| 201 | } |
| 202 | |
| 203 | func TestMemoryTrackingCalculationLimitExceeded(t *testing.T) { |
| 204 | env := testEnv(t, Variable("a", ListType(StringType))) |
| 205 | ast, iss := env.Compile(`a`) |
| 206 | if iss.Err() != nil { |
| 207 | t.Fatalf("env.Compile() failed: %v", iss.Err()) |
| 208 | } |
| 209 | program, err := env.Program(ast, |
| 210 | MemoryTracking( |
| 211 | types.MemoryTrackerSizeCalculator( |
| 212 | types.NewSizeCalculator(types.SizeCalculatorMaxTraversal(2))))) |
| 213 | if err != nil { |
| 214 | t.Fatalf("env.Program() failed: %v", err) |
| 215 | } |
| 216 | _, details, err := program.Eval(map[string]any{"a": []string{"a", "b", "c", "d", "e"}}) |
| 217 | if err != nil { |
| 218 | t.Fatalf("program.Eval() failed: %v", err) |
| 219 | } |
| 220 | if peak := details.PeakMemory(); peak == nil || *peak != math.MaxUint32 { |
| 221 | t.Errorf("EvalDetails.PeakMemory() got %v, wanted MaxUint32", peak) |
| 222 | } |
| 223 | } |
nothing calls this directly
no test coverage detected