From d5e81d866a2bf2d81050d68ec3f8dc9e4879ee5b Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Thu, 27 Jan 2011 16:37:06 +0100 Subject: [PATCH] Added regression tests for bug #148. --- test/array_for_matrix.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index b7671ccda..9e1865e3d 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp @@ -30,7 +30,7 @@ template void array_for_matrix(const MatrixType& m) typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; typedef Matrix ColVectorType; - typedef Matrix RowVectorType; + typedef Matrix RowVectorType; Index rows = m.rows(); Index cols = m.cols(); @@ -76,6 +76,14 @@ template void array_for_matrix(const MatrixType& m) // empty objects VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().sum(), RowVectorType::Zero(cols)); VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().prod(), ColVectorType::Ones(rows)); + + // verify the const accessors exist + const Scalar& ref_m1 = m.matrix().array().coeffRef(0); + const Scalar& ref_m2 = m.matrix().array().coeffRef(0,0); + const Scalar& ref_a1 = m.array().matrix().coeffRef(0); + const Scalar& ref_a2 = m.array().matrix().coeffRef(0,0); + VERIFY(&ref_a1 == &ref_m1); + VERIFY(&ref_a2 == &ref_m2); } template void comparisons(const MatrixType& m)