diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/protobuf/json/ut/json.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/json/ut/json.h')
-rw-r--r-- | library/cpp/protobuf/json/ut/json.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/protobuf/json/ut/json.h b/library/cpp/protobuf/json/ut/json.h index bdab69f4d4..c1f108e6e4 100644 --- a/library/cpp/protobuf/json/ut/json.h +++ b/library/cpp/protobuf/json/ut/json.h @@ -12,58 +12,58 @@ #include <util/system/defaults.h> namespace NProtobufJsonTest { - inline NJson::TJsonValue - CreateFlatJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { - NJson::TJsonValue json; + inline NJson::TJsonValue + CreateFlatJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { + NJson::TJsonValue json; -#define DEFINE_FIELD(name, value) \ - if (skippedKeys.find(#name) == skippedKeys.end()) \ +#define DEFINE_FIELD(name, value) \ + if (skippedKeys.find(#name) == skippedKeys.end()) \ json.InsertValue(#name, value); #include "fields.incl" #undef DEFINE_FIELD - return json; - } - - inline NJson::TJsonValue - CreateRepeatedFlatJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { - NJson::TJsonValue json; - -#define DEFINE_REPEATED_FIELD(name, type, ...) \ - if (skippedKeys.find(#name) == skippedKeys.end()) { \ - type values[] = {__VA_ARGS__}; \ - NJson::TJsonValue array(NJson::JSON_ARRAY); \ - for (size_t i = 0, end = Y_ARRAY_SIZE(values); i < end; ++i) { \ - array.AppendValue(values[i]); \ - } \ - json.InsertValue(#name, array); \ + return json; + } + + inline NJson::TJsonValue + CreateRepeatedFlatJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { + NJson::TJsonValue json; + +#define DEFINE_REPEATED_FIELD(name, type, ...) \ + if (skippedKeys.find(#name) == skippedKeys.end()) { \ + type values[] = {__VA_ARGS__}; \ + NJson::TJsonValue array(NJson::JSON_ARRAY); \ + for (size_t i = 0, end = Y_ARRAY_SIZE(values); i < end; ++i) { \ + array.AppendValue(values[i]); \ + } \ + json.InsertValue(#name, array); \ } #include "repeated_fields.incl" #undef DEFINE_REPEATED_FIELD - return json; - } + return json; + } - inline NJson::TJsonValue - CreateCompositeJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { - const NJson::TJsonValue& part = CreateFlatJson(skippedKeys); - NJson::TJsonValue json; - json.InsertValue("Part", part); + inline NJson::TJsonValue + CreateCompositeJson(const THashSet<TString>& skippedKeys = THashSet<TString>()) { + const NJson::TJsonValue& part = CreateFlatJson(skippedKeys); + NJson::TJsonValue json; + json.InsertValue("Part", part); - return json; - } + return json; + } -#define UNIT_ASSERT_JSONS_EQUAL(lhs, rhs) \ - if (lhs != rhs) { \ +#define UNIT_ASSERT_JSONS_EQUAL(lhs, rhs) \ + if (lhs != rhs) { \ UNIT_ASSERT_STRINGS_EQUAL(lhs.GetStringRobust(), rhs.GetStringRobust()); \ } -#define UNIT_ASSERT_JSON_STRINGS_EQUAL(lhs, rhs) \ - if (lhs != rhs) { \ - NJson::TJsonValue _lhs_json, _rhs_json; \ +#define UNIT_ASSERT_JSON_STRINGS_EQUAL(lhs, rhs) \ + if (lhs != rhs) { \ + NJson::TJsonValue _lhs_json, _rhs_json; \ UNIT_ASSERT(NJson::ReadJsonTree(lhs, &_lhs_json)); \ UNIT_ASSERT(NJson::ReadJsonTree(rhs, &_rhs_json)); \ - UNIT_ASSERT_JSONS_EQUAL(_lhs_json, _rhs_json); \ + UNIT_ASSERT_JSONS_EQUAL(_lhs_json, _rhs_json); \ } -} +} |