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 <thiago.macieira@intel.com>
(cherry picked from commit 9c63667d01eb13f43d3b51a8a3502bfc233d6b0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-09-06 18:43:36 +02:00 committed by Qt Cherry-pick Bot
parent b0d6fe9ad1
commit 806a24a57d

View File

@ -415,13 +415,9 @@ void tst_QHashFunctions::stdPair_template(const T1 &t1, const T2 &t2)
std::pair<T1, T2> dpair{}; std::pair<T1, T2> dpair{};
std::pair<T1, T2> vpair{t1, t2}; std::pair<T1, T2> vpair{t1, t2};
size_t seed = QHashSeed::globalSeed();
// confirm proper working of the pair and of the underlying types // confirm proper working of the pair and of the underlying types
QVERIFY(t1 == t1); QVERIFY(t1 == t1);
QVERIFY(t2 == t2); QVERIFY(t2 == t2);
QCOMPARE(qHash(t1), qHash(t1));
QCOMPARE(qHash(t2), qHash(t2));
QCOMPARE(qHash(t1, seed), qHash(t1, seed)); QCOMPARE(qHash(t1, seed), qHash(t1, seed));
QCOMPARE(qHash(t2, seed), qHash(t2, 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); QVERIFY(vpair == vpair);
// therefore their hashes should be equal // therefore their hashes should be equal
QCOMPARE(qHash(dpair), qHash(dpair));
QCOMPARE(qHash(dpair, seed), qHash(dpair, seed)); QCOMPARE(qHash(dpair, seed), qHash(dpair, seed));
QCOMPARE(qHash(vpair), qHash(vpair));
QCOMPARE(qHash(vpair, seed), qHash(vpair, seed)); QCOMPARE(qHash(vpair, seed), qHash(vpair, seed));
} }