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/json/ut/json_reader_ut.cpp | |
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/json/ut/json_reader_ut.cpp')
-rw-r--r-- | library/cpp/json/ut/json_reader_ut.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp index 958ed19730..cd31afa0b8 100644 --- a/library/cpp/json/ut/json_reader_ut.cpp +++ b/library/cpp/json/ut/json_reader_ut.cpp @@ -7,12 +7,12 @@ using namespace NJson; class TReformatCallbacks: public TJsonCallbacks { - TJsonWriter& Writer; - + TJsonWriter& Writer; + public: - TReformatCallbacks(TJsonWriter& writer) - : Writer(writer) - { + TReformatCallbacks(TJsonWriter& writer) + : Writer(writer) + { } bool OnBoolean(bool val) override { @@ -30,7 +30,7 @@ public: return true; } - bool OnString(const TStringBuf& val) override { + bool OnString(const TStringBuf& val) override { Writer.Write(val); return true; } @@ -60,7 +60,7 @@ public: return true; } - bool OnMapKey(const TStringBuf& val) override { + bool OnMapKey(const TStringBuf& val) override { Writer.Write(val); return true; } @@ -145,7 +145,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { UNIT_ASSERT_VALUES_EQUAL(value["array"].GetStringRobust(), "[1,2,3,\"TString\"]"); UNIT_ASSERT_VALUES_EQUAL(value["null value"].GetStringRobust(), "null"); - const TJsonValue::TArray* array; + const TJsonValue::TArray* array; UNIT_ASSERT(GetArrayPointer(value, "array", &array)); UNIT_ASSERT_VALUES_EQUAL(value["array"].GetArray().size(), array->size()); UNIT_ASSERT_VALUES_EQUAL(value["array"][0].GetInteger(), (*array)[0].GetInteger()); @@ -353,7 +353,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { UNIT_ASSERT_EQUAL(value["test"].GetDouble(), 0.0); UNIT_ASSERT_EQUAL(value["test"].GetDoubleRobust(), static_cast<double>(Max<ui64>())); } // Max<ui64>() - } // TJsonDoubleTest + } // TJsonDoubleTest Y_UNIT_TEST(TJsonInvalidTest) { { @@ -397,34 +397,34 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { UNIT_ASSERT_VALUES_EQUAL("", v.GetMap().begin()->second.GetString()); } } - - -static const TString YANDEX_STREAMING_JSON("{\"a\":1}//d{\"b\":2}"); - - -Y_UNIT_TEST_SUITE(TCompareReadJsonFast) { - Y_UNIT_TEST(NoEndl) { - NJson::TJsonValue parsed; - - bool success = NJson::ReadJsonTree(YANDEX_STREAMING_JSON, &parsed, false); - bool fast_success = NJson::ReadJsonFastTree(YANDEX_STREAMING_JSON, &parsed, false); - UNIT_ASSERT(success == fast_success); - } - Y_UNIT_TEST(WithEndl) { - NJson::TJsonValue parsed1; - NJson::TJsonValue parsed2; - - bool success = NJson::ReadJsonTree(YANDEX_STREAMING_JSON + "\n", &parsed1, false); - bool fast_success = NJson::ReadJsonFastTree(YANDEX_STREAMING_JSON + "\n", &parsed2, false); - - UNIT_ASSERT_VALUES_EQUAL(success, fast_success); - } - Y_UNIT_TEST(NoQuotes) { - TString streamingJson = "{a:1}"; - NJson::TJsonValue parsed; - - bool success = NJson::ReadJsonTree(streamingJson, &parsed, false); - bool fast_success = NJson::ReadJsonFastTree(streamingJson, &parsed, false); - UNIT_ASSERT(success != fast_success); - } -} + + +static const TString YANDEX_STREAMING_JSON("{\"a\":1}//d{\"b\":2}"); + + +Y_UNIT_TEST_SUITE(TCompareReadJsonFast) { + Y_UNIT_TEST(NoEndl) { + NJson::TJsonValue parsed; + + bool success = NJson::ReadJsonTree(YANDEX_STREAMING_JSON, &parsed, false); + bool fast_success = NJson::ReadJsonFastTree(YANDEX_STREAMING_JSON, &parsed, false); + UNIT_ASSERT(success == fast_success); + } + Y_UNIT_TEST(WithEndl) { + NJson::TJsonValue parsed1; + NJson::TJsonValue parsed2; + + bool success = NJson::ReadJsonTree(YANDEX_STREAMING_JSON + "\n", &parsed1, false); + bool fast_success = NJson::ReadJsonFastTree(YANDEX_STREAMING_JSON + "\n", &parsed2, false); + + UNIT_ASSERT_VALUES_EQUAL(success, fast_success); + } + Y_UNIT_TEST(NoQuotes) { + TString streamingJson = "{a:1}"; + NJson::TJsonValue parsed; + + bool success = NJson::ReadJsonTree(streamingJson, &parsed, false); + bool fast_success = NJson::ReadJsonFastTree(streamingJson, &parsed, false); + UNIT_ASSERT(success != fast_success); + } +} |