From b501e08d819ae84248a7e61b985cc47bb2d4d1aa Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 29 May 2008 03:37:16 +0000 Subject: [PATCH] now the unit-tests (hence all of Eigen) don't depend on Qt at all anymore. --- Eigen/src/Core/MatrixBase.h | 4 ++-- test/CMakeLists.txt | 5 ----- test/main.h | 36 ++++++++++++++++-------------------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 82d11f16e..e14ac5df2 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -364,8 +364,8 @@ template class MatrixBase DiagonalCoeffs diagonal(); const DiagonalCoeffs diagonal() const; - template Part part(); - template const Extract extract() const; + template Part part(); + template const Extract extract() const; //@} /// \name Generating special matrices diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 238006bdf..a363d301e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,16 +59,11 @@ MACRO(EI_ADD_TEST testname) ADD_TEST(${testname} "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${testname}") ENDIF(WIN32) - TARGET_LINK_LIBRARIES(${targetname} ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ) - ENDMACRO(EI_ADD_TEST) ENABLE_TESTING() -FIND_PACKAGE(Qt4 REQUIRED) -INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ) - EI_ADD_TEST(basicstuff) EI_ADD_TEST(linearstructure) EI_ADD_TEST(cwiseop) diff --git a/test/main.h b/test/main.h index afce02b45..3fff90b79 100644 --- a/test/main.h +++ b/test/main.h @@ -28,7 +28,6 @@ #include #include #include -#include #ifndef EIGEN_TEST_FUNC #error EIGEN_TEST_FUNC must be defined @@ -225,49 +224,46 @@ inline bool test_ei_isMuchSmallerThan(const MatrixBase& m, void EI_PP_CAT(test_,EIGEN_TEST_FUNC)(); using namespace Eigen; +using namespace std; int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); - bool has_set_repeat = false; bool has_set_seed = false; bool need_help = false; unsigned int seed = 0; int repeat = DEFAULT_REPEAT; - QStringList args = QCoreApplication::instance()->arguments(); - args.takeFirst(); // throw away the first argument (path to executable) - foreach(QString arg, args) + for(int i = 1; i < argc; i++) { - if(arg.startsWith("r")) + if(argv[i][0] == 'r') { if(has_set_repeat) { - qDebug() << "Argument" << arg << "conflicting with a former argument"; + cout << "Argument " << argv[i] << " conflicting with a former argument" << endl; return 1; } - repeat = arg.remove(0, 1).toInt(); + repeat = atoi(argv[i]+1); has_set_repeat = true; if(repeat <= 0) { - qDebug() << "Invalid \'repeat\' value" << arg; + cout << "Invalid \'repeat\' value " << argv[i]+1 << endl; return 1; } } - else if(arg.startsWith("s")) + else if(argv[i][0] == 's') { if(has_set_seed) { - qDebug() << "Argument" << arg << "conflicting with a former argument"; + cout << "Argument " << argv[i] << " conflicting with a former argument" << endl; return 1; } - bool ok; - seed = arg.remove(0, 1).toUInt(&ok); + seed = strtoul(argv[i]+1, 0, 10); has_set_seed = true; + bool ok = seed!=0; if(!ok) { - qDebug() << "Invalid \'seed\' value" << arg; + cout << "Invalid \'seed\' value " << argv[i]+1 << endl; return 1; } } @@ -279,18 +275,18 @@ int main(int argc, char *argv[]) if(need_help) { - qDebug() << "This test application takes the following optional arguments:"; - qDebug() << " rN Repeat each test N times (default:" << DEFAULT_REPEAT << ")"; - qDebug() << " sN Use N as seed for random numbers (default: based on current time)"; + cout << "This test application takes the following optional arguments:" << endl; + cout << " rN Repeat each test N times (default: " << DEFAULT_REPEAT << ")" << endl; + cout << " sN Use N as seed for random numbers (default: based on current time)" << endl; return 1; } if(!has_set_seed) seed = (unsigned int) time(NULL); if(!has_set_repeat) repeat = DEFAULT_REPEAT; - qDebug() << "Initializing random number generator with seed" << seed; + cout << "Initializing random number generator with seed " << seed << endl; srand(seed); - qDebug() << "Repeating each test" << repeat << "times"; + cout << "Repeating each test " << repeat << " times" << endl; Eigen::g_repeat = repeat; Eigen::g_test_stack.push_back(EI_PP_MAKE_STRING(EIGEN_TEST_FUNC));