diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/protobuf/json/ut/proto.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/ut/proto.h')
-rw-r--r-- | library/cpp/protobuf/json/ut/proto.h | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/library/cpp/protobuf/json/ut/proto.h b/library/cpp/protobuf/json/ut/proto.h index 8183bfc8e1..b9dec411bd 100644 --- a/library/cpp/protobuf/json/ut/proto.h +++ b/library/cpp/protobuf/json/ut/proto.h @@ -6,57 +6,57 @@ #include <util/system/defaults.h> namespace NProtobufJsonTest { - template <typename TProto> - inline void - FillFlatProto(TProto* proto, - const THashSet<TString>& skippedFields = THashSet<TString>()) { -#define DEFINE_FIELD(name, value) \ - if (skippedFields.find(#name) == skippedFields.end()) \ - proto->Set##name(value); + template <typename TProto> + inline void + FillFlatProto(TProto* proto, + const THashSet<TString>& skippedFields = THashSet<TString>()) { +#define DEFINE_FIELD(name, value) \ + if (skippedFields.find(#name) == skippedFields.end()) \ + proto->Set##name(value); #include <library/cpp/protobuf/json/ut/fields.incl> #undef DEFINE_FIELD - } - - template <typename TRepeatedField, typename TValue> - inline void - AddValue(TRepeatedField* field, TValue value) { - field->Add(value); - } - - inline void - AddValue(google::protobuf::RepeatedPtrField<TString>* field, const TString& value) { - *(field->Add()) = value; - } - - inline void - FillRepeatedProto(TFlatRepeated* proto, - const THashSet<TString>& skippedFields = THashSet<TString>()) { -#define DEFINE_REPEATED_FIELD(name, type, ...) \ - if (skippedFields.find(#name) == skippedFields.end()) { \ - type values[] = {__VA_ARGS__}; \ - for (size_t i = 0, end = Y_ARRAY_SIZE(values); i < end; ++i) { \ - AddValue(proto->Mutable##name(), values[i]); \ - } \ + } + + template <typename TRepeatedField, typename TValue> + inline void + AddValue(TRepeatedField* field, TValue value) { + field->Add(value); + } + + inline void + AddValue(google::protobuf::RepeatedPtrField<TString>* field, const TString& value) { + *(field->Add()) = value; + } + + inline void + FillRepeatedProto(TFlatRepeated* proto, + const THashSet<TString>& skippedFields = THashSet<TString>()) { +#define DEFINE_REPEATED_FIELD(name, type, ...) \ + if (skippedFields.find(#name) == skippedFields.end()) { \ + type values[] = {__VA_ARGS__}; \ + for (size_t i = 0, end = Y_ARRAY_SIZE(values); i < end; ++i) { \ + AddValue(proto->Mutable##name(), values[i]); \ + } \ } #include <library/cpp/protobuf/json/ut/repeated_fields.incl> #undef DEFINE_REPEATED_FIELD - } - - template <typename TProto> - inline void - FillCompositeProto(TProto* proto, const THashSet<TString>& skippedFields = THashSet<TString>()) { - FillFlatProto(proto->MutablePart(), skippedFields); - } - -#define UNIT_ASSERT_PROTOS_EQUAL(lhs, rhs) \ - do { \ - if (lhs.SerializeAsString() != rhs.SerializeAsString()) { \ - Cerr << ">>>>>>>>>> lhs != rhs:" << Endl; \ - Cerr << lhs.DebugString() << Endl; \ - Cerr << rhs.DebugString() << Endl; \ - UNIT_ASSERT_STRINGS_EQUAL(lhs.DebugString(), rhs.DebugString()); \ + } + + template <typename TProto> + inline void + FillCompositeProto(TProto* proto, const THashSet<TString>& skippedFields = THashSet<TString>()) { + FillFlatProto(proto->MutablePart(), skippedFields); + } + +#define UNIT_ASSERT_PROTOS_EQUAL(lhs, rhs) \ + do { \ + if (lhs.SerializeAsString() != rhs.SerializeAsString()) { \ + Cerr << ">>>>>>>>>> lhs != rhs:" << Endl; \ + Cerr << lhs.DebugString() << Endl; \ + Cerr << rhs.DebugString() << Endl; \ + UNIT_ASSERT_STRINGS_EQUAL(lhs.DebugString(), rhs.DebugString()); \ UNIT_ASSERT_STRINGS_EQUAL(lhs.SerializeAsString(), rhs.SerializeAsString()); \ - } \ + } \ } while (false); -} +} |