From 6cbf662f14d8fd0606d9e9c6f7052e5dcc52b2ae Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 19 Nov 2009 22:01:13 -0500 Subject: * don't laugh, but these bugs took me forever to fix. * expand unit tests to make sure to catch them: they nearly escaped the existing tests as these memory violations were highly dependent on the numbers of rows and cols. --- test/triangular.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'test/triangular.cpp') diff --git a/test/triangular.cpp b/test/triangular.cpp index 379f586c4..c9df13274 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -188,6 +188,7 @@ template void triangular_rect(const MatrixType& m) m3 = 3 * m2; VERIFY_IS_APPROX(m3.template triangularView().toDenseMatrix(), m1); + m1.setZero(); m1.template triangularView() = 3 * m2; VERIFY_IS_APPROX(m3.template triangularView().toDenseMatrix(), m1); @@ -196,10 +197,10 @@ template void triangular_rect(const MatrixType& m) m1.template triangularView() = 3 * m2; VERIFY_IS_APPROX(m3.template triangularView().toDenseMatrix(), m1); + m1.setZero(); m1.template triangularView() = 3 * m2; VERIFY_IS_APPROX(m3.template triangularView().toDenseMatrix(), m1); - m1.setRandom(); m2 = m1.template triangularView(); VERIFY(m2.isUpperTriangular()); @@ -234,24 +235,20 @@ void test_triangular() { for(int i = 0; i < g_repeat ; i++) { - -#ifdef EIGEN_TEST_PART_7 - int r = ei_random(2,20); - int c = ei_random(2,20); -#endif + EIGEN_UNUSED int r = ei_random(2,20); + EIGEN_UNUSED int c = ei_random(2,20); CALL_SUBTEST_1( triangular_square(Matrix()) ); CALL_SUBTEST_2( triangular_square(Matrix()) ); CALL_SUBTEST_3( triangular_square(Matrix3d()) ); - CALL_SUBTEST_4( triangular_square(MatrixXcf(4, 4)) ); - CALL_SUBTEST_5( triangular_square(Matrix,8, 8>()) ); - CALL_SUBTEST_6( triangular_square(MatrixXcd(17,17)) ); - CALL_SUBTEST_7( triangular_square(Matrix(r, r)) ); - - CALL_SUBTEST_8( triangular_rect(Matrix()) ); - CALL_SUBTEST_9( triangular_rect(Matrix()) ); - CALL_SUBTEST_4( triangular_rect(MatrixXcf(4, 10)) ); - CALL_SUBTEST_6( triangular_rect(MatrixXcd(11, 3)) ); - CALL_SUBTEST_7( triangular_rect(Matrix(r, c)) ); + CALL_SUBTEST_4( triangular_square(Matrix,8, 8>()) ); + CALL_SUBTEST_5( triangular_square(MatrixXcd(r,r)) ); + CALL_SUBTEST_6( triangular_square(Matrix(r, r)) ); + + CALL_SUBTEST_7( triangular_rect(Matrix()) ); + CALL_SUBTEST_8( triangular_rect(Matrix()) ); + CALL_SUBTEST_9( triangular_rect(MatrixXcf(r, c)) ); + CALL_SUBTEST_5( triangular_rect(MatrixXcd(r, c)) ); + CALL_SUBTEST_6( triangular_rect(Matrix(r, c)) ); } } -- cgit v1.2.3