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.

Pick-to: 6.7
Change-Id: Ie19f7ebcceb855b9363017c8b2626dae99e23313
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
Marc Mutz 2024-05-17 14:52:52 +02:00
parent 8586f9e1b9
commit 00099c057c

View File

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