aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/json/ut/json2proto_ut.cpp
diff options
context:
space:
mode:
authorArslan Urtashev <urtashev@gmail.com>2022-02-10 16:48:55 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:55 +0300
commit1136f2ce7cce7bcc84e695272c0d92d4eb900c2b (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/json/ut/json2proto_ut.cpp
parentb97740540e7302cec9efa181e106ae1990a0cc1c (diff)
downloadydb-1136f2ce7cce7bcc84e695272c0d92d4eb900c2b.tar.gz
Restoring authorship annotation for Arslan Urtashev <urtashev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/ut/json2proto_ut.cpp')
-rw-r--r--library/cpp/protobuf/json/ut/json2proto_ut.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
index 42a8ddf2c3..0dfe57bc7a 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();