Skip to content
Snippets Groups Projects
Commit a45a5756 authored by Don Gagne's avatar Don Gagne
Browse files

AutoTest runner is now part of main

parent 0526d3be
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCCore.h"
#include "MainWindow.h"
#include "configuration.h"
#include "AutoTest.h"
/* SDL does ugly things to main() */
#ifdef main
......@@ -68,6 +68,28 @@ int main(int argc, char *argv[])
#ifdef Q_OS_WIN
qInstallMsgHandler( msgHandler );
#endif
#ifdef QT_DEBUG
if (argc > 1 && QString(argv[1]).compare("--unittest", Qt::CaseInsensitive) == 0) {
// Strip off extra command line args so QTest doesn't complain
for (int i=1; i<argc-1; i++)
{
argv[i] = argv[i+1];
}
// Run the test
int failures = AutoTest::run(argc-1, argv);
if (failures == 0)
{
qDebug() << "ALL TESTS PASSED";
}
else
{
qDebug() << failures << " TESTS FAILED!";
}
return failures;
}
#endif
QGCCore* core = NULL;
int val;
......
/**
* @author Rob Caldecott
* @note This was obtained from http://qtcreator.blogspot.com/2010/04/sample-multiple-unit-test-project.html
*
*/
#include "AutoTest.h"
#include <QDebug>
#if 1
// This is all you need to run all the tests
TEST_MAIN
#else
// Or supply your own main function
int main(int argc, char *argv[])
{
int failures = AutoTest::run(argc, argv);
if (failures == 0)
{
qDebug() << "ALL TESTS PASSED";
}
else
{
qDebug() << failures << " TESTS FAILED!";
}
return failures;
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment