diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-21 12:47:44 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-07-09 20:15:58 +0200 |
commit | 94aa350621e8a5c4ad3b438c10fc1c0a9ed3bc8a (patch) | |
tree | a2af32e27680383ba30981654ba9544947a01048 /src/testlib/qtestcase.h | |
parent | 9c8d1ca18b48dbcc89dda1b9bacdf7d49c7fc754 (diff) |
QTestLib: Speed up QCOMPARE for float, double, int, unsigned
Factor out a helper template formatting the QCOMPARE failure message
delaying the formatting of the parameters with toString() and use that
for float, double, int and unsigned. This removes the need to always
format and allocate strings for the operands even in the success case,
speeding up the QColor test from 3.3s to 700ms (Windows/release).
Task-number: QTBUG-38890
Change-Id: I999484765bdaed921d3fc35f35a9fbbcd82a9704
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index af7c0f43b9..40afac37c5 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -363,6 +363,12 @@ namespace QTest Q_TESTLIB_EXPORT bool qCompare(double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line); + Q_TESTLIB_EXPORT bool qCompare(int t1, int t2, const char *actual, const char *expected, + const char *file, int line); + + Q_TESTLIB_EXPORT bool qCompare(unsigned t1, unsigned t2, const char *actual, const char *expected, + const char *file, int line); + inline bool compare_ptr_helper(const volatile void *t1, const volatile void *t2, const char *actual, const char *expected, const char *file, int line) { |