summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-02 20:00:33 -0800
committerThiago Macieira <thiago.macieira@intel.com>2024-03-12 17:23:09 -0800
commit970aad541811d002e5004bd3826929247492ba09 (patch)
tree0b2a531dd7ea4a5f80f3b8e6e5475f7983746307 /tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
parent9a2e21174a08cf282cb933c95380abd900102ae0 (diff)
qHash: implement chunked hashing of QLatin1StringView
So that it hashes to the same value as QString{,View}. In order to test this, you must either run on a CPU other than ARM and x86, or disable the AES hasher. I did that and can confirm siphash and murmurhash do work with on-the-fly conversion from Latin-1. Change-Id: I664b9f014ffc48cbb49bfffd17b03e5e62ec4e89 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp')
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
index b9a7d88056..fdb2b37346 100644
--- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
+++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
@@ -321,6 +321,19 @@ void tst_QHashFunctions::stringConsistency()
QCOMPARE(qHash(sv, seed), qHash(value, seed));
QCOMPARE(qHash(u8bav, seed), qHash(u8ba, seed));
+
+ if (seed || QT_VERSION_MAJOR > 6) {
+ QByteArray l1ba = value.toLatin1();
+ QLatin1StringView l1sv(l1ba.data(), l1ba.size());
+#ifdef Q_PROCESSOR_ARM
+ // zero-extending aeshash not implemented on ARM
+#elif defined(Q_PROCESSOR_X86)
+ // zero-extending aeshash not implemented on x86
+#else
+ if (value == l1sv)
+ QCOMPARE(qHash(l1sv, seed), qHash(value, seed));
+#endif
+ }
}
void tst_QHashFunctions::qhash()