13 #include <QSharedPointer>
25 template <
typename T>
char RegisterTest(QString name) {
26 if ( std::find_if( begin(m_tests), end(m_tests), [&name](QSharedPointer<QObject>& elem)
27 {
return elem->objectName() == name; }) == end(m_tests) ) {
28 QSharedPointer<QObject> test(
new T());
29 test->setObjectName(name);
30 m_tests.push_back(test);
38 std::list<QSharedPointer<QObject>> m_tests;
42 #define DECLARE_TEST(className)\
43 static char test_##className = TestRunner::Instance().RegisterTest<className>(QString(#className));
46 #define RUN_ALL_TESTS()\
47 TestRunner::Instance().RunAll();
49 #endif // TESTRUNNER_H
Definition: testrunner.h:20