diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-10-09 13:29:39 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-10-09 13:29:39 +0200 |
commit | 321cb56bf67c05fa94a518805e2f9be263902f28 (patch) | |
tree | 9830b842f8735dbe1dc88be9e7c7363840749a72 /test/redux.cpp | |
parent | 2632b3446cf687e9e3feff2850d53f7928837474 (diff) |
Add unit test to check nesting of complex expressions in redux()
Diffstat (limited to 'test/redux.cpp')
-rw-r--r-- | test/redux.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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<typename MatrixType> void matrixRedux(const MatrixType& m) @@ -57,6 +59,11 @@ template<typename MatrixType> 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<typename VectorType> void vectorRedux(const VectorType& w) |