diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2021-08-10 19:30:03 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2021-08-17 03:53:45 +0200 |
commit | 4603d7e231edb13c91f1f3b5d2414e751aa73533 (patch) | |
tree | 622e9753721158ebb55ea4fc654e6188d1e8b0bf /tests/auto/corelib/text/shared/test_number_shared.h | |
parent | b43afd5315dc8f78bda4331a66886ca61a3e8dce (diff) |
QString/QByteArray::number(double): Test big numbers
Exhausts the entire buffer which double-conversion is left to work with.
Also has a large amount of precision, which apparently we need to store
temporarily.
Task-number: QTBUG-88484
Change-Id: I87e8c323676465f1b8695e086020df1240d0d0d7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/shared/test_number_shared.h')
-rw-r--r-- | tests/auto/corelib/text/shared/test_number_shared.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/shared/test_number_shared.h b/tests/auto/corelib/text/shared/test_number_shared.h index 5061a4fda5..0cbe4492e5 100644 --- a/tests/auto/corelib/text/shared/test_number_shared.h +++ b/tests/auto/corelib/text/shared/test_number_shared.h @@ -36,6 +36,7 @@ struct NumberDoubleTestData char f; int p; QLatin1String expected; + QLatin1String optTitle = {}; // optional }; template<typename Fun> @@ -55,6 +56,31 @@ inline void add_number_double_shared_data(Fun addTestRowFunction) { -100000, 'f', 15, QLatin1String("-100000.000000000000000") }, { 0.5 + qSqrt(1.25), 'f', 15, QLatin1String("1.618033988749895") }, { 0.5 + qSqrt(1.25), 'e', 15, QLatin1String("1.618033988749895e+00") }, + { 1.7976931348623157e+308, 'f', 120, + QLatin1String( + "17976931348623157081452742373170435679807056752584499659891747680315726078002853" + "87605895586327668781715404589535143824642343213268894641827684675467035375169860" + "49910576551282076245490090389328944075868508455133942304583236903222948165808559" + "332123348274797826204144723168738177180919299881250404026184124858368." + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000"), + QLatin1String("Big number, high precision") }, + { 1.0, 'f', 350, + QLatin1String( + "1.0000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000"), + QLatin1String("Very high precision 1") }, + { 1.0e-308, 'f', 350, + QLatin1String("0." + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000999999999999999909326625337248461995470489"), + QLatin1String("Very small number, very high precision") }, { std::numeric_limits<double>::epsilon(), 'g', 10, QLatin1String("2.220446049e-16") }, { 0.0001, 'e', 1, QLatin1String("1.0e-04") }, { 1e8, 'e', 1, QLatin1String("1.0e+08") }, |