From a5760a1741e55cdab9b868d4b8b14d978792626d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 7 Jul 2021 07:31:49 +0200 Subject: [PATCH] tst_QCryptographicHash: simplify the creation of a large QBA Use the ctor instead of appending 1'000'000 chars. Introduce C++14 digit separators as a drive-by. Change-Id: Icdbef3173f42d12ae2226b8556f9b1519e594adc Reviewed-by: Friedemann Kleint --- .../tools/qcryptographichash/tst_qcryptographichash.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp index a9432809968..4560a3fe083 100644 --- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp +++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp @@ -209,10 +209,7 @@ void tst_QCryptographicHash::sha1() // SHA1(A million repetitions of "a") = // 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F - QByteArray as; - for (int i = 0; i < 1000000; ++i) - as += 'a'; - QCOMPARE(QCryptographicHash::hash(as, QCryptographicHash::Sha1).toHex().toUpper(), + QCOMPARE(QCryptographicHash::hash(QByteArray(1'000'000, 'a'), QCryptographicHash::Sha1).toHex().toUpper(), QByteArray("34AA973CD4C4DAA4F61EEB2BDBAD27316534016F")); }