From 9deee79922c38415125e4d6c2cd34cd05bda7889 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 22 Aug 2017 16:48:07 +0200 Subject: bug #1457: add setUnit() methods for consistency. --- test/nullary.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/nullary.cpp') 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(0,m.size()-1); + m.setUnit(i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(), i) ); + } + if(VectorType::SizeAtCompileTime==Dynamic) + { + Index i = internal::random(0,2*m.size()-1); + m.setUnit(2*m.size(),i); + VERIFY_IS_APPROX( m, VectorType::Unit(m.size(),i) ); + } + } + } template -- cgit v1.2.3