From 3386a946f8d061fc89e813b64761055fa9bb4647 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 7 Feb 2011 10:54:50 -0500 Subject: [PATCH] fix unit tests for integer types in preparation for next changeset making random span over a much bigger range --- test/adjoint.cpp | 2 +- test/basicstuff.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/adjoint.cpp b/test/adjoint.cpp index 47889591f..bed409191 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -71,7 +71,7 @@ template void adjoint(const MatrixType& m) VERIFY(internal::isApprox((s1 * v1 + s2 * v2).dot(v3), internal::conj(s1) * v1.dot(v3) + internal::conj(s2) * v2.dot(v3), largerEps)); VERIFY(internal::isApprox(v3.dot(s1 * v1 + s2 * v2), s1*v3.dot(v1)+s2*v3.dot(v2), largerEps)); VERIFY_IS_APPROX(internal::conj(v1.dot(v2)), v2.dot(v1)); - VERIFY_IS_APPROX(internal::abs(v1.dot(v1)), v1.squaredNorm()); + VERIFY_IS_APPROX(internal::real(v1.dot(v1)), v1.squaredNorm()); if(!NumTraits::IsInteger) VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm()); VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(vzero.dot(v1)), static_cast(1)); diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 767098341..9f3966818 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -50,7 +50,8 @@ template void basicStuff(const MatrixType& m) vzero = VectorType::Zero(rows); SquareMatrixType sm1 = SquareMatrixType::Random(rows,rows), sm2(rows,rows); - Scalar x = internal::random(); + Scalar x = 0; + while(x == Scalar(0)) x = internal::random(); Index r = internal::random(0, rows-1), c = internal::random(0, cols-1);