From 4931fe9b02f68d59a3a68f4eaf5cf74695686add Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 28 Oct 2022 18:17:00 +0200 Subject: 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 Reviewed-by: Thiago Macieira --- tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'tests/benchmarks/corelib') 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); -- cgit v1.2.3