QCryptographicHash: add specific test for static hash() function

The test already exercised the function here and there, but it lacked
a central place to test the static hash() method, so add one.

Pick-to: 6.5
Change-Id: I229bc8a8ed07e0036f60de62ecc4d11ef88dd20e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8586f9e1b9fa553b7fe450bbb45ef2cfbd3dd404)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-05-17 15:10:51 +02:00 committed by Qt Cherry-pick Bot
parent 89737a2221
commit 951003d3d5

View File

@ -20,6 +20,8 @@ private slots:
void repeated_result();
void intermediary_result_data();
void intermediary_result();
void static_hash_data() { intermediary_result_data(); }
void static_hash();
void sha1();
void sha3_data();
void sha3();
@ -198,6 +200,17 @@ void tst_QCryptographicHash::intermediary_result()
hash.reset();
}
void tst_QCryptographicHash::static_hash()
{
QFETCH(const int, algo);
QFETCH(const QByteArray, first);
QFETCH(const QByteArray, hash_first);
const auto _algo = QCryptographicHash::Algorithm(algo);
QCOMPARE(QCryptographicHash::hash(first, _algo), hash_first);
}
void tst_QCryptographicHash::sha1()
{