qt5base-lts/tests/auto/corelib/io
Ivan Solovev 0681a2dd5a QTestLib: rework QTest::compare_helper()
[ChangeLog][QTestLib] QCOMPARE now evaluates toString() on its
arguments lazily, speeding up the general case where the comparison
doesn't fail. This is true for the QCOMPARE functionality provided
by Qt. If you specialized qCompare() for your own types, then you
need to change its implementation in line with Qt's own qCompare()
specializations in order to enable this feature.

[ChangeLog][QTestLib] QCOMPARE calls with nullptr argument(s) will
now print the actual and expected values upon failure.

Previously it was not like that because of the compareHelper()
overload in qtestresult.cpp that treated the presence of
nullptr-arguments as a reason to ignore formatFailMessage() call.
New implementation does not have this check, and correctly
executes formatFailMessage() for all arguments.

Note that the qCompare() overloads that call QTestResult::compare()
internally were not affected by this patch, because they already
defer toString() invocation until the comparison fails.

Some numbers, collected against shared release developer build.
I checked how this change affects the test execution. The idea was
to pick some tests for types that do not have a specific
QTestResult::compare overload, so I picked a couple of QByteArray
tests.
The comparison is done by running a test 10 times and taking the
average execution duration, as reported in the log.

tst_qbytearrayapisymmetry:
 Before: 15.6 ms
 After:  14.2 ms

tst_qbytearray:
 Before: 41 ms
 After:  36 ms

The benefit is around 9% and 12% respectively.

Fixes: QTBUG-98874
Change-Id: I7d59ddc760168b15974e7720930f629fb34efa13
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-06-03 20:37:51 +00:00
..
largefile Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qabstractfileengine Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qbuffer Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdataurl Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdebug Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdir Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdiriterator Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfile Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfileinfo Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfileselector Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystementry Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemmetadata Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfilesystemwatcher Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qiodevice Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qipaddress Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qlockfile Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qloggingcategory Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qloggingregistry Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qnodebug Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qprocess Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qprocess-noapplication Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qprocessenvironment Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qresourceengine Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsavefile Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsettings Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstandardpaths Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstorageinfo Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtemporarydir Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtemporaryfile Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qurl Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qurlinternal Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qurlquery QTestLib: rework QTest::compare_helper() 2022-06-03 20:37:51 +00:00
qurluts46 Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
CMakeLists.txt Exclude filesystem autotests for INTEGRITY 2021-12-30 15:38:14 +00:00