swift
Loading...
Searching...
No Matches
test.h File Reference

Go to the source code of this file.

Macros

#define SWIFTTEST_INIT(TestObject)
 Implements a main() function that executes all tests in TestObject without instantiating a QApplication object. Also adds arguments automatically to print test results to an xml file.
#define SWIFTTEST_APPLESS_MAIN(TestObject)
 Implements a main() function that executes all tests in TestObject without instantiating a QApplication object. Also adds arguments automatically to print test results to an xml file.
#define SWIFTTEST_MAIN(TestObject)
 Implements a main() function that executes all tests in TestObject including instantiating a QCoreApplication object. Also adds arguments automatically to print test results to an xml file.

Macro Definition Documentation

◆ SWIFTTEST_APPLESS_MAIN

#define SWIFTTEST_APPLESS_MAIN ( TestObject)
Value:
int main(int argc, char *argv[]) \
{ \
try \
{ \
SWIFTTEST_INIT(TestObject) \
return QTest::qExec(&to, args); \
} \
catch (...) \
{ \
return EXIT_FAILURE; \
} \
} \
static_assert(true)
int qExec(QObject *testObject, const QStringList &arguments)

Implements a main() function that executes all tests in TestObject without instantiating a QApplication object. Also adds arguments automatically to print test results to an xml file.

Definition at line 39 of file test.h.

◆ SWIFTTEST_INIT

#define SWIFTTEST_INIT ( TestObject)
Value:
TestObject to; \
QTEST_SET_MAIN_SOURCE_PATH \
\
QStringList args; \
args.reserve(argc); \
for (int i = 0; i < argc; ++i) \
{ \
args.append(argv[i]); \
} \
\
/* Output to stdout */ \
args.append({ "-o", "-,txt" }); \
\
/* Output to file */ \
QString resultsFileName = QString(#TestObject).replace("::", "_").toLower(); \
args.append({ "-o", resultsFileName + "_testresults.xml,xml" });
void append(QList< T > &&value)
void reserve(qsizetype size)

Implements a main() function that executes all tests in TestObject without instantiating a QApplication object. Also adds arguments automatically to print test results to an xml file.

Definition at line 18 of file test.h.

◆ SWIFTTEST_MAIN

#define SWIFTTEST_MAIN ( TestObject)
Value:
int main(int argc, char *argv[]) \
{ \
try \
{ \
QCoreApplication app(argc, argv); \
SWIFTTEST_INIT(TestObject) \
return QTest::qExec(&to, args); \
} \
catch (...) \
{ \
return EXIT_FAILURE; \
} \
} \
static_assert(true)

Implements a main() function that executes all tests in TestObject including instantiating a QCoreApplication object. Also adds arguments automatically to print test results to an xml file.

Definition at line 57 of file test.h.