summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-21 13:51:50 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-08-01 13:51:23 +0200
commitf23f9ba041a790566ca1553d4dc138af3c49db80 (patch)
tree74334ca05199f5da0e253e1117701569bc630774 /src/testlib/qtestcase.cpp
parent10845315b714857c754c1de5360bba3b0386bdab (diff)
QTestLib: Speed up QCOMPARE for QString
Add overloads for qCompare() for QStringView making use of the fast formatting helper introduced by 94aa350621e8a5c4ad3b438c10fc1c0a9ed3bc8a for int. Speeds up the bug report example by a factor of 3..4. Task-number: QTBUG-38890 Change-Id: Icc706618b2f1d23b37d354a04d4e1d1cc4b5aee3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 52eb04b109..990fc5679d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2587,6 +2587,57 @@ bool QTest::qCompare(unsigned t1, unsigned t2, const char *actual, const char *e
t1, t2, actual, expected, file, line);
}
+/*! \fn bool QTest::qCompare(QStringView t1, QStringView t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+bool QTest::qCompare(QStringView t1, QStringView t2, const char *actual, const char *expected,
+ const char *file, int line)
+{
+ return QTestResult::compare(t1 == t2,
+ "Compared values are not the same",
+ t1, t2, actual, expected, file, line);
+}
+
+/*! \fn bool QTest::qCompare(QStringView t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+bool QTest::qCompare(QStringView t1, const QLatin1String &t2, const char *actual, const char *expected,
+ const char *file, int line)
+{
+ return QTestResult::compare(t1 == t2,
+ "Compared values are not the same",
+ t1, t2, actual, expected, file, line);
+}
+
+/*! \fn bool QTest::qCompare(const QLatin1String &t1, QStringView t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+bool QTest::qCompare(const QLatin1String &t1, QStringView t2, const char *actual, const char *expected,
+ const char *file, int line)
+{
+ return QTestResult::compare(t1 == t2,
+ "Compared values are not the same",
+ t1, t2, actual, expected, file, line);
+}
+
+/*! \fn bool QTest::qCompare(const QString &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+
+/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+
+/*! \fn bool QTest::qCompare(const QLatin1String &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+ \since 5.14
+ */
+
/*! \fn bool QTest::qCompare(const double &t1, const float &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/