update of the testing framework:

replaced the QTestLib framework my custom macros
and a (optional) custom script to run the tests from ctest.
This commit is contained in:
Gael Guennebaud
2008-05-22 12:18:55 +00:00
parent c6789a279c
commit 522e24f2d7
17 changed files with 393 additions and 374 deletions

View File

@@ -5,12 +5,12 @@
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -18,14 +18,12 @@
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
#include "main.h"
namespace Eigen {
template<typename MatrixType> void miscMatrices(const MatrixType& m)
{
/* this test covers the following files:
@@ -37,7 +35,7 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
int rows = m.rows();
int cols = m.cols();
int r = ei_random<int>(0, rows-1), r2 = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1);
VERIFY_IS_APPROX(MatrixType::ones(rows,cols)(r,c), static_cast<Scalar>(1));
MatrixType m1 = MatrixType::ones(rows,cols);
@@ -53,15 +51,13 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
VERIFY_IS_APPROX(square, MatrixType::identity(rows, rows));
}
void EigenTest::testMiscMatrices()
void test_miscmatrices()
{
for(int i = 0; i < m_repeat; i++) {
miscMatrices(Matrix<float, 1, 1>());
miscMatrices(Matrix4d());
miscMatrices(MatrixXcf(3, 3));
miscMatrices(MatrixXi(8, 12));
miscMatrices(MatrixXcd(20, 20));
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( miscMatrices(Matrix<float, 1, 1>()) );
CALL_SUBTEST( miscMatrices(Matrix4d()) );
CALL_SUBTEST( miscMatrices(MatrixXcf(3, 3)) );
CALL_SUBTEST( miscMatrices(MatrixXi(8, 12)) );
CALL_SUBTEST( miscMatrices(MatrixXcd(20, 20)) );
}
}
} // namespace Eigen