aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/ut
diff options
context:
space:
mode:
authorsvshevtsov <svshevtsov@yandex-team.ru>2022-02-10 16:49:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:37 +0300
commit657337012a264721d58c470b4e9e796611f3c492 (patch)
tree82753fd92cf7cc2dea4e522a945ed570131f920b /library/cpp/json/ut
parent44f31b316af517a4fbc6a82ebed8a1c51807deac (diff)
downloadydb-657337012a264721d58c470b4e9e796611f3c492.tar.gz
Restoring authorship annotation for <svshevtsov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/json/ut')
-rw-r--r--library/cpp/json/ut/json_writer_ut.cpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp
index ca11d34dad..af38ccf662 100644
--- a/library/cpp/json/ut/json_writer_ut.cpp
+++ b/library/cpp/json/ut/json_writer_ut.cpp
@@ -187,42 +187,42 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) {
UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, ""), "\"A\"");
UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, "Foo"), "Foo(\"A\")");
}
-
+
Y_UNIT_TEST(FloatPrecision) {
- const double value = 1517933989.4242;
- const NJson::TJsonValue json(value);
- NJson::TJsonWriterConfig config;
- {
- TString expected = "1517933989";
- TString actual = NJson::WriteJson(json);
- UNIT_ASSERT_VALUES_EQUAL(actual, expected);
- }
- {
- TString expected = "1517933989";
-
- TStringStream ss;
- NJson::WriteJson(&ss, &json, config);
- TString actual = ss.Str();
- UNIT_ASSERT_VALUES_EQUAL(actual, expected);
- }
- {
- config.DoubleNDigits = 13;
- TString expected = "1517933989.424";
-
- TStringStream ss;
- NJson::WriteJson(&ss, &json, config);
- TString actual = ss.Str();
- UNIT_ASSERT_VALUES_EQUAL(actual, expected);
- }
- {
- config.DoubleNDigits = 6;
- config.FloatToStringMode = PREC_POINT_DIGITS;
- TString expected = "1517933989.424200";
-
- TStringStream ss;
- NJson::WriteJson(&ss, &json, config);
- TString actual = ss.Str();
- UNIT_ASSERT_VALUES_EQUAL(actual, expected);
- }
- }
+ const double value = 1517933989.4242;
+ const NJson::TJsonValue json(value);
+ NJson::TJsonWriterConfig config;
+ {
+ TString expected = "1517933989";
+ TString actual = NJson::WriteJson(json);
+ UNIT_ASSERT_VALUES_EQUAL(actual, expected);
+ }
+ {
+ TString expected = "1517933989";
+
+ TStringStream ss;
+ NJson::WriteJson(&ss, &json, config);
+ TString actual = ss.Str();
+ UNIT_ASSERT_VALUES_EQUAL(actual, expected);
+ }
+ {
+ config.DoubleNDigits = 13;
+ TString expected = "1517933989.424";
+
+ TStringStream ss;
+ NJson::WriteJson(&ss, &json, config);
+ TString actual = ss.Str();
+ UNIT_ASSERT_VALUES_EQUAL(actual, expected);
+ }
+ {
+ config.DoubleNDigits = 6;
+ config.FloatToStringMode = PREC_POINT_DIGITS;
+ TString expected = "1517933989.424200";
+
+ TStringStream ss;
+ NJson::WriteJson(&ss, &json, config);
+ TString actual = ss.Str();
+ UNIT_ASSERT_VALUES_EQUAL(actual, expected);
+ }
+ }
}