aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/writer/json_ut.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/json/writer/json_ut.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/writer/json_ut.cpp')
-rw-r--r--library/cpp/json/writer/json_ut.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/json/writer/json_ut.cpp b/library/cpp/json/writer/json_ut.cpp
index 9980555683..e8d0be3566 100644
--- a/library/cpp/json/writer/json_ut.cpp
+++ b/library/cpp/json/writer/json_ut.cpp
@@ -16,12 +16,12 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
.UnsafeWritePair("\"xk\":13")
.WriteKey("key2")
.BeginList()
- .BeginObject()
- .EndObject()
- .BeginObject()
- .EndObject()
+ .BeginObject()
+ .EndObject()
+ .BeginObject()
+ .EndObject()
.EndList()
- .EndObject();
+ .EndObject();
w.WriteInt(43);
w.UnsafeWriteValue("\"x\"");
w.WriteString("...");
@@ -75,11 +75,11 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
Y_UNIT_TEST(BareKey) {
NJsonWriter::TBuf w;
w.BeginObject()
- .CompatWriteKeyWithoutQuotes("p")
- .WriteInt(1)
- .CompatWriteKeyWithoutQuotes("n")
- .WriteInt(0)
- .EndObject();
+ .CompatWriteKeyWithoutQuotes("p")
+ .WriteInt(1)
+ .CompatWriteKeyWithoutQuotes("n")
+ .WriteInt(0)
+ .EndObject();
TString ws = w.Str();
const char* exp = "{p:1,n:0}";
UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp);
@@ -108,12 +108,12 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
.WriteInt(1)
.WriteString("hello")
.BeginObject()
- .WriteKey("abc")
- .WriteInt(3)
- .WriteKey("def")
- .WriteInt(4)
+ .WriteKey("abc")
+ .WriteInt(3)
+ .WriteKey("def")
+ .WriteInt(4)
.EndObject()
- .EndList();
+ .EndList();
const char* exp = "[\n"
" 1,\n"
" \"hello\",\n"
@@ -196,12 +196,12 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
.WriteFloat(244.13854, PREC_NDIGITS, 4)
.WriteFloat(10385.8324, PREC_POINT_DIGITS, 2)
.BeginObject()
- .WriteKey("1")
- .WriteDouble(1111.71, PREC_POINT_DIGITS, 0)
- .WriteKey("2")
- .WriteDouble(1111.71, PREC_NDIGITS, 1)
+ .WriteKey("1")
+ .WriteDouble(1111.71, PREC_POINT_DIGITS, 0)
+ .WriteKey("2")
+ .WriteDouble(1111.71, PREC_NDIGITS, 1)
.EndObject()
- .EndList();
+ .EndList();
const char exp[] = "[0.123457,0.1234567899,0.316,244.1,10385.83,{\"1\":1112,\"2\":1e+03}]";
UNIT_ASSERT_STRINGS_EQUAL(exp, buf.Str());
}
@@ -238,17 +238,17 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
buf.SetWriteNanAsString();
buf.BeginObject()
- .WriteKey("nanvalue")
- .WriteFloat(std::numeric_limits<double>::quiet_NaN())
- .WriteKey("infvalue")
- .WriteFloat(std::numeric_limits<double>::infinity())
- .WriteKey("minus_infvalue")
- .WriteFloat(-std::numeric_limits<float>::infinity())
+ .WriteKey("nanvalue")
+ .WriteFloat(std::numeric_limits<double>::quiet_NaN())
+ .WriteKey("infvalue")
+ .WriteFloat(std::numeric_limits<double>::infinity())
+ .WriteKey("minus_infvalue")
+ .WriteFloat(-std::numeric_limits<float>::infinity())
.WriteKey("l")
- .BeginList()
- .WriteFloat(std::numeric_limits<float>::quiet_NaN())
- .EndList()
- .EndObject();
+ .BeginList()
+ .WriteFloat(std::numeric_limits<float>::quiet_NaN())
+ .EndList()
+ .EndObject();
UNIT_ASSERT_STRINGS_EQUAL(buf.Str(), R"raw_json({"nanvalue":"nan","infvalue":"inf","minus_infvalue":"-inf","l":["nan"]})raw_json");
}
@@ -256,11 +256,11 @@ Y_UNIT_TEST_SUITE(JsonWriter) {
{
NJsonWriter::TBuf buf;
buf.BeginObject()
- .WriteKey("<>&")
- .WriteString("Ololo")
- .UnsafeWriteKey("<>&")
- .WriteString("Ololo2")
- .EndObject();
+ .WriteKey("<>&")
+ .WriteString("Ololo")
+ .UnsafeWriteKey("<>&")
+ .WriteString("Ololo2")
+ .EndObject();
UNIT_ASSERT_STRINGS_EQUAL(buf.Str(), R"({"\u003C\u003E&":"Ololo","<>&":"Ololo2"})");
}