diff options
Diffstat (limited to 'tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index 6961426f59..bde9433a24 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -50,6 +50,8 @@ private Q_SLOTS: void qthash(); void range(); void rangeCommutative(); + + void setGlobalQHashSeed(); }; void tst_QHashFunctions::qhash() @@ -207,5 +209,21 @@ void tst_QHashFunctions::rangeCommutative() (void)qHashRangeCommutative(hashables, hashables + numHashables); } +void tst_QHashFunctions::setGlobalQHashSeed() +{ + // Setter works as advertised + qSetGlobalQHashSeed(0x10101010); + QCOMPARE(qGlobalQHashSeed(), 0x10101010); + + // Creating a new QHash doesn't reset the seed + QHash<QString, int> someHash; + someHash.insert("foo", 42); + QCOMPARE(qGlobalQHashSeed(), 0x10101010); + + // Reset works as advertised + qSetGlobalQHashSeed(-1); + QVERIFY(qGlobalQHashSeed() != -1); +} + QTEST_APPLESS_MAIN(tst_QHashFunctions) #include "tst_qhashfunctions.moc" |