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

Function TEST_F

runtime/function_adapter_test.cc:58–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56};
57
58TEST_F(FunctionAdapterTest, UnaryFunctionAdapterWrapFunctionOldOverload) {
59 using FunctionAdapter = UnaryFunctionAdapter<StringValue, const StringValue&>;
60
61 std::unique_ptr<Function> wrapped = FunctionAdapter::WrapFunction(
62 [](const StringValue& x,
63 const Function::InvokeContext& context) -> StringValue {
64 std::string buf;
65 absl::string_view s = x.ToStringView(&buf);
66 buf = absl::StrCat("pre_", s);
67 return StringValue::From(std::move(buf), context.arena());
68 });
69
70 std::vector<Value> args{StringValue::Wrap(absl::string_view("foo"), arena())};
71 ASSERT_OK_AND_ASSIGN(
72 auto result,
73 wrapped->Invoke(args, descriptor_pool(), message_factory(), arena()));
74
75 EXPECT_THAT(result, test::StringValueIs("pre_foo"));
76 ASSERT_OK_AND_ASSIGN(result, wrapped->Invoke(args, test_invoke_context()));
77
78 EXPECT_THAT(result, test::StringValueIs("pre_foo"));
79}
80
81TEST_F(FunctionAdapterTest, UnaryFunctionAdapterWrapFunctionInt) {
82 using FunctionAdapter = UnaryFunctionAdapter<int64_t, int64_t>;

Callers

nothing calls this directly

Calls 15

StringValueIsFunction · 0.85
ErrorValueFunction · 0.85
CreateDescriptorFunction · 0.85
ToStringViewMethod · 0.80
is_strictMethod · 0.80
WrapFunction · 0.50
ASSERT_OK_AND_ASSIGNFunction · 0.50
IntValueClass · 0.50
DoubleValueClass · 0.50
UintValueClass · 0.50
BoolValueClass · 0.50
TimestampValueClass · 0.50

Tested by

no test coverage detected