mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: clang format line length
This commit is contained in:
83
tests/test.h
83
tests/test.h
@@ -15,59 +15,56 @@
|
||||
//! 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_INIT(TestObject) \
|
||||
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(); \
|
||||
#define SWIFTTEST_INIT(TestObject) \
|
||||
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" });
|
||||
|
||||
//! 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) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
try \
|
||||
{ \
|
||||
SWIFTTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
} \
|
||||
catch (...) \
|
||||
{ \
|
||||
return EXIT_FAILURE; \
|
||||
} \
|
||||
} \
|
||||
#define SWIFTTEST_APPLESS_MAIN(TestObject) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
try \
|
||||
{ \
|
||||
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.
|
||||
#define SWIFTTEST_MAIN(TestObject) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
try \
|
||||
{ \
|
||||
QCoreApplication app(argc, argv); \
|
||||
SWIFTTEST_INIT(TestObject) \
|
||||
return QTest::qExec(&to, args); \
|
||||
} \
|
||||
catch (...) \
|
||||
{ \
|
||||
return EXIT_FAILURE; \
|
||||
} \
|
||||
} \
|
||||
#define SWIFTTEST_MAIN(TestObject) \
|
||||
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)
|
||||
|
||||
//! \endcond
|
||||
|
||||
Reference in New Issue
Block a user