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

Function BenchmarkEnvExtendEagerDecls

cel/env_test.go:1180–1201  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1178}
1179
1180func BenchmarkEnvExtendEagerDecls(b *testing.B) {
1181 env, err := NewEnv(EagerlyValidateDeclarations(true))
1182 if err != nil {
1183 b.Fatalf("NewEnv() failed: %v", err)
1184 }
1185 for i := 0; i < b.N; i++ {
1186 ext, err := env.Extend(
1187 Variable("test_var", StringType),
1188 Function(
1189 operators.In,
1190 Overload("string_in_string", []*Type{StringType, StringType}, BoolType),
1191 ),
1192 )
1193 if err != nil {
1194 b.Fatalf("env.Extend() failed: %v", err)
1195 }
1196 _, iss := ext.Compile("123")
1197 if iss.Err() != nil {
1198 b.Fatalf("env.Compile(123) failed: %v", iss.Err())
1199 }
1200 }
1201}
1202
1203func mustContextProto(t *testing.T, pb proto.Message, opts ...types.RegistryOption) Activation {
1204 t.Helper()

Callers

nothing calls this directly

Calls 8

ExtendMethod · 0.95
ErrMethod · 0.80
NewEnvFunction · 0.70
VariableFunction · 0.70
FunctionFunction · 0.70
OverloadFunction · 0.70
CompileMethod · 0.65

Tested by

no test coverage detected