diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-10 15:41:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-23 14:13:48 +0000 |
commit | 573f87d81363a303b7005f999a283db624201db8 (patch) | |
tree | 0493995a00bba6df52f5322550d3005f597deb7e /tests/auto/corelib/json | |
parent | 15b5b3b3f01e400e46fe67babe593ede373dac4b (diff) |
Use "shortest" double conversion for JSON
Task-number: QTBUG-42419
Change-Id: I649c4de96a2e41078e139c0f382e5a6cf96d3bb9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'tests/auto/corelib/json')
-rw-r--r-- | tests/auto/corelib/json/json.pro | 4 | ||||
-rw-r--r-- | tests/auto/corelib/json/tst_qtjson.cpp | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/tests/auto/corelib/json/json.pro b/tests/auto/corelib/json/json.pro index a8224fd201..b3038d7ca1 100644 --- a/tests/auto/corelib/json/json.pro +++ b/tests/auto/corelib/json/json.pro @@ -6,4 +6,8 @@ CONFIG += testcase !android:TESTDATA += bom.json test.json test.bjson test3.json test2.json else:RESOURCES += json.qrc +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + SOURCES += tst_qtjson.cpp diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index e8d836683e..aebf332fe3 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1408,9 +1408,7 @@ void tst_QtJson::toJsonLargeNumericValues() " \"Array\": [\n" " 1.234567,\n" " 1.7976931348623157e+308,\n" - // ((4.9406564584124654e-324 == 5e-324) == true) - // I can only think JavaScript has a special formatter to - // emit this value for this IEEE754 bit pattern. +#ifdef QT_NO_DOUBLECONVERSION // "shortest" double conversion is not very short then " 4.9406564584124654e-324,\n" " 2.2250738585072014e-308,\n" " 1.7976931348623157e+308,\n" @@ -1421,6 +1419,18 @@ void tst_QtJson::toJsonLargeNumericValues() " -1.7976931348623157e+308,\n" " -2.2204460492503131e-16,\n" " -4.9406564584124654e-324,\n" +#else + " 5e-324,\n" + " 2.2250738585072014e-308,\n" + " 1.7976931348623157e+308,\n" + " 2.220446049250313e-16,\n" + " 5e-324,\n" + " 0,\n" + " -2.2250738585072014e-308,\n" + " -1.7976931348623157e+308,\n" + " -2.220446049250313e-16,\n" + " -5e-324,\n" +#endif " 0,\n" " 9007199254740992,\n" " -9007199254740992\n" |