aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util
diff options
context:
space:
mode:
authorgotmanov <gotmanov@yandex-team.ru>2022-02-10 16:49:26 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:26 +0300
commit243edeedfd2c5152b5c7812e0af471e1bb0232e8 (patch)
tree7efbef4b4e045bcee8833f7fc22a639fa0ff06aa /library/cpp/protobuf/util
parent56c39b3cf908e7202b1f7551a1653681e8015607 (diff)
downloadydb-243edeedfd2c5152b5c7812e0af471e1bb0232e8.tar.gz
Restoring authorship annotation for <gotmanov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/util')
-rw-r--r--library/cpp/protobuf/util/is_equal.cpp6
-rw-r--r--library/cpp/protobuf/util/is_equal.h6
-rw-r--r--library/cpp/protobuf/util/is_equal_ut.cpp84
-rw-r--r--library/cpp/protobuf/util/traits.h14
4 files changed, 55 insertions, 55 deletions
diff --git a/library/cpp/protobuf/util/is_equal.cpp b/library/cpp/protobuf/util/is_equal.cpp
index 227408006e..0cc14774e3 100644
--- a/library/cpp/protobuf/util/is_equal.cpp
+++ b/library/cpp/protobuf/util/is_equal.cpp
@@ -158,6 +158,6 @@ namespace NProtoBuf {
bool IsEqualFieldDefault(const Message& m1, const Message& m2, const FieldDescriptor& field) {
return IsEqualFieldImpl<true>(m1, m2, field, nullptr);
- }
-
-}
+ }
+
+}
diff --git a/library/cpp/protobuf/util/is_equal.h b/library/cpp/protobuf/util/is_equal.h
index 13c0aae63d..97de691767 100644
--- a/library/cpp/protobuf/util/is_equal.h
+++ b/library/cpp/protobuf/util/is_equal.h
@@ -5,13 +5,13 @@
namespace google {
namespace protobuf {
class Message;
- class FieldDescriptor;
+ class FieldDescriptor;
}
}
namespace NProtoBuf {
using ::google::protobuf::FieldDescriptor;
- using ::google::protobuf::Message;
+ using ::google::protobuf::Message;
}
namespace NProtoBuf {
@@ -27,7 +27,7 @@ namespace NProtoBuf {
// Non-strict version: optional field without explicit value is compared
// using its default value.
bool IsEqualDefault(const Message& m1, const Message& m2);
-
+
bool IsEqualFieldDefault(const Message& m1, const Message& m2, const FieldDescriptor& field);
}
diff --git a/library/cpp/protobuf/util/is_equal_ut.cpp b/library/cpp/protobuf/util/is_equal_ut.cpp
index 3ca4c90dd5..c370b26e8d 100644
--- a/library/cpp/protobuf/util/is_equal_ut.cpp
+++ b/library/cpp/protobuf/util/is_equal_ut.cpp
@@ -4,19 +4,19 @@
#include <library/cpp/testing/unittest/registar.h>
#include <google/protobuf/descriptor.h>
-
+
Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
- const ::google::protobuf::Descriptor* Descr = TSampleForIsEqual::descriptor();
- const ::google::protobuf::FieldDescriptor* NameDescr = Descr->field(0);
- const ::google::protobuf::FieldDescriptor* InnerDescr = Descr->field(1);
-
+ const ::google::protobuf::Descriptor* Descr = TSampleForIsEqual::descriptor();
+ const ::google::protobuf::FieldDescriptor* NameDescr = Descr->field(0);
+ const ::google::protobuf::FieldDescriptor* InnerDescr = Descr->field(1);
+
Y_UNIT_TEST(CheckDescriptors) {
- UNIT_ASSERT(Descr);
- UNIT_ASSERT(NameDescr);
- UNIT_ASSERT_VALUES_EQUAL(NameDescr->name(), "Name");
- UNIT_ASSERT_VALUES_EQUAL(InnerDescr->name(), "Inner");
- }
-
+ UNIT_ASSERT(Descr);
+ UNIT_ASSERT(NameDescr);
+ UNIT_ASSERT_VALUES_EQUAL(NameDescr->name(), "Name");
+ UNIT_ASSERT_VALUES_EQUAL(InnerDescr->name(), "Inner");
+ }
+
Y_UNIT_TEST(IsEqual1) {
TSampleForIsEqual a;
TSampleForIsEqual b;
@@ -29,8 +29,8 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
bool equal = NProtoBuf::IsEqual(a, b, &path);
UNIT_ASSERT(!equal);
UNIT_ASSERT_VALUES_EQUAL("Name", path);
-
- UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
+
+ UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
}
Y_UNIT_TEST(IsEqual2) {
@@ -45,35 +45,35 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
bool equal = NProtoBuf::IsEqual(a, b, &path);
UNIT_ASSERT(!equal);
UNIT_ASSERT_VALUES_EQUAL("Inner/Brbrbr", path);
-
- bool equalField = NProtoBuf::IsEqualField(a, b, *InnerDescr);
- UNIT_ASSERT(!equalField);
+
+ bool equalField = NProtoBuf::IsEqualField(a, b, *InnerDescr);
+ UNIT_ASSERT(!equalField);
}
Y_UNIT_TEST(IsEqual3) {
- TSampleForIsEqual a;
- TSampleForIsEqual b;
-
- a.SetName("aaa");
- a.MutableInner()->SetBrbrbr("bbb");
-
- b.SetName("aaa");
- b.MutableInner()->SetBrbrbr("bbb");
-
- TString path;
-
- UNIT_ASSERT(NProtoBuf::IsEqual(a, b));
- UNIT_ASSERT(NProtoBuf::IsEqualField(a, b, *NameDescr));
- UNIT_ASSERT(NProtoBuf::IsEqualField(a, b, *InnerDescr));
-
- b.MutableInner()->SetBrbrbr("ccc");
- UNIT_ASSERT(!NProtoBuf::IsEqual(a, b));
- UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *InnerDescr));
-
- b.SetName("ccc");
- UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
- }
-
+ TSampleForIsEqual a;
+ TSampleForIsEqual b;
+
+ a.SetName("aaa");
+ a.MutableInner()->SetBrbrbr("bbb");
+
+ b.SetName("aaa");
+ b.MutableInner()->SetBrbrbr("bbb");
+
+ TString path;
+
+ UNIT_ASSERT(NProtoBuf::IsEqual(a, b));
+ UNIT_ASSERT(NProtoBuf::IsEqualField(a, b, *NameDescr));
+ UNIT_ASSERT(NProtoBuf::IsEqualField(a, b, *InnerDescr));
+
+ b.MutableInner()->SetBrbrbr("ccc");
+ UNIT_ASSERT(!NProtoBuf::IsEqual(a, b));
+ UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *InnerDescr));
+
+ b.SetName("ccc");
+ UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
+ }
+
Y_UNIT_TEST(IsEqualDefault) {
TSampleForIsEqual a;
TSampleForIsEqual b;
@@ -81,8 +81,8 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) {
a.SetName("");
UNIT_ASSERT(NProtoBuf::IsEqualDefault(a, b));
UNIT_ASSERT(!NProtoBuf::IsEqual(a, b));
-
- UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
- UNIT_ASSERT(NProtoBuf::IsEqualFieldDefault(a, b, *NameDescr));
+
+ UNIT_ASSERT(!NProtoBuf::IsEqualField(a, b, *NameDescr));
+ UNIT_ASSERT(NProtoBuf::IsEqualFieldDefault(a, b, *NameDescr));
}
}
diff --git a/library/cpp/protobuf/util/traits.h b/library/cpp/protobuf/util/traits.h
index 50f036d0ea..e2d75e4a90 100644
--- a/library/cpp/protobuf/util/traits.h
+++ b/library/cpp/protobuf/util/traits.h
@@ -44,8 +44,8 @@ namespace NProtoBuf {
Y_ASSERT(fd); \
return fd->default_value_##method(); \
} \
- };
-
+ };
+
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_INT32, int32);
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_INT64, int64);
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_UINT32, uint32);
@@ -55,9 +55,9 @@ namespace NProtoBuf {
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_BOOL, bool);
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_ENUM, enum);
DECLARE_CPPTYPE_DEFAULT(FieldDescriptor::CppType::CPPTYPE_STRING, string);
-
-#undef DECLARE_CPPTYPE_DEFAULT
-
+
+#undef DECLARE_CPPTYPE_DEFAULT
+
// getters/setters of field with specified CppType
template <FieldDescriptor::CppType cpptype>
struct TCppTypeTraits : TCppTypeTraitsBase {
@@ -190,7 +190,7 @@ namespace NProtoBuf {
Y_ASSERT(index == 0);
TBaseTraits::Set(msg, field, value);
}
-
+
static inline void Add(Message& msg, const FieldDescriptor* field, T value) {
TBaseTraits::Set(msg, field, value);
}
@@ -220,7 +220,7 @@ namespace NProtoBuf {
static inline void Set(Message& msg, const FieldDescriptor* field, T value, size_t index = 0) {
TBaseTraits::SetRepeated(msg, field, index, value);
}
-
+
static inline void Add(Message& msg, const FieldDescriptor* field, T value) {
TBaseTraits::AddRepeated(msg, field, value);
}