diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index 4358aa0d1dc..beb3eb36c49 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -33,6 +33,7 @@ public slots: void init(); private Q_SLOTS: + void boolIntegerConsistency(); void unsignedIntegerConsistency_data(); void unsignedIntegerConsistency(); void signedIntegerConsistency_data(); @@ -94,6 +95,19 @@ void tst_QHashFunctions::init() seed = size_t(seedValue); } +void tst_QHashFunctions::boolIntegerConsistency() +{ + if (seed) QEXPECT_FAIL("", "QTBUG-126674", Continue); + QCOMPARE(qHash(0, seed), qHash(false, seed)); + if (seed) QEXPECT_FAIL("", "QTBUG-126674", Continue); + QCOMPARE(qHash(1, seed), qHash(true, seed)); +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) + // check consistency with pre-6.9 incidental implementation: + QCOMPARE(qHash(true, seed), qHash(int(true)) ^ seed); + QCOMPARE(qHash(false, seed), qHash(int(false)) ^ seed); +#endif +} + template static void addPositiveCommonRows() { QTest::addRow("zero") << T(0);