fix unit tests for integer types in preparation for next changeset making random<int> span over a much bigger range

This commit is contained in:
Benoit Jacob 2011-02-07 10:54:50 -05:00
parent 68a2e04a96
commit 3386a946f8
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ template<typename MatrixType> 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<Scalar>::IsInteger)
VERIFY_IS_APPROX(v1.squaredNorm(), v1.norm() * v1.norm());
VERIFY_IS_MUCH_SMALLER_THAN(internal::abs(vzero.dot(v1)), static_cast<RealScalar>(1));

View File

@ -50,7 +50,8 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
vzero = VectorType::Zero(rows);
SquareMatrixType sm1 = SquareMatrixType::Random(rows,rows), sm2(rows,rows);
Scalar x = internal::random<Scalar>();
Scalar x = 0;
while(x == Scalar(0)) x = internal::random<Scalar>();
Index r = internal::random<Index>(0, rows-1),
c = internal::random<Index>(0, cols-1);