summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-04 11:51:31 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-05 03:04:31 +0200
commit7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 (patch)
tree5df8fca668dace17eea7b6c5ed82db8e87180105 /tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
parentc46f59fadf63b661d8611e5896f09fb85c17a00c (diff)
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp')
-rw-r--r--tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
index cacb09aae1..b29e0fabd5 100644
--- a/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -67,8 +67,12 @@ private slots:
#if 0
void createFunctor();
#endif
+#ifdef Q_COMPILER_DECLTYPE
void functor();
+#endif
+#ifdef Q_COMPILER_LAMBDA
void lambda();
+#endif
};
#if 0
@@ -457,12 +461,10 @@ struct Functor {
void operator()(int, int, int, int, int, int) { }
};
+// This tests functor without result_type; decltype need to be supported by the compiler.
+#ifdef Q_COMPILER_DECLTYPE
void tst_QtConcurrentRun::functor()
{
- //this test functor without result_type, decltype need to be supported by the compiler
-#ifndef Q_COMPILER_DECLTYPE
- QSKIP("Compiler do not suport decltype", SkipAll);
-#else
Functor f;
{
QFuture<int> fut = QtConcurrent::run(f);
@@ -483,16 +485,12 @@ void tst_QtConcurrentRun::functor()
QtConcurrent::run(f, 1,2,3,4).waitForFinished();
QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
}
-#endif
}
+#endif
-
+#ifdef Q_COMPILER_LAMBDA
void tst_QtConcurrentRun::lambda()
{
-#ifndef Q_COMPILER_LAMBDA
- QSKIP("Compiler do not suport lambda", SkipAll);
-#else
-
QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
@@ -506,10 +504,8 @@ void tst_QtConcurrentRun::lambda()
QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
}
#endif
-
-#endif
}
-
+#endif
#include "tst_qtconcurrentrun.moc"