diff options
| author | egoroveug <[email protected]> | 2022-02-10 16:50:25 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:50:25 +0300 | 
| commit | 3765cd96a63a8b9571d48c480806ce35989ca19e (patch) | |
| tree | 7812e2c79af8114bfd003eb33a983891eddafa84 /library/cpp/json | |
| parent | ec545677cb3d75384c18bb2307a912b4d0e7bbb1 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json')
| -rw-r--r-- | library/cpp/json/writer/json.h | 8 | ||||
| -rw-r--r-- | library/cpp/json/writer/json_ut.cpp | 26 | 
2 files changed, 17 insertions, 17 deletions
| diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h index 0aae2531b94..ed5b981a376 100644 --- a/library/cpp/json/writer/json.h +++ b/library/cpp/json/writer/json.h @@ -6,7 +6,7 @@  #include <util/generic/vector.h>  #include <util/generic/yexception.h>  #include <util/stream/str.h> -#include <util/string/cast.h> +#include <util/string/cast.h>   namespace NJson {      class TJsonValue; @@ -48,8 +48,8 @@ namespace NJsonWriter {          TValueContext WriteInt(int i);          TValueContext WriteLongLong(long long i);          TValueContext WriteULongLong(unsigned long long i); -        TValueContext WriteFloat(float f, EFloatToStringMode mode = PREC_NDIGITS, int ndigits = 6); -        TValueContext WriteDouble(double f, EFloatToStringMode mode = PREC_NDIGITS, int ndigits = 10); +        TValueContext WriteFloat(float f, EFloatToStringMode mode = PREC_NDIGITS, int ndigits = 6);  +        TValueContext WriteDouble(double f, EFloatToStringMode mode = PREC_NDIGITS, int ndigits = 10);           TValueContext WriteBool(bool b);          TValueContext WriteNull();          TValueContext WriteJsonValue(const NJson::TJsonValue* value, bool sortKeys = false, EFloatToStringMode mode = PREC_NDIGITS, int ndigits = 10); @@ -176,7 +176,7 @@ namespace NJsonWriter {          TOutContext WriteDouble(double, EFloatToStringMode, int ndigits);          TOutContext WriteJsonValue(const NJson::TJsonValue* value, bool sortKeys = false);          TOutContext UnsafeWriteValue(const TStringBuf&); - +           TValueContext BeginList();          TPairContext BeginObject(); diff --git a/library/cpp/json/writer/json_ut.cpp b/library/cpp/json/writer/json_ut.cpp index 9980555683f..ddb70f198d9 100644 --- a/library/cpp/json/writer/json_ut.cpp +++ b/library/cpp/json/writer/json_ut.cpp @@ -186,25 +186,25 @@ Y_UNIT_TEST_SUITE(JsonWriter) {          buf.WriteString("</>");          UNIT_ASSERT_STRINGS_EQUAL("\"\\u003C/\\u003E\"", buf.Str());      } - +       Y_UNIT_TEST(FloatFormatting) { -        NJsonWriter::TBuf buf(NJsonWriter::HEM_DONT_ESCAPE_HTML); -        buf.BeginList() -            .WriteFloat(0.12345678987654321f) -            .WriteDouble(0.12345678987654321) -            .WriteFloat(0.315501, PREC_NDIGITS, 3) -            .WriteFloat(244.13854, PREC_NDIGITS, 4) -            .WriteFloat(10385.8324, PREC_POINT_DIGITS, 2) -            .BeginObject() +        NJsonWriter::TBuf buf(NJsonWriter::HEM_DONT_ESCAPE_HTML);  +        buf.BeginList()  +            .WriteFloat(0.12345678987654321f)  +            .WriteDouble(0.12345678987654321)  +            .WriteFloat(0.315501, PREC_NDIGITS, 3)  +            .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) -            .EndObject() +            .EndObject()               .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()); -    } +        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());  +    }       Y_UNIT_TEST(NanFormatting) {          { | 
