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

Function RegisterLegacyLists

extensions/sets_functions_benchmark_test.cc:131–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129};
130
131absl::StatusOr<std::unique_ptr<ListStorage>> RegisterLegacyLists(
132 bool overlap, int len, Activation& activation) {
133 std::vector<CelValue> x;
134 std::vector<CelValue> y;
135 x.reserve(len + 1);
136 y.reserve(len + 1);
137 if (overlap) {
138 x.push_back(CelValue::CreateInt64(2));
139 y.push_back(CelValue::CreateInt64(1));
140 }
141
142 for (int i = 0; i < len; i++) {
143 x.push_back(CelValue::CreateInt64(1));
144 y.push_back(CelValue::CreateInt64(2));
145 }
146
147 auto result = std::make_unique<LegacyListStorage>(
148 ContainerBackedListImpl(std::move(x)),
149 ContainerBackedListImpl(std::move(y)));
150
151 activation.InsertValue("x", result->x());
152 activation.InsertValue("y", result->y());
153 return result;
154}
155
156// Constant list literal that has the same elements as the bound test cases.
157std::string ConstantList(bool overlap, int len) {

Callers 1

RegisterListsFunction · 0.85

Calls 4

InsertValueMethod · 0.80
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected