diff options
| author | Arslan Urtashev <[email protected]> | 2022-02-10 16:48:55 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:55 +0300 | 
| commit | b97740540e7302cec9efa181e106ae1990a0cc1c (patch) | |
| tree | 1a2a0bfe523c3272d207e2d75254a41d3945a3bb /library/cpp/protobuf/json/ut | |
| parent | 31789673dc3562bc7540e00fe031ba84ae282c24 (diff) | |
Restoring authorship annotation for Arslan Urtashev <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/ut')
| -rw-r--r-- | library/cpp/protobuf/json/ut/json2proto_ut.cpp | 34 | ||||
| -rw-r--r-- | library/cpp/protobuf/json/ut/proto.h | 4 | ||||
| -rw-r--r-- | library/cpp/protobuf/json/ut/proto2json_ut.cpp | 44 | ||||
| -rw-r--r-- | library/cpp/protobuf/json/ut/test.proto | 24 | ||||
| -rw-r--r-- | library/cpp/protobuf/json/ut/ya.make | 2 | 
5 files changed, 54 insertions, 54 deletions
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a2..42a8ddf2c32 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -1,6 +1,6 @@  #include "json.h"  #include "proto.h" -#include "proto2json.h" +#include "proto2json.h"   #include <library/cpp/protobuf/json/ut/test.pb.h> @@ -50,11 +50,11 @@ namespace {      TString ConvertToString(double value) {          return FloatToString(value);      } - -    TString JsonValueToString(const NJson::TJsonValue& json) { -        NJsonWriter::TBuf buf(NJsonWriter::HEM_UNSAFE); -        return buf.WriteJsonValue(&json).Str(); -    } +  +    TString JsonValueToString(const NJson::TJsonValue& json) {  +        NJsonWriter::TBuf buf(NJsonWriter::HEM_UNSAFE);  +        return buf.WriteJsonValue(&json).Str();  +    }       void TestComplexMapAsObject(std::function<void(TComplexMapType&)>&& init, const TString& json, const TJson2ProtoConfig& config = TJson2ProtoConfig().SetMapAsObject(true)) {          TComplexMapType modelProto; @@ -121,13 +121,13 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);  Y_UNIT_TEST(TestNameGenerator) {      TJson2ProtoConfig cfg;      cfg.SetNameGenerator([](const NProtoBuf::FieldDescriptor&) { return "42"; }); - +       TNameGeneratorType proto;      Json2Proto(TStringBuf(R"({"42":42})"), proto, cfg); - +       TNameGeneratorType expected;      expected.SetField(42); - +       UNIT_ASSERT_PROTOS_EQUAL(expected, proto);  } @@ -139,11 +139,11 @@ Y_UNIT_TEST(TestFlatNoCheckRequired) {          TFlatRequired modelProto;          FillFlatProto(&modelProto);          UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); -    } - +    }  +       TJson2ProtoConfig cfg;      cfg.CheckRequiredFields = false; - +       // Try to skip each field  #define DEFINE_FIELD(name, value)                                     \      {                                                                 \ @@ -154,9 +154,9 @@ Y_UNIT_TEST(TestFlatNoCheckRequired) {          UNIT_ASSERT_NO_EXCEPTION(Json2Proto(json, proto, cfg));       \      }  #include <library/cpp/protobuf/json/ut/fields.incl> -#undef DEFINE_FIELD +#undef DEFINE_FIELD   } // TestFlatNoCheckRequired - +   Y_UNIT_TEST(TestFlatRepeated){      {const NJson::TJsonValue& json = CreateRepeatedFlatJson();  TFlatRepeated proto; @@ -217,7 +217,7 @@ FillCompositeProto(&modelProto);  modelProto.MutablePart()->SetDouble(42.5);  UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);  } - +   // Try to skip each field  #define DEFINE_FIELD(name, value)                                   \      {                                                               \ @@ -237,9 +237,9 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);          UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto);                \      }  #include <library/cpp/protobuf/json/ut/fields.incl> -#undef DEFINE_FIELD +#undef DEFINE_FIELD   } // TestCompositeOptionalStringBuf - +   Y_UNIT_TEST(TestCompositeRequired) {      {          const NJson::TJsonValue& json = CreateCompositeJson(); diff --git a/library/cpp/protobuf/json/ut/proto.h b/library/cpp/protobuf/json/ut/proto.h index 8183bfc8e18..db1e58557d1 100644 --- a/library/cpp/protobuf/json/ut/proto.h +++ b/library/cpp/protobuf/json/ut/proto.h @@ -55,8 +55,8 @@ namespace NProtobufJsonTest {              Cerr << lhs.DebugString() << Endl;                                           \              Cerr << rhs.DebugString() << Endl;                                           \              UNIT_ASSERT_STRINGS_EQUAL(lhs.DebugString(), rhs.DebugString());             \ -            UNIT_ASSERT_STRINGS_EQUAL(lhs.SerializeAsString(), rhs.SerializeAsString()); \ +            UNIT_ASSERT_STRINGS_EQUAL(lhs.SerializeAsString(), rhs.SerializeAsString()); \           }                                                                                \ -    } while (false); +    } while (false);   } diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp index 07e52d7f2f5..3e21b233712 100644 --- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp +++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp @@ -75,31 +75,31 @@ Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) {      }      Y_UNIT_TEST(TestNameGenerator) { -        TNameGeneratorType proto; -        proto.SetField(42); - -        TProto2JsonConfig cfg; +        TNameGeneratorType proto;  +        proto.SetField(42);  +  +        TProto2JsonConfig cfg;           cfg.SetNameGenerator([](const NProtoBuf::FieldDescriptor&) { return "42"; }); - -        TStringStream str; -        Proto2Json(proto, str, cfg); - -        UNIT_ASSERT_STRINGS_EQUAL(R"({"42":42})", str.Str()); -    } - +  +        TStringStream str;  +        Proto2Json(proto, str, cfg);  +  +        UNIT_ASSERT_STRINGS_EQUAL(R"({"42":42})", str.Str());  +    }  +       Y_UNIT_TEST(TestEnumValueGenerator) { -        TEnumValueGeneratorType proto; -        proto.SetEnum(TEnumValueGeneratorType::ENUM_42); - -        TProto2JsonConfig cfg; +        TEnumValueGeneratorType proto;  +        proto.SetEnum(TEnumValueGeneratorType::ENUM_42);  +  +        TProto2JsonConfig cfg;           cfg.SetEnumValueGenerator([](const NProtoBuf::EnumValueDescriptor&) { return "42"; }); - -        TStringStream str; -        Proto2Json(proto, str, cfg); - -        UNIT_ASSERT_STRINGS_EQUAL(R"({"Enum":"42"})", str.Str()); -    } - +  +        TStringStream str;  +        Proto2Json(proto, str, cfg);  +  +        UNIT_ASSERT_STRINGS_EQUAL(R"({"Enum":"42"})", str.Str());  +    }  +       Y_UNIT_TEST(TestFlatOptional){          {TFlatOptional proto;      FillFlatProto(&proto); diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto index 0fa996fd413..c8352b8c520 100644 --- a/library/cpp/protobuf/json/ut/test.proto +++ b/library/cpp/protobuf/json/ut/test.proto @@ -135,18 +135,18 @@ message TMapType {      map<string, string> Items = 1;  }; -message TNameGeneratorType { -    optional int32 Field = 1; -}; - -message TEnumValueGeneratorType { -    enum EEnum { -        ENUM_42 = 1; -    }; - -    optional EEnum Enum = 1; -}; - +message TNameGeneratorType {  +    optional int32 Field = 1;  +};  +  +message TEnumValueGeneratorType {  +    enum EEnum {  +        ENUM_42 = 1;  +    };  +  +    optional EEnum Enum = 1;  +};  +   message TComplexMapType {      map<int32, int32> I32 = 1;      map<int64, int64> I64 = 2; diff --git a/library/cpp/protobuf/json/ut/ya.make b/library/cpp/protobuf/json/ut/ya.make index b60a6d3c17f..4b8ed9c8044 100644 --- a/library/cpp/protobuf/json/ut/ya.make +++ b/library/cpp/protobuf/json/ut/ya.make @@ -1,6 +1,6 @@  UNITTEST_FOR(library/cpp/protobuf/json) -OWNER(avitella) +OWNER(avitella)   SRCS(      filter_ut.cpp  | 
