Fix overflow and make use of long long in c++11 only.

This commit is contained in:
Gael Guennebaud 2017-02-13 17:14:04 +01:00
parent 3453b00a1e
commit 7073430946

View File

@ -50,17 +50,20 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
VERIFY_IS_APPROX(x, v1[r]);
// test fetching with various index types.
x = v1(static_cast<char>(r));
x = v1(static_cast<signed char>(r));
x = v1(static_cast<unsigned char>(r));
x = v1(static_cast<signed short>(r));
x = v1(static_cast<unsigned short>(r));
x = v1(static_cast<signed int>(r));
x = v1(static_cast<unsigned int>(r));
x = v1(static_cast<signed long>(r));
x = v1(static_cast<unsigned long>(r));
x = v1(static_cast<long long int>(r));
x = v1(static_cast<unsigned long long int>(r));
Index r1 = internal::random<Index>(0, numext::mini(Index(127),rows-1));
x = v1(static_cast<char>(r1));
x = v1(static_cast<signed char>(r1));
x = v1(static_cast<unsigned char>(r1));
x = v1(static_cast<signed short>(r1));
x = v1(static_cast<unsigned short>(r1));
x = v1(static_cast<signed int>(r1));
x = v1(static_cast<unsigned int>(r1));
x = v1(static_cast<signed long>(r1));
x = v1(static_cast<unsigned long>(r1));
#if EIGEN_HAS_CXX11
x = v1(static_cast<long long int>(r1));
x = v1(static_cast<unsigned long long int>(r1));
#endif
VERIFY_IS_APPROX( v1, v1);
VERIFY_IS_NOT_APPROX( v1, 2*v1);