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

Function testCheckCost

ext/sets_test.go:488–500  ·  view source on GitHub ↗
(t *testing.T, env *cel.Env, ast *cel.Ast, hints map[string]uint64, wantEst checker.CostEstimate)

Source from the content-addressed store, hash-verified

486}
487
488func 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
502func testEvalWithCost(t *testing.T, env *cel.Env, ast *cel.Ast, in any, wantCost uint64) {
503 t.Helper()

Callers 6

TestListsCostsFunction · 0.85
TestSetsFunction · 0.85
TestBindingsFunction · 0.85
TestStringCostTrackingFunction · 0.85
TestRegexCostsFunction · 0.85

Calls 1

EstimateCostMethod · 0.80

Tested by

no test coverage detected