MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / TEST_P

Function TEST_P

runtime/function_registry_test.cc:211–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209using NonStrictRegistrationFailTest = testing::TestWithParam<NonStrictTestCase>;
210
211TEST_P(NonStrictRegistrationFailTest,
212 IfOtherOverloadExistsRegisteringNonStrictFails) {
213 bool existing_function_is_lazy, new_function_is_lazy;
214 std::tie(existing_function_is_lazy, new_function_is_lazy) = GetParam();
215 FunctionRegistry registry;
216 cel::FunctionDescriptor descriptor("OverloadedFunction",
217 /*receiver_style=*/false, {Kind::kAny},
218 /*is_strict=*/true);
219 if (existing_function_is_lazy) {
220 ASSERT_OK(registry.RegisterLazyFunction(descriptor));
221 } else {
222 ASSERT_OK(
223 registry.Register(descriptor, std::make_unique<ConstIntFunction>()));
224 }
225 cel::FunctionDescriptor new_descriptor("OverloadedFunction",
226 /*receiver_style=*/false,
227 {Kind::kAny, Kind::kAny},
228 /*is_strict=*/false);
229 absl::Status status;
230 if (new_function_is_lazy) {
231 status = registry.RegisterLazyFunction(new_descriptor);
232 } else {
233 status =
234 registry.Register(new_descriptor, std::make_unique<ConstIntFunction>());
235 }
236 EXPECT_THAT(status, StatusIs(absl::StatusCode::kAlreadyExists,
237 HasSubstr("Only one overload")));
238}
239
240TEST_P(NonStrictRegistrationFailTest,
241 IfOtherNonStrictExistsRegisteringStrictFails) {

Callers

nothing calls this directly

Calls 2

RegisterLazyFunctionMethod · 0.45
RegisterMethod · 0.45

Tested by

no test coverage detected