tst_QCryptographicHash: mask a QSKIP in addDataAcceptsNullByteArrayView()

We know NumAlgorithms is not supported, so don't print a skipped
warning, by not including that enumerator in the test data in the
first place.

Amends 96dc4acb235f13a72bef7c719d005846fe1d9726.

Change-Id: Ie19f7ebcceb855b9363017c8b2626dae99e23313
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 00099c057cb584713cb9327738393e1748fc14f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-05-17 14:52:52 +02:00 committed by Qt Cherry-pick Bot
parent 077ffcebc7
commit 89737a2221

View File

@ -29,9 +29,9 @@ private slots:
void blake2(); void blake2();
void files_data(); void files_data();
void files(); void files();
void hashLength_data(); void hashLength_data() { all_methods(true); }
void hashLength(); void hashLength();
void addDataAcceptsNullByteArrayView_data() { hashLength_data(); } void addDataAcceptsNullByteArrayView_data() { all_methods(false); }
void addDataAcceptsNullByteArrayView(); void addDataAcceptsNullByteArrayView();
void move(); void move();
void swap(); void swap();
@ -40,6 +40,7 @@ private slots:
void moreThan4GiBOfData(); void moreThan4GiBOfData();
void keccakBufferOverflow(); void keccakBufferOverflow();
private: private:
void all_methods(bool includingNumAlgorithms) const;
void ensureLargeData(); void ensureLargeData();
std::vector<char> large; std::vector<char> large;
}; };
@ -474,12 +475,14 @@ void tst_QCryptographicHash::files()
} }
} }
void tst_QCryptographicHash::hashLength_data() void tst_QCryptographicHash::all_methods(bool inclNumAlgos) const
{ {
QTest::addColumn<QCryptographicHash::Algorithm>("algorithm"); QTest::addColumn<QCryptographicHash::Algorithm>("algorithm");
auto metaEnum = QMetaEnum::fromType<QCryptographicHash::Algorithm>(); auto metaEnum = QMetaEnum::fromType<QCryptographicHash::Algorithm>();
for (int i = 0, value = metaEnum.value(i); value != -1; value = metaEnum.value(++i)) { for (int i = 0, value = metaEnum.value(i); value != -1; value = metaEnum.value(++i)) {
auto algorithm = QCryptographicHash::Algorithm(value); auto algorithm = QCryptographicHash::Algorithm(value);
if (!inclNumAlgos && algorithm == QCryptographicHash::Algorithm::NumAlgorithms)
continue;
QTest::addRow("%s", metaEnum.key(i)) << algorithm; QTest::addRow("%s", metaEnum.key(i)) << algorithm;
} }
} }