From 321cb56bf67c05fa94a518805e2f9be263902f28 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 9 Oct 2015 13:29:39 +0200 Subject: Add unit test to check nesting of complex expressions in redux() --- test/redux.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/redux.cpp') diff --git a/test/redux.cpp b/test/redux.cpp index 0d176e500..f3e7cc2a7 100644 --- a/test/redux.cpp +++ b/test/redux.cpp @@ -7,6 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +#define TEST_ENABLE_TEMPORARY_TRACKING + #include "main.h" template void matrixRedux(const MatrixType& m) @@ -57,6 +59,11 @@ template void matrixRedux(const MatrixType& m) // test empty objects VERIFY_IS_APPROX(m1.block(r0,c0,0,0).sum(), Scalar(0)); VERIFY_IS_APPROX(m1.block(r0,c0,0,0).prod(), Scalar(1)); + + // test nesting complex expression + VERIFY_EVALUATION_COUNT( (m1.matrix()*m1.matrix().transpose()).sum(), (MatrixType::SizeAtCompileTime==Dynamic ? 1 : 0) ); + VERIFY_EVALUATION_COUNT( ((m1.matrix()*m1.matrix().transpose())*Scalar(2)).sum(), (MatrixType::SizeAtCompileTime==Dynamic ? 1 : 0) ); + } template void vectorRedux(const VectorType& w) -- cgit v1.2.3