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

Method Evaluate

eval/eval/function_step_test.cc:122–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121
122 absl::Status Evaluate(absl::Span<const CelValue> args, CelValue* result,
123 google::protobuf::Arena* arena) const override {
124 if (args.size() != 2 || !args[0].IsInt64() || !args[1].IsInt64()) {
125 return absl::Status(absl::StatusCode::kInvalidArgument,
126 "Mismatched arguments passed to method");
127 }
128 if (should_return_unknown_) {
129 *result =
130 CreateUnknownFunctionResultError(arena, "Add can't be resolved.");
131 return absl::OkStatus();
132 }
133
134 int64_t arg0 = args[0].Int64OrDie();
135 int64_t arg1 = args[1].Int64OrDie();
136
137 *result = CelValue::CreateInt64(arg0 + arg1);
138 return absl::OkStatus();
139 }
140
141 private:
142 bool should_return_unknown_;

Callers 1

TEST_PFunction · 0.45

Calls 4

IsInt64Method · 0.80
Int64OrDieMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected