Skip to content

Commit e47dc31

Browse files
jnthntatumcopybara-github
authored andcommitted
copybara script updates to better support import. no functional changes.
PiperOrigin-RevId: 753252417
1 parent 6fa0781 commit e47dc31

13 files changed

Lines changed: 21 additions & 194 deletions

eval/eval/create_struct_step_test.cc

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -388,19 +388,6 @@ TEST_P(CreateCreateStructStepTest, TestSetStringField) {
388388
EXPECT_EQ(test_msg.string_value(), kTestStr);
389389
}
390390

391-
// BEGIN_INTERNAL
392-
// Test that fields of type string(cord) are set correctly.
393-
TEST_P(CreateCreateStructStepTest, TestSetCordField) {
394-
const std::string kTestStr = "test";
395-
TestMessage test_msg;
396-
397-
ASSERT_NO_FATAL_FAILURE(RunExpressionAndGetMessage(
398-
env_, "cord_value", CelValue::CreateString(&kTestStr), &arena_, &test_msg,
399-
enable_unknowns(), enable_recursive_planning()));
400-
EXPECT_EQ(test_msg.cord_value(), kTestStr);
401-
}
402-
// END_INTERNAL
403-
404391
// Test that fields of type bytes are set correctly.
405392
TEST_P(CreateCreateStructStepTest, TestSetBytesField) {
406393
const std::string kTestStr = "test";
@@ -631,24 +618,6 @@ TEST_P(CreateCreateStructStepTest, TestSetRepeatedBytesField) {
631618
ASSERT_THAT(test_msg.bytes_list(), Pointwise(Eq(), kValues));
632619
}
633620

634-
// BEGIN_INTERNAL
635-
// Test that repeated fields of type Cord are set correctly
636-
TEST_P(CreateCreateStructStepTest, TestSetRepeatedCordField) {
637-
TestMessage test_msg;
638-
639-
std::vector<std::string> kValues = {"test1", "test2"};
640-
std::vector<CelValue> values;
641-
for (const auto& value : kValues) {
642-
values.push_back(CelValue::CreateString(&value));
643-
}
644-
645-
ASSERT_NO_FATAL_FAILURE(RunExpressionAndGetMessage(
646-
env_, "cord_list", values, &arena_, &test_msg, enable_unknowns(),
647-
enable_recursive_planning()));
648-
ASSERT_THAT(test_msg.cord_list(), Pointwise(Eq(), kValues));
649-
}
650-
// END_INTERNAL
651-
652621
// Test that repeated fields of type Message are set correctly
653622
TEST_P(CreateCreateStructStepTest, TestSetRepeatedMessageField) {
654623
TestMessage test_msg;
@@ -668,25 +637,6 @@ TEST_P(CreateCreateStructStepTest, TestSetRepeatedMessageField) {
668637
ASSERT_THAT(test_msg.message_list()[1], EqualsProto(kValues[1]));
669638
}
670639

671-
// BEGIN_INTERNAL
672-
// Test that repeated fields of type Cord are set correctly
673-
TEST_P(CreateCreateStructStepTest, TestSetRepeatedEnumField) {
674-
TestMessage test_msg;
675-
676-
std::vector<TestMessage::TestEnum> kValues = {TestMessage::TEST_ENUM_2,
677-
TestMessage::TEST_ENUM_1};
678-
std::vector<CelValue> values;
679-
for (auto value : kValues) {
680-
values.push_back(CelValue::CreateInt64(value));
681-
}
682-
683-
ASSERT_NO_FATAL_FAILURE(RunExpressionAndGetMessage(
684-
env_, "enum_list", values, &arena_, &test_msg, enable_unknowns(),
685-
enable_recursive_planning()));
686-
ASSERT_THAT(test_msg.enum_list(), Pointwise(Eq(), kValues));
687-
}
688-
// END_INTERNAL
689-
690640
// Test that fields of type map<string, ...> are set correctly
691641
TEST_P(CreateCreateStructStepTest, TestSetStringMapField) {
692642
TestMessage test_msg;

eval/eval/select_step_test.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -511,21 +511,6 @@ TEST_P(SelectStepConformanceTest, WrapperTypeNullUnboxingDisabledTest) {
511511
EXPECT_TRUE(result.IsInt64());
512512
}
513513

514-
// BEGIN_INTERNAL
515-
TEST_P(SelectStepConformanceTest, SimpleCordTest) {
516-
TestMessage message;
517-
std::string value = "test";
518-
message.set_cord_value(value);
519-
RunExpressionOptions options;
520-
options.enable_unknowns = GetParam();
521-
522-
ASSERT_OK_AND_ASSIGN(CelValue result,
523-
RunExpression(&message, "cord_value", false, options));
524-
ASSERT_TRUE(result.IsString());
525-
EXPECT_EQ(result.StringOrDie().value(), "test");
526-
}
527-
// END_INTERNAL
528-
529514
TEST_P(SelectStepConformanceTest, SimpleBytesTest) {
530515
TestMessage message;
531516
std::string value = "test";

eval/public/cel_function_adapter_impl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
#include "eval/public/cel_value.h"
3131
#include "internal/status_macros.h"
3232

33+
#if defined(__clang__) || !defined(__GNUC__)
34+
// Do not disable.
35+
#else
36+
#define CEL_CPP_DISABLE_PARTIAL_SPECIALIZATION 1
37+
#endif
38+
3339
namespace google::api::expr::runtime {
3440

3541
namespace internal {

eval/public/cel_function_adapter_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ TEST(CelFunctionAdapterTest, TestAdapterNoArg) {
2424
CelValue result = CelValue::CreateNull();
2525
google::protobuf::Arena arena;
2626
ASSERT_OK(cel_func->Evaluate(args, &result, &arena));
27-
// Obvious failure, for educational purposes only.
2827
ASSERT_TRUE(result.IsInt64());
2928
}
3029

eval/public/containers/field_backed_list_impl_test.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -187,23 +187,6 @@ TEST(FieldBackedListImplTest, StringDatatypeTest) {
187187
EXPECT_EQ((*cel_list)[1].StringOrDie().value(), "2");
188188
}
189189

190-
// BEGIN_INTERNAL
191-
TEST(FieldBackedListImplTest, CordDatatypeTest) {
192-
TestMessage message;
193-
message.add_cord_list("1");
194-
message.add_cord_list("2");
195-
196-
google::protobuf::Arena arena;
197-
198-
auto cel_list = CreateList(&message, "cord_list", &arena);
199-
200-
ASSERT_EQ(cel_list->size(), 2);
201-
202-
EXPECT_EQ((*cel_list)[0].StringOrDie().value(), "1");
203-
EXPECT_EQ((*cel_list)[1].StringOrDie().value(), "2");
204-
}
205-
// END_INTERNAL
206-
207190
TEST(FieldBackedListImplTest, BytesDatatypeTest) {
208191
TestMessage message;
209192
message.add_bytes_list("1");

eval/public/containers/internal_field_backed_list_impl_test.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -199,23 +199,6 @@ TEST(FieldBackedListImplTest, StringDatatypeTest) {
199199
EXPECT_EQ((*cel_list)[1].StringOrDie().value(), "2");
200200
}
201201

202-
// BEGIN_INTERNAL
203-
TEST(FieldBackedListImplTest, CordDatatypeTest) {
204-
TestMessage message;
205-
message.add_cord_list("1");
206-
message.add_cord_list("2");
207-
208-
google::protobuf::Arena arena;
209-
210-
auto cel_list = CreateList(&message, "cord_list", &arena);
211-
212-
ASSERT_EQ(cel_list->size(), 2);
213-
214-
EXPECT_EQ((*cel_list)[0].StringOrDie().value(), "1");
215-
EXPECT_EQ((*cel_list)[1].StringOrDie().value(), "2");
216-
}
217-
// END_INTERNAL
218-
219202
TEST(FieldBackedListImplTest, BytesDatatypeTest) {
220203
TestMessage message;
221204
message.add_bytes_list("1");

eval/public/testing/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ cc_library(
1212
deps = [
1313
"//eval/public:cel_value",
1414
"//eval/public:set_util",
15-
"//eval/public:unknown_set",
1615
"//internal:casts",
1716
"//internal:testing",
17+
"@com_google_absl//absl/status",
1818
"@com_google_absl//absl/strings",
1919
"@com_google_absl//absl/time",
2020
"@com_google_protobuf//:protobuf",

eval/public/testing/matchers.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#ifndef THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_TESTING_MATCHERS_H_
22
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_TESTING_MATCHERS_H_
33

4+
#include <cstdint>
45
#include <ostream>
6+
#include <vector>
57

6-
#include "google/protobuf/message.h"
78
#include "gmock/gmock.h"
89
#include "gtest/gtest.h"
10+
#include "absl/status/status.h"
11+
#include "absl/strings/str_cat.h"
912
#include "absl/strings/string_view.h"
1013
#include "absl/time/time.h"
1114
#include "eval/public/cel_value.h"
12-
#include "eval/public/set_util.h"
13-
#include "eval/public/unknown_set.h"
15+
#include "google/protobuf/message.h"
1416

1517
namespace google {
1618
namespace api {
@@ -35,10 +37,10 @@ CelValueMatcher IsCelNull();
3537
CelValueMatcher IsCelBool(testing::Matcher<bool> m);
3638

3739
// Matches CelValues of type int64 whose held value matches |m|.
38-
CelValueMatcher IsCelInt64(testing::Matcher<int64> m);
40+
CelValueMatcher IsCelInt64(testing::Matcher<int64_t> m);
3941

40-
// Matches CelValues of type uint64 whose held value matches |m|.
41-
CelValueMatcher IsCelUint64(testing::Matcher<uint64> m);
42+
// Matches CelValues of type uint64_t whose held value matches |m|.
43+
CelValueMatcher IsCelUint64(testing::Matcher<uint64_t> m);
4244

4345
// Matches CelValues of type double whose held value matches |m|.
4446
CelValueMatcher IsCelDouble(testing::Matcher<double> m);

eval/public/transform_utility.cc

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include "eval/public/transform_utility.h"
22

3+
#include <cstddef>
34
#include <string>
45
#include <utility>
56
#include <vector>
67

78
#include "cel/expr/value.pb.h"
89
#include "google/protobuf/any.pb.h"
910
#include "google/protobuf/struct.pb.h"
10-
#include "google/protobuf/arena.h"
1111
#include "absl/status/status.h"
1212
#include "absl/status/statusor.h"
1313
#include "absl/strings/str_cat.h"
@@ -18,11 +18,6 @@
1818
#include "internal/proto_time_encoding.h"
1919
#include "internal/status_macros.h"
2020

21-
// BEGIN_INTERNAL
22-
#include "net/proto2/contrib/hashcode/hashcode.h"
23-
#include "google/protobuf/util/message_differencer.h"
24-
// END_INTERNAL
25-
2621
namespace google {
2722
namespace api {
2823
namespace expr {
@@ -191,38 +186,6 @@ absl::StatusOr<CelValue> ValueToCelValue(const Value& value,
191186
}
192187
}
193188

194-
// BEGIN_INTERNAL
195-
196-
size_t ValueInterner::operator()(const Value& value) const {
197-
using Mode = proto2::contrib::hashcode::Mode;
198-
// Return a conservative hash.
199-
static int mode =
200-
Mode::USE_FIELDNUMBER | Mode::USE_VALUES | Mode::IGNORE_MAP_KEY_ORDER;
201-
return proto2::contrib::hashcode::HashMessage(value, mode);
202-
}
203-
204-
bool ValueInterner::operator()(const Value& lhs, const Value& rhs) const {
205-
static google::protobuf::util::MessageDifferencer* differencer = []() {
206-
auto* field_comparator = new google::protobuf::util::DefaultFieldComparator();
207-
field_comparator->set_float_comparison(
208-
google::protobuf::util::DefaultFieldComparator::EXACT);
209-
field_comparator->set_treat_nan_as_equal(true);
210-
211-
auto* differencer = new google::protobuf::util::MessageDifferencer();
212-
auto map_entry_field = Value::descriptor()
213-
->FindFieldByName("map_value")
214-
->message_type()
215-
->FindFieldByName("entries");
216-
auto key_field = map_entry_field->message_type()->FindFieldByName("key");
217-
differencer->TreatAsMap(map_entry_field, key_field);
218-
differencer->set_field_comparator(field_comparator);
219-
return differencer;
220-
}();
221-
return differencer->Compare(lhs, rhs);
222-
}
223-
224-
// END_INTERNAL
225-
226189
} // namespace runtime
227190
} // namespace expr
228191
} // namespace api

eval/public/transform_utility.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_TRANSFORM_UTILITY_H_
33

44
#include "cel/expr/value.pb.h"
5-
#include "google/protobuf/arena.h"
65
#include "absl/status/status.h"
76
#include "absl/status/statusor.h"
87
#include "eval/public/cel_value.h"
8+
#include "google/protobuf/arena.h"
99

1010
namespace google {
1111
namespace api {
@@ -30,18 +30,6 @@ inline absl::Status CelValueToValue(const CelValue& value, Value* result) {
3030
absl::StatusOr<CelValue> ValueToCelValue(const Value& value,
3131
google::protobuf::Arena* arena);
3232

33-
// BEGIN_INTERNAL
34-
35-
// TODO(issues/88) Add the notion of hashing and equivalence to CelValue and
36-
// use that instead.
37-
struct ValueInterner {
38-
size_t operator()(const Value& value) const;
39-
40-
bool operator()(const Value& lhs, const Value& rhs) const;
41-
};
42-
43-
// END_INTERNAL
44-
4533
} // namespace runtime
4634

4735
} // namespace expr

0 commit comments

Comments
 (0)