diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-31 14:04:06 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-04-26 15:22:44 +0000 |
commit | 4ba740b3bac6e1824c18614f579d106eee930d42 (patch) | |
tree | de66f584c1ca90c09447cdd611ea300ec660b2ea /tests/auto/corelib/tools/qhashfunctions | |
parent | 9763b324fd4c17e39854ffadf69d7ea415e397f8 (diff) |
QHash: make it so a zero seed selects a constant algorithm
That's the only value for which we will guarantee a stable result across
Qt versions and across invocations of the same application on different
architectures is zero. For any other value, we reserve the right to
change the algorithm. We'll now print a warning when we detect that.
Task-number: QTBUG-47566
Change-Id: I27b55fdf514247549455fffd14b1135e10d24ab4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools/qhashfunctions')
-rw-r--r-- | tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index dbfcf57955..124e3cdf00 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -284,17 +284,17 @@ void tst_QHashFunctions::rangeCommutative() void tst_QHashFunctions::setGlobalQHashSeed() { // Setter works as advertised - qSetGlobalQHashSeed(0x10101010); - QCOMPARE(qGlobalQHashSeed(), 0x10101010); + qSetGlobalQHashSeed(0); + QCOMPARE(qGlobalQHashSeed(), 0); // Creating a new QHash doesn't reset the seed QHash<QString, int> someHash; someHash.insert("foo", 42); - QCOMPARE(qGlobalQHashSeed(), 0x10101010); + QCOMPARE(qGlobalQHashSeed(), 0); // Reset works as advertised qSetGlobalQHashSeed(-1); - QVERIFY(qGlobalQHashSeed() != -1); + QVERIFY(qGlobalQHashSeed() > 0); } QTEST_APPLESS_MAIN(tst_QHashFunctions) |