aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/ut
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/json/ut
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/ut')
-rw-r--r--library/cpp/json/ut/json_reader_fast_ut.cpp2
-rw-r--r--library/cpp/json/ut/json_reader_ut.cpp18
-rw-r--r--library/cpp/json/ut/json_writer_ut.cpp130
3 files changed, 75 insertions, 75 deletions
diff --git a/library/cpp/json/ut/json_reader_fast_ut.cpp b/library/cpp/json/ut/json_reader_fast_ut.cpp
index 60dffc91c7..4ecd698d56 100644
--- a/library/cpp/json/ut/json_reader_fast_ut.cpp
+++ b/library/cpp/json/ut/json_reader_fast_ut.cpp
@@ -280,7 +280,7 @@ public:
}
void TestReadJsonFastTree() {
- const TString json = R"(
+ const TString json = R"(
{
"a": {
"b": {}
diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp
index cd31afa0b8..dd75332971 100644
--- a/library/cpp/json/ut/json_reader_ut.cpp
+++ b/library/cpp/json/ut/json_reader_ut.cpp
@@ -68,9 +68,9 @@ public:
Y_UNIT_TEST_SUITE(TJsonReaderTest) {
Y_UNIT_TEST(JsonReformatTest) {
- TString data = "{\"null value\": null, \"intkey\": 10, \"double key\": 11.11, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";
+ TString data = "{\"null value\": null, \"intkey\": 10, \"double key\": 11.11, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";
- TString result1, result2;
+ TString result1, result2;
{
TStringStream in;
in << data;
@@ -120,7 +120,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
}
Y_UNIT_TEST(TJsonTreeTest) {
- TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";
+ TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}";
TStringStream in;
in << data;
TJsonValue value;
@@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
UNIT_ASSERT_DOUBLES_EQUAL(value["double key"].GetDouble(), 11.11, 0.001);
UNIT_ASSERT_VALUES_EQUAL(value["bool key"].GetBoolean(), true);
UNIT_ASSERT_VALUES_EQUAL(value["absent string key"].GetString(), TString(""));
- UNIT_ASSERT_VALUES_EQUAL(value["string key"].GetString(), TString("string"));
+ UNIT_ASSERT_VALUES_EQUAL(value["string key"].GetString(), TString("string"));
UNIT_ASSERT_VALUES_EQUAL(value["array"][0].GetInteger(), 1);
UNIT_ASSERT_VALUES_EQUAL(value["array"][1].GetInteger(), 2);
UNIT_ASSERT_VALUES_EQUAL(value["array"][2].GetInteger(), 3);
@@ -155,19 +155,19 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
}
Y_UNIT_TEST(TJsonRomaTest) {
- TString data = "{\"test\": [ {\"name\": \"A\"} ]}";
+ TString data = "{\"test\": [ {\"name\": \"A\"} ]}";
TStringStream in;
in << data;
TJsonValue value;
ReadJsonTree(&in, &value);
- UNIT_ASSERT_VALUES_EQUAL(value["test"][0]["name"].GetString(), TString("A"));
+ UNIT_ASSERT_VALUES_EQUAL(value["test"][0]["name"].GetString(), TString("A"));
}
Y_UNIT_TEST(TJsonReadTreeWithComments) {
{
- TString leadingCommentData = "{ // \"test\" : 1 \n}";
+ TString leadingCommentData = "{ // \"test\" : 1 \n}";
{
// No comments allowed
TStringStream in;
@@ -187,7 +187,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
}
{
- TString trailingCommentData = "{ \"test1\" : 1 // \"test2\" : 2 \n }";
+ TString trailingCommentData = "{ \"test1\" : 1 // \"test2\" : 2 \n }";
{
// No comments allowed
TStringStream in;
@@ -375,7 +375,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) {
Y_UNIT_TEST(TJsonMemoryLeakTest) {
// after https://clubs.at.yandex-team.ru/stackoverflow/3691
- TString s = ".";
+ TString s = ".";
NJson::TJsonValue json;
try {
TStringInput in(s);
diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp
index ca11d34dad..ae60f208d4 100644
--- a/library/cpp/json/ut/json_writer_ut.cpp
+++ b/library/cpp/json/ut/json_writer_ut.cpp
@@ -7,9 +7,9 @@ using namespace NJson;
Y_UNIT_TEST_SUITE(TJsonWriterTest) {
Y_UNIT_TEST(SimpleWriteTest) {
- TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3";
+ TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3";
TString expected2 = expected1 + ",\"array\":[\"stroka\",false]";
- TString expected3 = expected2 + "}";
+ TString expected3 = expected2 + "}";
TStringStream out;
@@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
}
Y_UNIT_TEST(SimpleWriteValueTest) {
- TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}";
+ TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}";
TJsonValue v;
v["key1"] = JSON_NULL;
v["key2"]["subkey1"].AppendValue(1);
@@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
}
Y_UNIT_TEST(FormatOutput) {
- TString expected = "{\n \"key1\":null,\n \"key2\":\n {\n \"subkey1\":\n [\n 1,\n {\n \"subsubkey\":\"test2\"\n },\n null,\n true\n ],\n \"subkey2\":\"test\"\n }\n}";
+ TString expected = "{\n \"key1\":null,\n \"key2\":\n {\n \"subkey1\":\n [\n 1,\n {\n \"subsubkey\":\"test2\"\n },\n null,\n true\n ],\n \"subkey2\":\"test\"\n }\n}";
TJsonValue v;
v["key1"] = JSON_NULL;
v["key2"]["subkey1"].AppendValue(1);
@@ -70,7 +70,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
}
Y_UNIT_TEST(SortKeys) {
- TString expected = "{\"a\":null,\"j\":null,\"n\":null,\"y\":null,\"z\":null}";
+ TString expected = "{\"a\":null,\"j\":null,\"n\":null,\"y\":null,\"z\":null}";
TJsonValue v;
v["z"] = JSON_NULL;
v["n"] = JSON_NULL;
@@ -84,7 +84,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
Y_UNIT_TEST(SimpleUnsignedIntegerWriteTest) {
{
- TString expected = "{\"test\":1}";
+ TString expected = "{\"test\":1}";
TJsonValue v;
v.InsertValue("test", 1ull);
TStringStream out;
@@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
} // 1
{
- TString expected = "{\"test\":-1}";
+ TString expected = "{\"test\":-1}";
TJsonValue v;
v.InsertValue("test", -1);
TStringStream out;
@@ -102,7 +102,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
} // -1
{
- TString expected = "{\"test\":18446744073709551615}";
+ TString expected = "{\"test\":18446744073709551615}";
TJsonValue v;
v.InsertValue("test", 18446744073709551615ull);
TStringStream out;
@@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
} // 18446744073709551615
{
- TString expected = "{\"test\":[1,18446744073709551615]}";
+ TString expected = "{\"test\":[1,18446744073709551615]}";
TJsonValue v;
v.InsertValue("test", TJsonValue());
v["test"].AppendValue(1);
@@ -123,62 +123,62 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
} // SimpleUnsignedIntegerWriteTest
Y_UNIT_TEST(WriteOptionalTest) {
- {
- TString expected = "{\"test\":1}";
-
- TStringStream out;
-
- TJsonWriter json(&out, false);
- json.OpenMap();
- json.WriteOptional("test", MakeMaybe<int>(1));
- json.CloseMap();
- json.Flush();
- UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
- }
-
- {
- TString expected = "{}";
-
- TStringStream out;
-
- TMaybe<int> nothing = Nothing();
-
- TJsonWriter json(&out, false);
- json.OpenMap();
- json.WriteOptional("test", nothing);
- json.CloseMap();
- json.Flush();
- UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
- }
-
- {
- TString expected = "{}";
-
- TStringStream out;
-
- TMaybe<int> empty;
-
- TJsonWriter json(&out, false);
- json.OpenMap();
- json.WriteOptional("test", empty);
- json.CloseMap();
- json.Flush();
- UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
- }
-
- {
- TString expected = "{}";
-
- TStringStream out;
-
- TJsonWriter json(&out, false);
- json.OpenMap();
- json.WriteOptional("test", Nothing());
- json.CloseMap();
- json.Flush();
- UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
- }
- }
+ {
+ TString expected = "{\"test\":1}";
+
+ TStringStream out;
+
+ TJsonWriter json(&out, false);
+ json.OpenMap();
+ json.WriteOptional("test", MakeMaybe<int>(1));
+ json.CloseMap();
+ json.Flush();
+ UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
+ }
+
+ {
+ TString expected = "{}";
+
+ TStringStream out;
+
+ TMaybe<int> nothing = Nothing();
+
+ TJsonWriter json(&out, false);
+ json.OpenMap();
+ json.WriteOptional("test", nothing);
+ json.CloseMap();
+ json.Flush();
+ UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
+ }
+
+ {
+ TString expected = "{}";
+
+ TStringStream out;
+
+ TMaybe<int> empty;
+
+ TJsonWriter json(&out, false);
+ json.OpenMap();
+ json.WriteOptional("test", empty);
+ json.CloseMap();
+ json.Flush();
+ UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
+ }
+
+ {
+ TString expected = "{}";
+
+ TStringStream out;
+
+ TJsonWriter json(&out, false);
+ json.OpenMap();
+ json.WriteOptional("test", Nothing());
+ json.CloseMap();
+ json.Flush();
+ UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected);
+ }
+ }
Y_UNIT_TEST(Callback) {
NJsonWriter::TBuf json;