diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-10-28 18:17:00 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-02-24 13:37:07 +0100 |
commit | 4931fe9b02f68d59a3a68f4eaf5cf74695686add (patch) | |
tree | d708bddc063dbfc1974017d1f263b641c8d4c060 /tests/benchmarks/corelib | |
parent | d753941817f4c623a4e202234535426708bb6eb6 (diff) |
Fix parsing of numbers to cope with non-single-character tokens
In some locales signs and the exponent are not single character
tokens. Replace QLocaleData::numericToCLocale() with a tokenizer that
will cope with this. At the same time, cache the locale data needed in
support of that, so that we don't repeatedly recreate QString()
objects just to compare them against input tokens.
The caching class is inspired by Thiago's proposal for fixing the
performance, which also inspires the optimization of the C locale in
the tokenizer used here.
Add some testing that round-tripping numbers via strings works for the
locales with signs and exponents that use more than one character.
Task-number: QTBUG-107801
Change-Id: I9fd8409a371ed62ed969d9ebc8b09584e752f7fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/benchmarks/corelib')
-rw-r--r-- | tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp index 8e0c559dbe..d6a5b90f98 100644 --- a/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp +++ b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp @@ -455,10 +455,6 @@ void tst_QLocale::toLongLong() QBENCHMARK { actual = loc.toLongLong(text, &ok); } - QEXPECT_FAIL("ar_EG: +403", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("ar_EG: -403", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("fa_IR: +403", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("fa_IR: -403", "Code wrongly assumes single character, QTBUG-107801", Abort); QCOMPARE(ok, good); QCOMPARE(actual, expected); } @@ -488,8 +484,6 @@ void tst_QLocale::toULongLong() QBENCHMARK { actual = loc.toULongLong(text, &ok); } - QEXPECT_FAIL("ar_EG: +403", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("fa_IR: +403", "Code wrongly assumes single character, QTBUG-107801", Abort); QCOMPARE(ok, good); QCOMPARE(actual, expected); } @@ -588,9 +582,6 @@ void tst_QLocale::toDouble() QBENCHMARK { actual = loc.toDouble(text, &ok); } - QEXPECT_FAIL("sv_SE: 4e-3", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("se_NO: 4e-3", "Code wrongly assumes single character, QTBUG-107801", Abort); - QEXPECT_FAIL("ar_EG: 4e-3", "Code wrongly assumes single character, QTBUG-107801", Abort); QEXPECT_FAIL("en: ∞", "Localized infinity support missing: QTBUG-95460", Abort); QEXPECT_FAIL("ga: Nuimh", "Localized NaN support missing: QTBUG-95460", Abort); QCOMPARE(ok, good); |