aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authoregoroveug <egoroveug@yandex-team.ru>2022-02-10 16:50:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:25 +0300
commit7db88fbe416b152c86709c2b904a38b9774b245e (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parent3765cd96a63a8b9571d48c480806ce35989ca19e (diff)
downloadydb-7db88fbe416b152c86709c2b904a38b9774b245e.tar.gz
Restoring authorship annotation for <egoroveug@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/json/writer/json.h8
-rw-r--r--library/cpp/json/writer/json_ut.cpp26
2 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h
index ed5b981a37..0aae2531b9 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 ddb70f198d..9980555683 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) {
{