aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/ref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ref.cpp')
-rw-r--r--test/ref.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/ref.cpp b/test/ref.cpp
index 250135bdb..c0b6ffdcf 100644
--- a/test/ref.cpp
+++ b/test/ref.cpp
@@ -102,10 +102,14 @@ template<typename VectorType> void ref_vector(const VectorType& m)
Index i = internal::random<Index>(0,size-1);
Index bsize = internal::random<Index>(1,size-i);
- RefMat rm0 = v1;
- VERIFY_IS_EQUAL(rm0, v1);
- RefDynMat rv1 = v1;
- VERIFY_IS_EQUAL(rv1, v1);
+ { RefMat rm0 = v1; VERIFY_IS_EQUAL(rm0, v1); }
+ { RefMat rm0 = v1.block(0,0,size,1); VERIFY_IS_EQUAL(rm0, v1); }
+ { RefDynMat rv1 = v1; VERIFY_IS_EQUAL(rv1, v1); }
+ { RefDynMat rv1 = v1.block(0,0,size,1); VERIFY_IS_EQUAL(rv1, v1); }
+ { VERIFY_RAISES_ASSERT( RefMat rm0 = v1.block(0, 0, size, 0); EIGEN_UNUSED_VARIABLE(rm0); ); }
+ if(VectorType::SizeAtCompileTime!=1)
+ { VERIFY_RAISES_ASSERT( RefDynMat rv1 = v1.block(0, 0, size, 0); EIGEN_UNUSED_VARIABLE(rv1); ); }
+
RefDynMat rv2 = v1.segment(i,bsize);
VERIFY_IS_EQUAL(rv2, v1.segment(i,bsize));
rv2.setOnes();