diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/protobuf/json | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/json')
-rw-r--r-- | library/cpp/protobuf/json/json2proto.cpp | 12 | ||||
-rw-r--r-- | library/cpp/protobuf/json/json_output_create.h | 2 | ||||
-rw-r--r-- | library/cpp/protobuf/json/proto2json.h | 2 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/filter_ut.cpp | 6 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/inline_ut.cpp | 14 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/json2proto_ut.cpp | 70 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/proto2json_ut.cpp | 46 | ||||
-rw-r--r-- | library/cpp/protobuf/json/ut/string_transform_ut.cpp | 22 |
8 files changed, 87 insertions, 87 deletions
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 640c10f5a5..b70c39d3b5 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -72,7 +72,7 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field, NProtobufJson::ToSnakeCaseDense(&name); break; default: - Y_VERIFY_DEBUG(false, "Unknown FieldNameMode."); + Y_VERIFY_DEBUG(false, "Unknown FieldNameMode."); } return name; } @@ -85,7 +85,7 @@ JsonString2Field(const NJson::TJsonValue& json, using namespace google::protobuf; const Reflection* reflection = proto.GetReflection(); - Y_ASSERT(!!reflection); + Y_ASSERT(!!reflection); if (!json.IsString() && !config.CastRobust) { ythrow yexception() << "Invalid type of JSON field '" << field.name() << "': " @@ -94,7 +94,7 @@ JsonString2Field(const NJson::TJsonValue& json, } TString value = json.GetStringRobust(); for (size_t i = 0, endI = config.StringTransforms.size(); i < endI; ++i) { - Y_ASSERT(!!config.StringTransforms[i]); + Y_ASSERT(!!config.StringTransforms[i]); if (!!config.StringTransforms[i]) { if (field.type() == google::protobuf::FieldDescriptor::TYPE_BYTES) { config.StringTransforms[i]->TransformBytes(value); @@ -130,10 +130,10 @@ JsonEnum2Field(const NJson::TJsonValue& json, using namespace google::protobuf; const Reflection* reflection = proto.GetReflection(); - Y_ASSERT(!!reflection); + Y_ASSERT(!!reflection); const EnumDescriptor* enumField = field.enum_type(); - Y_ASSERT(!!enumField); + Y_ASSERT(!!enumField); /// @todo configure name/numerical value const EnumValueDescriptor* enumFieldValue = nullptr; @@ -343,7 +343,7 @@ Json2RepeatedField(const NJson::TJsonValue& json, } const Reflection* reflection = proto.GetReflection(); - Y_ASSERT(!!reflection); + Y_ASSERT(!!reflection); if (isMap) { const THashMap<TString, NJson::TJsonValue> jsonMap = fieldJson.GetMap(); diff --git a/library/cpp/protobuf/json/json_output_create.h b/library/cpp/protobuf/json/json_output_create.h index ad3889f5e9..42005bad28 100644 --- a/library/cpp/protobuf/json/json_output_create.h +++ b/library/cpp/protobuf/json/json_output_create.h @@ -9,7 +9,7 @@ namespace NJson { struct TJsonWriterConfig; } -class IOutputStream; +class IOutputStream; class TStringStream; namespace NProtobufJson { diff --git a/library/cpp/protobuf/json/proto2json.h b/library/cpp/protobuf/json/proto2json.h index 89a1781a40..2f7277be08 100644 --- a/library/cpp/protobuf/json/proto2json.h +++ b/library/cpp/protobuf/json/proto2json.h @@ -19,7 +19,7 @@ namespace NJson { class TJsonWriter; } -class IOutputStream; +class IOutputStream; class TStringStream; namespace NProtobufJson { diff --git a/library/cpp/protobuf/json/ut/filter_ut.cpp b/library/cpp/protobuf/json/ut/filter_ut.cpp index 95c227666f..daa2d98af4 100644 --- a/library/cpp/protobuf/json/ut/filter_ut.cpp +++ b/library/cpp/protobuf/json/ut/filter_ut.cpp @@ -19,8 +19,8 @@ static NProtobufJsonUt::TFilterTest GetTestMsg() { return msg; } -Y_UNIT_TEST_SUITE(TProto2JsonFilterTest){ - Y_UNIT_TEST(TestFilterPrinter){ +Y_UNIT_TEST_SUITE(TProto2JsonFilterTest){ + Y_UNIT_TEST(TestFilterPrinter){ NProtobufJsonUt::TFilterTest msg = GetTestMsg(); { TString expected = R"({"OptFiltered":"1","NotFiltered":"23","RepFiltered":[45,67],)" @@ -61,7 +61,7 @@ Y_UNIT_TEST_SUITE(TProto2JsonFilterTest){ } } -Y_UNIT_TEST(NoUnnecessaryCopyFunctor) { +Y_UNIT_TEST(NoUnnecessaryCopyFunctor) { size_t CopyCount = 0; struct TFunctorMock { TFunctorMock(size_t* copyCount) diff --git a/library/cpp/protobuf/json/ut/inline_ut.cpp b/library/cpp/protobuf/json/ut/inline_ut.cpp index c29ad32e7d..548b6c2960 100644 --- a/library/cpp/protobuf/json/ut/inline_ut.cpp +++ b/library/cpp/protobuf/json/ut/inline_ut.cpp @@ -21,8 +21,8 @@ static NProtobufJsonUt::TInlineTest GetTestMsg() { return msg; } -Y_UNIT_TEST_SUITE(TProto2JsonInlineTest){ - Y_UNIT_TEST(TestNormalPrint){ +Y_UNIT_TEST_SUITE(TProto2JsonInlineTest){ + Y_UNIT_TEST(TestNormalPrint){ NProtobufJsonUt::TInlineTest msg = GetTestMsg(); // normal print should output these fields as just string values TString expRaw = R"({"OptJson":"{\"a\":1,\"b\":\"000\"}","NotJson":"12{}34","RepJson":["{}","[1,2]"],)" @@ -35,7 +35,7 @@ myRaw = PrintInlined(msg, [](const NProtoBuf::Message&, const NProtoBuf::FieldDe UNIT_ASSERT_STRINGS_EQUAL(myRaw, expRaw); // result is the same } -Y_UNIT_TEST(TestInliningPrinter) { +Y_UNIT_TEST(TestInliningPrinter) { NProtobufJsonUt::TInlineTest msg = GetTestMsg(); // inlined print should output these fields as inlined json sub-objects TString expInlined = R"({"OptJson":{"a":1,"b":"000"},"NotJson":"12{}34","RepJson":[{},[1,2]],)" @@ -54,7 +54,7 @@ Y_UNIT_TEST(TestInliningPrinter) { } } -Y_UNIT_TEST(TestNoValues) { +Y_UNIT_TEST(TestNoValues) { // no values - no printing NProtobufJsonUt::TInlineTest msg; msg.MutableInner()->AddNumber(100); @@ -66,7 +66,7 @@ Y_UNIT_TEST(TestNoValues) { UNIT_ASSERT_STRINGS_EQUAL(myInlined, expInlined); } -Y_UNIT_TEST(TestMissingKeyModeNull) { +Y_UNIT_TEST(TestMissingKeyModeNull) { NProtobufJsonUt::TInlineTest msg; msg.MutableInner()->AddNumber(100); msg.MutableInner()->AddNumber(200); @@ -79,7 +79,7 @@ Y_UNIT_TEST(TestMissingKeyModeNull) { UNIT_ASSERT_STRINGS_EQUAL(myInlined, expInlined); } -Y_UNIT_TEST(TestMissingKeyModeDefault) { +Y_UNIT_TEST(TestMissingKeyModeDefault) { NProtobufJsonUt::TInlineTestDefaultValues msg; TString expInlined = R"({"OptJson":{"default":1},"Number":0,"RepJson":[],"Inner":{"OptJson":{"default":2}}})"; @@ -90,7 +90,7 @@ Y_UNIT_TEST(TestMissingKeyModeDefault) { UNIT_ASSERT_STRINGS_EQUAL(myInlined, expInlined); } -Y_UNIT_TEST(NoUnnecessaryCopyFunctor) { +Y_UNIT_TEST(NoUnnecessaryCopyFunctor) { size_t CopyCount = 0; struct TFunctorMock { TFunctorMock(size_t* copyCount) diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a..271db47dc4 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -70,8 +70,8 @@ namespace { } } -Y_UNIT_TEST_SUITE(TJson2ProtoTest) { - Y_UNIT_TEST(TestFlatOptional){ +Y_UNIT_TEST_SUITE(TJson2ProtoTest) { + Y_UNIT_TEST(TestFlatOptional){ {const NJson::TJsonValue& json = CreateFlatJson(); TFlatOptional proto; Json2Proto(json, proto); @@ -96,7 +96,7 @@ Y_UNIT_TEST_SUITE(TJson2ProtoTest) { #undef DEFINE_FIELD } // TestFlatOptional -Y_UNIT_TEST(TestFlatRequired){ +Y_UNIT_TEST(TestFlatRequired){ {const NJson::TJsonValue& json = CreateFlatJson(); TFlatRequired proto; Json2Proto(json, proto); @@ -118,7 +118,7 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); #undef DEFINE_FIELD } // TestFlatRequired -Y_UNIT_TEST(TestNameGenerator) { +Y_UNIT_TEST(TestNameGenerator) { TJson2ProtoConfig cfg; cfg.SetNameGenerator([](const NProtoBuf::FieldDescriptor&) { return "42"; }); @@ -131,7 +131,7 @@ Y_UNIT_TEST(TestNameGenerator) { UNIT_ASSERT_PROTOS_EQUAL(expected, proto); } -Y_UNIT_TEST(TestFlatNoCheckRequired) { +Y_UNIT_TEST(TestFlatNoCheckRequired) { { const NJson::TJsonValue& json = CreateFlatJson(); TFlatRequired proto; @@ -157,7 +157,7 @@ Y_UNIT_TEST(TestFlatNoCheckRequired) { #undef DEFINE_FIELD } // TestFlatNoCheckRequired -Y_UNIT_TEST(TestFlatRepeated){ +Y_UNIT_TEST(TestFlatRepeated){ {const NJson::TJsonValue& json = CreateRepeatedFlatJson(); TFlatRepeated proto; Json2Proto(json, proto); @@ -182,7 +182,7 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); #undef DEFINE_REPEATED_FIELD } // TestFlatRepeated -Y_UNIT_TEST(TestCompositeOptional){ +Y_UNIT_TEST(TestCompositeOptional){ {const NJson::TJsonValue& json = CreateCompositeJson(); TCompositeOptional proto; Json2Proto(json, proto); @@ -207,7 +207,7 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); #undef DEFINE_FIELD } // TestCompositeOptional -Y_UNIT_TEST(TestCompositeOptionalStringBuf){ +Y_UNIT_TEST(TestCompositeOptionalStringBuf){ {NJson::TJsonValue json = CreateCompositeJson(); json["Part"]["Double"] = 42.5; TCompositeOptional proto; @@ -240,7 +240,7 @@ UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); #undef DEFINE_FIELD } // TestCompositeOptionalStringBuf -Y_UNIT_TEST(TestCompositeRequired) { +Y_UNIT_TEST(TestCompositeRequired) { { const NJson::TJsonValue& json = CreateCompositeJson(); TCompositeRequired proto; @@ -257,7 +257,7 @@ Y_UNIT_TEST(TestCompositeRequired) { } } // TestCompositeRequired -Y_UNIT_TEST(TestCompositeRepeated) { +Y_UNIT_TEST(TestCompositeRepeated) { { NJson::TJsonValue json; NJson::TJsonValue array; @@ -302,7 +302,7 @@ Y_UNIT_TEST(TestCompositeRepeated) { } } // TestCompositeRepeated -Y_UNIT_TEST(TestInvalidEnum) { +Y_UNIT_TEST(TestInvalidEnum) { { NJson::TJsonValue json; json.InsertValue("Enum", "E_100"); @@ -318,7 +318,7 @@ Y_UNIT_TEST(TestInvalidEnum) { } } -Y_UNIT_TEST(TestFieldNameMode) { +Y_UNIT_TEST(TestFieldNameMode) { // Original case 1 { TString modelStr(R"_({"String":"value"})_"); @@ -514,7 +514,7 @@ public: } }; -Y_UNIT_TEST(TestInvalidJson) { +Y_UNIT_TEST(TestInvalidJson) { NJson::TJsonValue val{"bad value"}; TFlatOptional proto; UNIT_ASSERT_EXCEPTION(Json2Proto(val, proto), yexception); @@ -527,7 +527,7 @@ Y_UNIT_TEST(TestInvalidRepeatedFieldWithMapAsObject) { UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception); } -Y_UNIT_TEST(TestStringTransforms) { +Y_UNIT_TEST(TestStringTransforms) { // Check that strings and bytes are transformed { TString modelStr(R"_({"String":"value_str", "Bytes": "value_bytes"})_"); @@ -585,7 +585,7 @@ Y_UNIT_TEST(TestStringTransforms) { } } // TestStringTransforms -Y_UNIT_TEST(TestCastFromString) { +Y_UNIT_TEST(TestCastFromString) { // single fields { NJson::TJsonValue json; @@ -634,7 +634,7 @@ Y_UNIT_TEST(TestCastFromString) { } } // TestCastFromString -Y_UNIT_TEST(TestMap) { +Y_UNIT_TEST(TestMap) { TMapType modelProto; auto& items = *modelProto.MutableItems(); @@ -651,7 +651,7 @@ Y_UNIT_TEST(TestMap) { UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); } // TestMap -Y_UNIT_TEST(TestCastRobust) { +Y_UNIT_TEST(TestCastRobust) { NJson::TJsonValue json; json["I32"] = "5"; json["Bool"] = 1; @@ -741,7 +741,7 @@ Y_UNIT_TEST(TestValueVectorizer) { } } -Y_UNIT_TEST(TestMapAsObject) { +Y_UNIT_TEST(TestMapAsObject) { TMapType modelProto; auto& items = *modelProto.MutableItems(); @@ -759,7 +759,7 @@ Y_UNIT_TEST(TestMapAsObject) { UNIT_ASSERT_PROTOS_EQUAL(proto, modelProto); } // TestMapAsObject -Y_UNIT_TEST(TestComplexMapAsObject_I32) { +Y_UNIT_TEST(TestComplexMapAsObject_I32) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableI32(); @@ -770,7 +770,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_I32) { R"_({"I32":{"1":1,"-2":-2,"3":3}})_"); } // TestComplexMapAsObject_I32 -Y_UNIT_TEST(TestComplexMapAsObject_I64) { +Y_UNIT_TEST(TestComplexMapAsObject_I64) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableI64(); @@ -781,7 +781,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_I64) { R"_({"I64":{"2147483649":2147483649,"-2147483650":-2147483650,"2147483651":2147483651}})_"); } // TestComplexMapAsObject_I64 -Y_UNIT_TEST(TestComplexMapAsObject_UI32) { +Y_UNIT_TEST(TestComplexMapAsObject_UI32) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableUI32(); @@ -792,7 +792,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_UI32) { R"_({"UI32":{"1073741825":1073741825,"1073741826":1073741826,"1073741827":1073741827}})_"); } // TestComplexMapAsObject_UI32 -Y_UNIT_TEST(TestComplexMapAsObject_UI64) { +Y_UNIT_TEST(TestComplexMapAsObject_UI64) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableUI64(); @@ -803,7 +803,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_UI64) { R"_({"UI64":{"9223372036854775809":9223372036854775809,"9223372036854775810":9223372036854775810,"9223372036854775811":9223372036854775811}})_"); } // TestComplexMapAsObject_UI64 -Y_UNIT_TEST(TestComplexMapAsObject_SI32) { +Y_UNIT_TEST(TestComplexMapAsObject_SI32) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableSI32(); @@ -814,7 +814,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_SI32) { R"_({"SI32":{"1":1,"-2":-2,"3":3}})_"); } // TestComplexMapAsObject_SI32 -Y_UNIT_TEST(TestComplexMapAsObject_SI64) { +Y_UNIT_TEST(TestComplexMapAsObject_SI64) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableSI64(); @@ -825,7 +825,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_SI64) { R"_({"SI64":{"2147483649":2147483649,"-2147483650":-2147483650,"2147483651":2147483651}})_"); } // TestComplexMapAsObject_SI64 -Y_UNIT_TEST(TestComplexMapAsObject_FI32) { +Y_UNIT_TEST(TestComplexMapAsObject_FI32) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableFI32(); @@ -836,7 +836,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_FI32) { R"_({"FI32":{"1073741825":1073741825,"1073741826":1073741826,"1073741827":1073741827}})_"); } // TestComplexMapAsObject_FI32 -Y_UNIT_TEST(TestComplexMapAsObject_FI64) { +Y_UNIT_TEST(TestComplexMapAsObject_FI64) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableFI64(); @@ -847,7 +847,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_FI64) { R"_({"FI64":{"9223372036854775809":9223372036854775809,"9223372036854775810":9223372036854775810,"9223372036854775811":9223372036854775811}})_"); } // TestComplexMapAsObject_FI64 -Y_UNIT_TEST(TestComplexMapAsObject_SFI32) { +Y_UNIT_TEST(TestComplexMapAsObject_SFI32) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableSFI32(); @@ -858,7 +858,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_SFI32) { R"_({"SFI32":{"1":1,"-2":-2,"3":3}})_"); } // TestComplexMapAsObject_SFI32 -Y_UNIT_TEST(TestComplexMapAsObject_SFI64) { +Y_UNIT_TEST(TestComplexMapAsObject_SFI64) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableSFI64(); @@ -869,7 +869,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_SFI64) { R"_({"SFI64":{"2147483649":2147483649,"-2147483650":-2147483650,"2147483651":2147483651}})_"); } // TestComplexMapAsObject_SFI64 -Y_UNIT_TEST(TestComplexMapAsObject_Bool) { +Y_UNIT_TEST(TestComplexMapAsObject_Bool) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableBool(); @@ -879,7 +879,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_Bool) { R"_({"Bool":{"true":true,"false":false}})_"); } // TestComplexMapAsObject_Bool -Y_UNIT_TEST(TestComplexMapAsObject_String) { +Y_UNIT_TEST(TestComplexMapAsObject_String) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableString(); @@ -891,7 +891,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_String) { R"_({"String":{"key1":"value1","key2":"value2","key3":"value3","":"value4"}})_"); } // TestComplexMapAsObject_String -Y_UNIT_TEST(TestComplexMapAsObject_Enum) { +Y_UNIT_TEST(TestComplexMapAsObject_Enum) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableEnum(); @@ -943,7 +943,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_EnumStringSnakeCaseInsensitive) { ); } // TestComplexMapAsObject_EnumStringCaseInsensetive -Y_UNIT_TEST(TestComplexMapAsObject_Float) { +Y_UNIT_TEST(TestComplexMapAsObject_Float) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableFloat(); @@ -954,7 +954,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_Float) { R"_({"Float":{"key1":0.1,"key2":0.2,"key3":0.3}})_"); } // TestComplexMapAsObject_Float -Y_UNIT_TEST(TestComplexMapAsObject_Double) { +Y_UNIT_TEST(TestComplexMapAsObject_Double) { TestComplexMapAsObject( [](TComplexMapType& proto) { auto& items = *proto.MutableDouble(); @@ -965,7 +965,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_Double) { R"_({"Double":{"key1":0.1,"key2":0.2,"key3":0.3}})_"); } // TestComplexMapAsObject_Double -Y_UNIT_TEST(TestComplexMapAsObject_Nested) { +Y_UNIT_TEST(TestComplexMapAsObject_Nested) { TestComplexMapAsObject( [](TComplexMapType& proto) { TComplexMapType inner; @@ -979,7 +979,7 @@ Y_UNIT_TEST(TestComplexMapAsObject_Nested) { R"_({"Nested":{"key1":{"String":{"key":"value"}},"key2":{"String":{"key":"value"}},"key3":{"String":{"key":"value"}}}})_"); } // TestComplexMapAsObject_Nested -Y_UNIT_TEST(TestMapAsObjectConfigNotSet) { +Y_UNIT_TEST(TestMapAsObjectConfigNotSet) { TString modelStr(R"_({"Items":{"key":"value"}})_"); TJson2ProtoConfig config; diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp index 07e52d7f2f..0a56cc2a8c 100644 --- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp +++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp @@ -25,8 +25,8 @@ using namespace NProtobufJson; using namespace NProtobufJsonTest; -Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { - Y_UNIT_TEST(TestFlatDefault) { +Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { + Y_UNIT_TEST(TestFlatDefault) { using namespace ::google::protobuf; TFlatDefault proto; NJson::TJsonValue json; @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { #undef DEFINE_FIELD } - Y_UNIT_TEST(TestNameGenerator) { + Y_UNIT_TEST(TestNameGenerator) { TNameGeneratorType proto; proto.SetField(42); @@ -87,7 +87,7 @@ Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { UNIT_ASSERT_STRINGS_EQUAL(R"({"42":42})", str.Str()); } - Y_UNIT_TEST(TestEnumValueGenerator) { + Y_UNIT_TEST(TestEnumValueGenerator) { TEnumValueGeneratorType proto; proto.SetEnum(TEnumValueGeneratorType::ENUM_42); @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { UNIT_ASSERT_STRINGS_EQUAL(R"({"Enum":"42"})", str.Str()); } - Y_UNIT_TEST(TestFlatOptional){ + Y_UNIT_TEST(TestFlatOptional){ {TFlatOptional proto; FillFlatProto(&proto); const NJson::TJsonValue& modelJson = CreateFlatJson(); @@ -141,7 +141,7 @@ Y_UNIT_TEST_SUITE(TProto2JsonFlatTest) { #undef DEFINE_FIELD } // TestFlatOptional -Y_UNIT_TEST(TestFlatRequired){ +Y_UNIT_TEST(TestFlatRequired){ {TFlatRequired proto; FillFlatProto(&proto); const NJson::TJsonValue& modelJson = CreateFlatJson(); @@ -182,7 +182,7 @@ const NJson::TJsonValue& modelJson = CreateFlatJson(); #undef DEFINE_FIELD } // TestFlatRequired -Y_UNIT_TEST(TestFlatRepeated) { +Y_UNIT_TEST(TestFlatRepeated) { { TFlatRepeated proto; FillRepeatedProto(&proto); @@ -227,7 +227,7 @@ Y_UNIT_TEST(TestFlatRepeated) { #undef DEFINE_REPEATED_FIELD } // TestFlatRepeated -Y_UNIT_TEST(TestCompositeOptional){ +Y_UNIT_TEST(TestCompositeOptional){ {TCompositeOptional proto; FillCompositeProto(&proto); const NJson::TJsonValue& modelJson = CreateCompositeJson(); @@ -268,7 +268,7 @@ const NJson::TJsonValue& modelJson = CreateCompositeJson(); #undef DEFINE_FIELD } // TestCompositeOptional -Y_UNIT_TEST(TestCompositeRequired){ +Y_UNIT_TEST(TestCompositeRequired){ {TCompositeRequired proto; FillCompositeProto(&proto); const NJson::TJsonValue& modelJson = CreateCompositeJson(); @@ -309,7 +309,7 @@ const NJson::TJsonValue& modelJson = CreateCompositeJson(); #undef DEFINE_FIELD } // TestCompositeRequired -Y_UNIT_TEST(TestCompositeRepeated) { +Y_UNIT_TEST(TestCompositeRepeated) { { TFlatOptional partProto; FillFlatProto(&partProto); @@ -371,7 +371,7 @@ Y_UNIT_TEST(TestCompositeRepeated) { } } // TestCompositeRepeated -Y_UNIT_TEST(TestEnumConfig) { +Y_UNIT_TEST(TestEnumConfig) { { TFlatOptional proto; proto.SetEnum(E_1); @@ -438,7 +438,7 @@ Y_UNIT_TEST(TestEnumConfig) { } } // TestEnumConfig -Y_UNIT_TEST(TestMissingSingleKeyConfig) { +Y_UNIT_TEST(TestMissingSingleKeyConfig) { { TFlatOptional proto; NJson::TJsonValue modelJson(NJson::JSON_MAP); @@ -513,7 +513,7 @@ Y_UNIT_TEST(TestMissingSingleKeyConfig) { } } // TestMissingSingleKeyConfig -Y_UNIT_TEST(TestMissingRepeatedKeyNoConfig) { +Y_UNIT_TEST(TestMissingRepeatedKeyNoConfig) { { TFlatRepeated proto; NJson::TJsonValue modelJson(NJson::JSON_MAP); @@ -524,7 +524,7 @@ Y_UNIT_TEST(TestMissingRepeatedKeyNoConfig) { } } // TestMissingRepeatedKeyNoConfig -Y_UNIT_TEST(TestMissingRepeatedKeyConfig) { +Y_UNIT_TEST(TestMissingRepeatedKeyConfig) { { TFlatRepeated proto; NJson::TJsonValue modelJson(NJson::JSON_MAP); @@ -564,7 +564,7 @@ Y_UNIT_TEST(TestMissingRepeatedKeyConfig) { } } // TestMissingRepeatedKeyConfig -Y_UNIT_TEST(TestEscaping) { +Y_UNIT_TEST(TestEscaping) { // No escape { TString modelStr(R"_({"String":"value\""})_"); @@ -632,7 +632,7 @@ public: } }; -Y_UNIT_TEST(TestBytesTransform) { +Y_UNIT_TEST(TestBytesTransform) { // Test that string field is not changed { TString modelStr(R"_({"String":"value"})_"); @@ -662,7 +662,7 @@ Y_UNIT_TEST(TestBytesTransform) { } } -Y_UNIT_TEST(TestFieldNameMode) { +Y_UNIT_TEST(TestFieldNameMode) { // Original case 1 { TString modelStr(R"_({"String":"value"})_"); @@ -888,21 +888,21 @@ Y_UNIT_TEST(TestFieldNameMode) { /// TODO: test missing keys } // TestFieldNameMode -Y_UNIT_TEST(TestNan) { +Y_UNIT_TEST(TestNan) { TFlatOptional proto; proto.SetDouble(std::numeric_limits<double>::quiet_NaN()); UNIT_ASSERT_EXCEPTION(Proto2Json(proto, TProto2JsonConfig()), yexception); } // TestNan -Y_UNIT_TEST(TestInf) { +Y_UNIT_TEST(TestInf) { TFlatOptional proto; proto.SetFloat(std::numeric_limits<float>::infinity()); UNIT_ASSERT_EXCEPTION(Proto2Json(proto, TProto2JsonConfig()), yexception); } // TestInf -Y_UNIT_TEST(TestMap) { +Y_UNIT_TEST(TestMap) { TMapType proto; auto& items = *proto.MutableItems(); @@ -931,7 +931,7 @@ Y_UNIT_TEST(TestMap) { UNIT_ASSERT_EQUAL(jsonItems, modelItems); } // TestMap -Y_UNIT_TEST(TestMapAsObject) { +Y_UNIT_TEST(TestMapAsObject) { TMapType proto; auto& items = *proto.MutableItems(); @@ -949,7 +949,7 @@ Y_UNIT_TEST(TestMapAsObject) { UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr); } // TestMapAsObject -Y_UNIT_TEST(TestMapWTF) { +Y_UNIT_TEST(TestMapWTF) { TMapType proto; auto& items = *proto.MutableItems(); @@ -965,7 +965,7 @@ Y_UNIT_TEST(TestMapWTF) { UNIT_ASSERT_JSON_STRINGS_EQUAL(jsonStr.Str(), modelStr); } // TestMapWTF -Y_UNIT_TEST(TestStringifyLongNumbers) { +Y_UNIT_TEST(TestStringifyLongNumbers) { #define TEST_SINGLE(flag, value, expectString) \ do { \ TFlatOptional proto; \ diff --git a/library/cpp/protobuf/json/ut/string_transform_ut.cpp b/library/cpp/protobuf/json/ut/string_transform_ut.cpp index a31dabcb0f..7b0595e6cb 100644 --- a/library/cpp/protobuf/json/ut/string_transform_ut.cpp +++ b/library/cpp/protobuf/json/ut/string_transform_ut.cpp @@ -3,8 +3,8 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/protobuf/json/proto2json.h> -Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { - Y_UNIT_TEST(TestEmptyString) { +Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { + Y_UNIT_TEST(TestEmptyString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); TString s; s = ""; @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { UNIT_ASSERT_EQUAL(s, ""); } - Y_UNIT_TEST(TestAlphabeticString) { + Y_UNIT_TEST(TestAlphabeticString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); TString s; s = "abacaba"; @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { UNIT_ASSERT_EQUAL(s, "abacaba"); } - Y_UNIT_TEST(TestRussianSymbols) { + Y_UNIT_TEST(TestRussianSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); TString s; s = "тест"; @@ -28,7 +28,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { UNIT_ASSERT_EQUAL(s, "\\\\321\\\\202\\\\320\\\\265\\\\321\\\\201\\\\321\\\\202"); } - Y_UNIT_TEST(TestEscapeSpecialSymbols) { + Y_UNIT_TEST(TestEscapeSpecialSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); TString s; s = "aba\\ca\"ba"; @@ -38,8 +38,8 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { } } -Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { - Y_UNIT_TEST(TestEmptyString) { +Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { + Y_UNIT_TEST(TestEmptyString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); TString s; s = ""; @@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { UNIT_ASSERT_EQUAL("", s); } - Y_UNIT_TEST(TestAlphabeticString) { + Y_UNIT_TEST(TestAlphabeticString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); TString s; s = "abacaba"; @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { UNIT_ASSERT_EQUAL("abacaba", s); } - Y_UNIT_TEST(TestRussianSymbols) { + Y_UNIT_TEST(TestRussianSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); TString s; s = "\\\\321\\\\202\\\\320\\\\265\\\\321\\\\201\\\\321\\\\202"; @@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { UNIT_ASSERT_EQUAL("тест", s); } - Y_UNIT_TEST(TestEscapeSpecialSymbols) { + Y_UNIT_TEST(TestEscapeSpecialSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); TString s; s = "aba\\\\\\\\ca\\\\\\\"ba"; @@ -72,7 +72,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { UNIT_ASSERT_EQUAL("aba\\ca\"ba", s); } - Y_UNIT_TEST(TestEscapeSpecialSymbolsDifficultCases) { + Y_UNIT_TEST(TestEscapeSpecialSymbolsDifficultCases) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); TString s; s = "\\\\\\\\\\\\\\\\"; |