From c6c6c3490949fcdf68c7fd347a91728d7c5f6c96 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 7 Mar 2011 16:41:59 +0100 Subject: [PATCH] repeat nullary tests, and fix some tests --- test/nullary.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/test/nullary.cpp b/test/nullary.cpp index cc842203e..dd42cb898 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -65,22 +65,22 @@ void testVectorType(const VectorType& base) for (int i=0; i::epsilon()*10e3 ); + VERIFY_IS_APPROX(m,n); // random access version m = VectorType::LinSpaced(size,low,high); - VERIFY( (m-n).norm() < std::numeric_limits::epsilon()*10e3 ); + VERIFY_IS_APPROX(m,n); // 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::epsilon() ); // These guys sometimes fail! This is not good. Any ideas how to fix them!? - //VERIFY( m(m.size()-1) == high ); - //VERIFY( m(0) == low ); +// VERIFY( m(m.size()-1) == high ); +// VERIFY( m(0) == low ); // sequential access version m = VectorType::LinSpaced(Sequential,size,low,high); - VERIFY( (m-n).norm() < std::numeric_limits::epsilon()*10e3 ); + VERIFY_IS_APPROX(m,n); // These guys sometimes fail! This is not good. Any ideas how to fix them!? //VERIFY( m(m.size()-1) == high ); @@ -114,12 +114,15 @@ void testMatrixType(const MatrixType& m) void test_nullary() { CALL_SUBTEST_1( testMatrixType(Matrix2d()) ); - CALL_SUBTEST_2( testMatrixType(MatrixXcf(50,50)) ); - CALL_SUBTEST_3( testMatrixType(MatrixXf(5,7)) ); - CALL_SUBTEST_4( testVectorType(VectorXd(51)) ); - CALL_SUBTEST_5( testVectorType(VectorXd(41)) ); - CALL_SUBTEST_6( testVectorType(Vector3d()) ); - CALL_SUBTEST_7( testVectorType(VectorXf(51)) ); - CALL_SUBTEST_8( testVectorType(VectorXf(41)) ); - CALL_SUBTEST_9( testVectorType(Vector3f()) ); + CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random(1,300),internal::random(1,300))) ); + CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random(1,300),internal::random(1,300))) ); + + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST_4( testVectorType(VectorXd(internal::random(1,300))) ); + CALL_SUBTEST_5( testVectorType(VectorXd(internal::random(1,300))) ); + CALL_SUBTEST_6( testVectorType(Vector3d()) ); + CALL_SUBTEST_7( testVectorType(VectorXf(internal::random(1,300))) ); + CALL_SUBTEST_8( testVectorType(VectorXf(internal::random(1,300))) ); + CALL_SUBTEST_9( testVectorType(Vector3f()) ); + } }