From 806a24a57dd5e2d09eed0dbfd036d0caffdc40a5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 6 Sep 2023 18:43:36 +0200 Subject: [PATCH] tst_QHashFunctions: fix std::pair test to use QFETCH_GLOBAL seeds Because the local `seed` variable shadowed the member one, this test was run for each QFETCH_GLOBAL with the same data and seed. That doesn't make sense, so make the test use the member variable `seed`, as all other tests already do. Since zero is one of the seeds coming from QFETCH_GLOBAL, drop the seedless calls to qHash(), too. Amends 64bfc927b09b46bb7fc0dc6caf1bf1a4d4133ab4. Change-Id: I1e22ec0b38341264bcf2d5c26146cbbcab6e0749 Reviewed-by: Thiago Macieira (cherry picked from commit 9c63667d01eb13f43d3b51a8a3502bfc233d6b0b) Reviewed-by: Qt Cherry-pick Bot --- .../corelib/tools/qhashfunctions/tst_qhashfunctions.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index 63fcfb99d03..69e401ae66f 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -415,13 +415,9 @@ void tst_QHashFunctions::stdPair_template(const T1 &t1, const T2 &t2) std::pair dpair{}; std::pair vpair{t1, t2}; - size_t seed = QHashSeed::globalSeed(); - // confirm proper working of the pair and of the underlying types QVERIFY(t1 == t1); QVERIFY(t2 == t2); - QCOMPARE(qHash(t1), qHash(t1)); - QCOMPARE(qHash(t2), qHash(t2)); QCOMPARE(qHash(t1, seed), qHash(t1, seed)); QCOMPARE(qHash(t2, seed), qHash(t2, seed)); @@ -429,9 +425,7 @@ void tst_QHashFunctions::stdPair_template(const T1 &t1, const T2 &t2) QVERIFY(vpair == vpair); // therefore their hashes should be equal - QCOMPARE(qHash(dpair), qHash(dpair)); QCOMPARE(qHash(dpair, seed), qHash(dpair, seed)); - QCOMPARE(qHash(vpair), qHash(vpair)); QCOMPARE(qHash(vpair, seed), qHash(vpair, seed)); }