| 142 | } |
| 143 | |
| 144 | absl::StatusOr<Value> MaxList( |
| 145 | const ListValue& values, |
| 146 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
| 147 | google::protobuf::MessageFactory* absl_nonnull message_factory, |
| 148 | google::protobuf::Arena* absl_nonnull arena) { |
| 149 | CEL_ASSIGN_OR_RETURN(auto iterator, values.NewIterator()); |
| 150 | if (!iterator->HasNext()) { |
| 151 | return ErrorValue( |
| 152 | absl::InvalidArgumentError("math.@max argument must not be empty")); |
| 153 | } |
| 154 | Value value; |
| 155 | CEL_RETURN_IF_ERROR( |
| 156 | iterator->Next(descriptor_pool, message_factory, arena, &value)); |
| 157 | absl::StatusOr<CelNumber> current = ValueToNumber(value, kMathMax); |
| 158 | if (!current.ok()) { |
| 159 | return ErrorValue{current.status()}; |
| 160 | } |
| 161 | CelNumber min = *current; |
| 162 | while (iterator->HasNext()) { |
| 163 | CEL_RETURN_IF_ERROR( |
| 164 | iterator->Next(descriptor_pool, message_factory, arena, &value)); |
| 165 | absl::StatusOr<CelNumber> other = ValueToNumber(value, kMathMax); |
| 166 | if (!other.ok()) { |
| 167 | return ErrorValue{other.status()}; |
| 168 | } |
| 169 | min = MaxNumber(min, *other); |
| 170 | } |
| 171 | return NumberToValue(min); |
| 172 | } |
| 173 | |
| 174 | template <typename T, typename U> |
| 175 | absl::Status RegisterCrossNumericMin(FunctionRegistry& registry) { |
nothing calls this directly
no test coverage detected