(t *testing.T, env *cel.Env, ast *cel.Ast, hints map[string]uint64, wantEst checker.CostEstimate)
| 486 | } |
| 487 | |
| 488 | func testCheckCost(t *testing.T, env *cel.Env, ast *cel.Ast, hints map[string]uint64, wantEst checker.CostEstimate) { |
| 489 | t.Helper() |
| 490 | if len(hints) == 0 { |
| 491 | hints = map[string]uint64{} |
| 492 | } |
| 493 | est, err := env.EstimateCost(ast, testCostHintEstimator{hints: hints}) |
| 494 | if err != nil { |
| 495 | t.Fatalf("env.EstimateCost() failed: %v", err) |
| 496 | } |
| 497 | if !reflect.DeepEqual(est, wantEst) { |
| 498 | t.Errorf("env.EstimateCost() got %v, wanted %v", est, wantEst) |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | func testEvalWithCost(t *testing.T, env *cel.Env, ast *cel.Ast, in any, wantCost uint64) { |
| 503 | t.Helper() |
no test coverage detected