diff options
author | Gael Guennebaud <g.gael@free.fr> | 2018-07-17 15:52:58 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2018-07-17 15:52:58 +0200 |
commit | dff3a92d527fd38c28152ab9259af1904a01f248 (patch) | |
tree | 6184304dd437e20e4d7ad3481b27e3a2e9be3fb0 /test/nullary.cpp | |
parent | 82f0ce27261df3b21037d93d4595655b3df754a6 (diff) |
Remove usage of #if EIGEN_TEST_PART_XX in unit tests that does not require them (splitting can thus be avoided for them)
Diffstat (limited to 'test/nullary.cpp')
-rw-r--r-- | test/nullary.cpp | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/test/nullary.cpp b/test/nullary.cpp index 9e6e6eaa0..12b9e122f 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -239,45 +239,28 @@ void testMatrixType(const MatrixType& m) VERIFY_IS_APPROX( A(i,j), s1 ); } -EIGEN_DECLARE_TEST(nullary) +template<int> +void bug79() { - CALL_SUBTEST_1( testMatrixType(Matrix2d()) ); - CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random<int>(1,300),internal::random<int>(1,300))) ); - CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random<int>(1,300),internal::random<int>(1,300))) ); - - for(int i = 0; i < g_repeat*10; i++) { - CALL_SUBTEST_4( testVectorType(VectorXd(internal::random<int>(1,30000))) ); - CALL_SUBTEST_5( testVectorType(Vector4d()) ); // regression test for bug 232 - CALL_SUBTEST_6( testVectorType(Vector3d()) ); - CALL_SUBTEST_7( testVectorType(VectorXf(internal::random<int>(1,30000))) ); - CALL_SUBTEST_8( testVectorType(Vector3f()) ); - CALL_SUBTEST_8( testVectorType(Vector4f()) ); - CALL_SUBTEST_8( testVectorType(Matrix<float,8,1>()) ); - CALL_SUBTEST_8( testVectorType(Matrix<float,1,1>()) ); - - CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(1,10))) ); - CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(9,300))) ); - CALL_SUBTEST_9( testVectorType(Matrix<int,1,1>()) ); - } - -#ifdef EIGEN_TEST_PART_6 // Assignment of a RowVectorXd to a MatrixXd (regression test for bug #79). VERIFY( (MatrixXd(RowVectorXd::LinSpaced(3, 0, 1)) - RowVector3d(0, 0.5, 1)).norm() < std::numeric_limits<double>::epsilon() ); -#endif +} -#ifdef EIGEN_TEST_PART_9 +template<int> +void nullary_overflow() +{ // Check possible overflow issue - { - int n = 60000; - ArrayXi a1(n), a2(n); - a1.setLinSpaced(n, 0, n-1); - for(int i=0; i<n; ++i) - a2(i) = i; - VERIFY_IS_APPROX(a1,a2); - } -#endif + int n = 60000; + ArrayXi a1(n), a2(n); + a1.setLinSpaced(n, 0, n-1); + for(int i=0; i<n; ++i) + a2(i) = i; + VERIFY_IS_APPROX(a1,a2); +} -#ifdef EIGEN_TEST_PART_10 +template<int> +void nullary_internal_logic() +{ // check some internal logic VERIFY(( internal::has_nullary_operator<internal::scalar_constant_op<double> >::value )); VERIFY(( !internal::has_unary_operator<internal::scalar_constant_op<double> >::value )); @@ -318,5 +301,30 @@ EIGEN_DECLARE_TEST(nullary) VERIFY(( !internal::has_binary_operator<internal::linspaced_op<int,int> >::value )); VERIFY(( internal::functor_has_linear_access<internal::linspaced_op<int,int> >::ret )); } -#endif +} + +EIGEN_DECLARE_TEST(nullary) +{ + CALL_SUBTEST_1( testMatrixType(Matrix2d()) ); + CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random<int>(1,300),internal::random<int>(1,300))) ); + CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random<int>(1,300),internal::random<int>(1,300))) ); + + for(int i = 0; i < g_repeat*10; i++) { + CALL_SUBTEST_4( testVectorType(VectorXd(internal::random<int>(1,30000))) ); + CALL_SUBTEST_5( testVectorType(Vector4d()) ); // regression test for bug 232 + CALL_SUBTEST_6( testVectorType(Vector3d()) ); + CALL_SUBTEST_7( testVectorType(VectorXf(internal::random<int>(1,30000))) ); + CALL_SUBTEST_8( testVectorType(Vector3f()) ); + CALL_SUBTEST_8( testVectorType(Vector4f()) ); + CALL_SUBTEST_8( testVectorType(Matrix<float,8,1>()) ); + CALL_SUBTEST_8( testVectorType(Matrix<float,1,1>()) ); + + CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(1,10))) ); + CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(9,300))) ); + CALL_SUBTEST_9( testVectorType(Matrix<int,1,1>()) ); + } + + CALL_SUBTEST_6( bug79<0>() ); + CALL_SUBTEST_9( nullary_overflow<0>() ); + CALL_SUBTEST_10( nullary_internal_logic<0>() ); } |