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

Function PackMessage

internal/message_equality_test.cc:85–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83using UnaryMessageEqualsTest = TestWithParam<UnaryMessageEqualsTestParam>;
84
85google::protobuf::Message* PackMessage(const google::protobuf::Message& message) {
86 const auto* descriptor =
87 ABSL_DIE_IF_NULL(GetTestingDescriptorPool()->FindMessageTypeByName(
88 MessageTypeNameFor<google::protobuf::Any>()));
89 const auto* prototype =
90 ABSL_DIE_IF_NULL(GetTestingMessageFactory()->GetPrototype(descriptor));
91 auto instance = prototype->New(GetTestArena());
92 auto reflection = well_known_types::GetAnyReflectionOrDie(descriptor);
93 reflection.SetTypeUrl(
94 cel::to_address(instance),
95 absl::StrCat("type.googleapis.com/", message.GetTypeName()));
96 absl::Cord value;
97 ABSL_CHECK(message.SerializeToString(&value));
98 reflection.SetValue(cel::to_address(instance), value);
99 return instance;
100}
101
102TEST_P(UnaryMessageEqualsTest, Equals) {
103 const auto* pool = GetTestingDescriptorPool();

Callers 1

TEST_PFunction · 0.85

Calls 7

GetAnyReflectionOrDieFunction · 0.85
to_addressFunction · 0.85
GetTestArenaFunction · 0.70
NewMethod · 0.45
SetTypeUrlMethod · 0.45
GetTypeNameMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected