aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/redux.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-07-12 14:41:00 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-07-12 14:41:00 +0200
commita8f66fec6591e11a20a9861bda244e15f969fda2 (patch)
tree79d30afad3cf953afe35e852e61b6a8729ddf832 /test/redux.cpp
parentbdb545ce3b294e28cd264c627ceaae42d26ea5f4 (diff)
add the possibility to configure the maximal matrix size in the unit tests
Diffstat (limited to 'test/redux.cpp')
-rw-r--r--test/redux.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/redux.cpp b/test/redux.cpp
index 57b4603c5..3e16797fd 100644
--- a/test/redux.cpp
+++ b/test/redux.cpp
@@ -139,6 +139,9 @@ template<typename VectorType> void vectorRedux(const VectorType& w)
void test_redux()
{
+ // the max size cannot be too large, otherwise reduxion operations obviously generate large errors.
+ int maxsize = std::min(100,EIGEN_TEST_MAX_SIZE);
+ EIGEN_UNUSED_VARIABLE(maxsize);
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
CALL_SUBTEST_1( matrixRedux(Array<float, 1, 1>()) );
@@ -146,19 +149,19 @@ void test_redux()
CALL_SUBTEST_2( matrixRedux(Array2f()) );
CALL_SUBTEST_3( matrixRedux(Matrix4d()) );
CALL_SUBTEST_3( matrixRedux(Array4d()) );
- CALL_SUBTEST_4( matrixRedux(MatrixXcf(3, 3)) );
- CALL_SUBTEST_4( matrixRedux(ArrayXXcf(3, 3)) );
- CALL_SUBTEST_5( matrixRedux(MatrixXd(8, 12)) );
- CALL_SUBTEST_5( matrixRedux(ArrayXXd(8, 12)) );
- CALL_SUBTEST_6( matrixRedux(MatrixXi(8, 12)) );
- CALL_SUBTEST_6( matrixRedux(ArrayXXi(8, 12)) );
+ CALL_SUBTEST_4( matrixRedux(MatrixXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_4( matrixRedux(ArrayXXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_5( matrixRedux(MatrixXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_5( matrixRedux(ArrayXXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_6( matrixRedux(MatrixXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_6( matrixRedux(ArrayXXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_7( vectorRedux(Vector4f()) );
CALL_SUBTEST_7( vectorRedux(Array4f()) );
- CALL_SUBTEST_5( vectorRedux(VectorXd(10)) );
- CALL_SUBTEST_5( vectorRedux(ArrayXd(10)) );
- CALL_SUBTEST_8( vectorRedux(VectorXf(33)) );
- CALL_SUBTEST_8( vectorRedux(ArrayXf(33)) );
+ CALL_SUBTEST_5( vectorRedux(VectorXd(internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_5( vectorRedux(ArrayXd(internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_8( vectorRedux(VectorXf(internal::random<int>(1,maxsize))) );
+ CALL_SUBTEST_8( vectorRedux(ArrayXf(internal::random<int>(1,maxsize))) );
}
}