diff options
author | Gael Guennebaud <g.gael@free.fr> | 2017-08-22 16:48:07 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2017-08-22 16:48:07 +0200 |
commit | 9deee79922c38415125e4d6c2cd34cd05bda7889 (patch) | |
tree | da1abdf71c944400bad9abff3ce49cd0669ad66c /test | |
parent | bc4dae9aeb84cc3d3114ee496d55654cc7256584 (diff) |
bug #1457: add setUnit() methods for consistency.
Diffstat (limited to 'test')
-rw-r--r-- | test/nullary.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/nullary.cpp b/test/nullary.cpp index acd55506e..22ec92352 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -191,6 +191,24 @@ void testVectorType(const VectorType& base) } } } + + // test setUnit() + if(m.size()>0) + { + for(Index k=0; k<10; ++k) + { + Index i = internal::random<Index>(0,m.size()-1); + m.setUnit(i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(), i) ); + } + if(VectorType::SizeAtCompileTime==Dynamic) + { + Index i = internal::random<Index>(0,2*m.size()-1); + m.setUnit(2*m.size(),i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(),i) ); + } + } + } template<typename MatrixType> |