mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-14 10:23:14 +08:00
bug #1672: fix unit test compilation with MSVC by adding overloads of test_is* for long long (and factorize copy/paste code through a macro)
This commit is contained in:
parent
c9825b967e
commit
53560f9186
62
test/main.h
62
test/main.h
@ -407,42 +407,29 @@ template<> inline float test_precision<std::complex<float> >() { return test_pre
|
|||||||
template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }
|
template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }
|
||||||
template<> inline long double test_precision<std::complex<long double> >() { return test_precision<long double>(); }
|
template<> inline long double test_precision<std::complex<long double> >() { return test_precision<long double>(); }
|
||||||
|
|
||||||
inline bool test_isApprox(const short& a, const short& b)
|
#define EIGEN_TEST_SCALAR_TEST_OVERLOAD(TYPE) \
|
||||||
{ return internal::isApprox(a, b, test_precision<short>()); }
|
inline bool test_isApprox(TYPE a, TYPE b) \
|
||||||
inline bool test_isApprox(const unsigned short& a, const unsigned short& b)
|
{ return internal::isApprox(a, b, test_precision<TYPE>()); } \
|
||||||
{ return internal::isApprox(a, b, test_precision<unsigned short>()); }
|
inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \
|
||||||
inline bool test_isApprox(const unsigned int& a, const unsigned int& b)
|
{ return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \
|
||||||
{ return internal::isApprox(a, b, test_precision<unsigned int>()); }
|
inline bool test_isApproxOrLessThan(TYPE a, TYPE b) \
|
||||||
inline bool test_isApprox(const unsigned long& a, const unsigned long& b)
|
{ return internal::isApproxOrLessThan(a, b, test_precision<TYPE>()); }
|
||||||
{ return internal::isApprox(a, b, test_precision<unsigned long>()); }
|
|
||||||
|
|
||||||
inline bool test_isApprox(const int& a, const int& b)
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(short)
|
||||||
{ return internal::isApprox(a, b, test_precision<int>()); }
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned short)
|
||||||
inline bool test_isMuchSmallerThan(const int& a, const int& b)
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(int)
|
||||||
{ return internal::isMuchSmallerThan(a, b, test_precision<int>()); }
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned int)
|
||||||
inline bool test_isApproxOrLessThan(const int& a, const int& b)
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(long)
|
||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<int>()); }
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long)
|
||||||
|
#if EIGEN_HAS_CXX11
|
||||||
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(long long)
|
||||||
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(unsigned long long)
|
||||||
|
#endif
|
||||||
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(float)
|
||||||
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(double)
|
||||||
|
EIGEN_TEST_SCALAR_TEST_OVERLOAD(half)
|
||||||
|
|
||||||
inline bool test_isApprox(const long& a, const long& b)
|
#undef EIGEN_TEST_SCALAR_TEST_OVERLOAD
|
||||||
{ return internal::isApprox(a, b, test_precision<long>()); }
|
|
||||||
inline bool test_isMuchSmallerThan(const long& a, const long b)
|
|
||||||
{ return internal::isMuchSmallerThan(a, b, test_precision<long>()); }
|
|
||||||
inline bool test_isApproxOrLessThan(const long& a, const long& b)
|
|
||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<long>()); }
|
|
||||||
|
|
||||||
inline bool test_isApprox(const float& a, const float& b)
|
|
||||||
{ return internal::isApprox(a, b, test_precision<float>()); }
|
|
||||||
inline bool test_isMuchSmallerThan(const float& a, const float& b)
|
|
||||||
{ return internal::isMuchSmallerThan(a, b, test_precision<float>()); }
|
|
||||||
inline bool test_isApproxOrLessThan(const float& a, const float& b)
|
|
||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<float>()); }
|
|
||||||
|
|
||||||
inline bool test_isApprox(const double& a, const double& b)
|
|
||||||
{ return internal::isApprox(a, b, test_precision<double>()); }
|
|
||||||
inline bool test_isMuchSmallerThan(const double& a, const double& b)
|
|
||||||
{ return internal::isMuchSmallerThan(a, b, test_precision<double>()); }
|
|
||||||
inline bool test_isApproxOrLessThan(const double& a, const double& b)
|
|
||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<double>()); }
|
|
||||||
|
|
||||||
#ifndef EIGEN_TEST_NO_COMPLEX
|
#ifndef EIGEN_TEST_NO_COMPLEX
|
||||||
inline bool test_isApprox(const std::complex<float>& a, const std::complex<float>& b)
|
inline bool test_isApprox(const std::complex<float>& a, const std::complex<float>& b)
|
||||||
@ -479,13 +466,6 @@ inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
|
|||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }
|
{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }
|
||||||
#endif // EIGEN_TEST_NO_LONGDOUBLE
|
#endif // EIGEN_TEST_NO_LONGDOUBLE
|
||||||
|
|
||||||
inline bool test_isApprox(const half& a, const half& b)
|
|
||||||
{ return internal::isApprox(a, b, test_precision<half>()); }
|
|
||||||
inline bool test_isMuchSmallerThan(const half& a, const half& b)
|
|
||||||
{ return internal::isMuchSmallerThan(a, b, test_precision<half>()); }
|
|
||||||
inline bool test_isApproxOrLessThan(const half& a, const half& b)
|
|
||||||
{ return internal::isApproxOrLessThan(a, b, test_precision<half>()); }
|
|
||||||
|
|
||||||
// test_relative_error returns the relative difference between a and b as a real scalar as used in isApprox.
|
// test_relative_error returns the relative difference between a and b as a real scalar as used in isApprox.
|
||||||
template<typename T1,typename T2>
|
template<typename T1,typename T2>
|
||||||
typename NumTraits<typename T1::RealScalar>::NonInteger test_relative_error(const EigenBase<T1> &a, const EigenBase<T2> &b)
|
typename NumTraits<typename T1::RealScalar>::NonInteger test_relative_error(const EigenBase<T1> &a, const EigenBase<T2> &b)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user