Browse Source

Restoring authorship annotation for <egoroveug@yandex-team.ru>. Commit 1 of 2.

egoroveug 3 years ago
parent
commit
3765cd96a6
2 changed files with 17 additions and 17 deletions
  1. 4 4
      library/cpp/json/writer/json.h
  2. 13 13
      library/cpp/json/writer/json_ut.cpp

+ 4 - 4
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();
 

+ 13 - 13
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) {
         {