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

Method Equal

common/values/int_value.cc:81–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81absl::Status IntValue::Equal(
82 const Value& other,
83 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
84 google::protobuf::MessageFactory* absl_nonnull message_factory,
85 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
86 ABSL_DCHECK(descriptor_pool != nullptr);
87 ABSL_DCHECK(message_factory != nullptr);
88 ABSL_DCHECK(arena != nullptr);
89 ABSL_DCHECK(result != nullptr);
90
91 if (auto other_value = other.AsInt(); other_value.has_value()) {
92 *result = BoolValue{NativeValue() == other_value->NativeValue()};
93 return absl::OkStatus();
94 }
95 if (auto other_value = other.AsDouble(); other_value.has_value()) {
96 *result =
97 BoolValue{internal::Number::FromInt64(NativeValue()) ==
98 internal::Number::FromDouble(other_value->NativeValue())};
99 return absl::OkStatus();
100 }
101 if (auto other_value = other.AsUint(); other_value.has_value()) {
102 *result =
103 BoolValue{internal::Number::FromInt64(NativeValue()) ==
104 internal::Number::FromUint64(other_value->NativeValue())};
105 return absl::OkStatus();
106 }
107 *result = FalseValue();
108 return absl::OkStatus();
109}
110
111} // namespace cel

Callers 7

OptionalValueEqualFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45

Calls 7

FalseValueFunction · 0.85
NativeValueFunction · 0.70
AsIntMethod · 0.45
has_valueMethod · 0.45
NativeValueMethod · 0.45
AsDoubleMethod · 0.45
AsUintMethod · 0.45

Tested by 6

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36