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

Function InitActivation

runtime/memory_safety_test.cc:208–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206};
207
208void InitActivation(const TestCase& test_case, google::protobuf::Arena& arena,
209 Activation& activation) {
210 for (const auto& [key, value] : test_case.activation) {
211 if (absl::holds_alternative<Value>(value)) {
212 activation.InsertOrAssignValue(key, std::get<Value>(value));
213 } else {
214 // Note: This assumes that the TestCase is valid for the given TEST.
215 // Changes to the activation map will invalidate the pointer to message
216 // that gets wrapped here.
217 activation.InsertOrAssignValue(
218 key, Value::WrapMessageUnsafe(
219 &std::get<NestedTestAllTypes>(value),
220 google::protobuf::DescriptorPool::generated_pool(),
221 google::protobuf::MessageFactory::generated_factory(), &arena));
222 }
223 }
224}
225
226TEST_P(EvaluatorMemorySafetyTest, Basic) {
227 const auto& test_case = GetTestCase();

Callers 1

TEST_PFunction · 0.85

Calls 1

InsertOrAssignValueMethod · 0.80

Tested by

no test coverage detected