Browse Source

AutoTest runner is now part of main

QGC4.4
Don Gagne 12 years ago
parent
commit
a45a5756f1
  1. 24
      src/main.cc
  2. 28
      src/qgcunittest/testSuite.cc

24
src/main.cc

@ -32,7 +32,7 @@ This file is part of the QGROUNDCONTROL project @@ -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[]) @@ -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;

28
src/qgcunittest/testSuite.cc

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
/**
* @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
Loading…
Cancel
Save