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

Function testMathCostsEnv

ext/math_test.go:672–689  ·  view source on GitHub ↗
(t *testing.T, version int, opts ...cel.EnvOption)

Source from the content-addressed store, hash-verified

670}
671
672func testMathCostsEnv(t *testing.T, version int, opts ...cel.EnvOption) *cel.Env {
673 t.Helper()
674 var mathOpt cel.EnvOption
675 if version > 0 {
676 mathOpt = Math(MathVersion(uint32(version)))
677 } else {
678 mathOpt = Math()
679 }
680 baseOpts := []cel.EnvOption{
681 mathOpt,
682 cel.EnableMacroCallTracking(),
683 }
684 env, err := cel.NewEnv(append(baseOpts, opts...)...)
685 if err != nil {
686 t.Fatalf("cel.NewEnv(Math()) failed: %v", err)
687 }
688 return env
689}
690
691func TestMathCosts(t *testing.T) {
692 tests := []struct {

Callers 1

TestMathCostsFunction · 0.85

Calls 4

EnableMacroCallTrackingFunction · 0.92
NewEnvFunction · 0.92
MathFunction · 0.85
MathVersionFunction · 0.85

Tested by

no test coverage detected