mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Remove usage of #if EIGEN_TEST_PART_XX in unit tests that does not require them (splitting can thus be avoided for them)
This commit is contained in:
@@ -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>() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user