From 5f178e54e9341c2c1d558b7755c71d59277c02a4 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 14 Jun 2013 10:52:19 +0200 Subject: [PATCH] Extend sparse-block unit test to explicitly cover bug #584 --- test/sparse_basic.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index f2f14b2c7..e300f2537 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -308,6 +308,17 @@ template void sparse_basic(const SparseMatrixType& re else VERIFY_IS_APPROX(m2.block(0,j0,rows,n0)+m2.block(0,j1,rows,n0), refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0)); + + int i = internal::random(0,m2.outerSize()-1); + if(SparseMatrixType::IsRowMajor) { + m2.innerVector(i) = m2.innerVector(i) * s1; + refMat2.row(i) = refMat2.row(i) * s1; + VERIFY_IS_APPROX(m2,refMat2); + } else { + m2.innerVector(i) = m2.innerVector(i) * s1; + refMat2.col(i) = refMat2.col(i) * s1; + VERIFY_IS_APPROX(m2,refMat2); + } } // test prune