Fix compiler warnings in tests.

This commit is contained in:
Rasmus Munk Larsen
2023-02-14 02:29:03 +00:00
parent 4a03409569
commit 07aaa62e6f
4 changed files with 44 additions and 41 deletions

View File

@@ -251,9 +251,9 @@ void mixed_pow_test() {
unary_pow_test<double, long long>();
// The following cases will test promoting a wider exponent type
// to a narrower base type. This should compile but generate a
// to a narrower base type. This should compile but would generate a
// deprecation warning:
unary_pow_test<float, double>();
// unary_pow_test<float, double>();
}
void int_pow_test() {

View File

@@ -43,11 +43,11 @@ void check_inf_nan(bool dryrun) {
}
else
{
if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(3)) ); g_test_level=0;
if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0;
if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( (numext::isnan)(m(3)) ); g_test_level=0;
if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0;
if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0;
if( (std::isfinite)(m(3))) { g_test_level=1; VERIFY( !(numext::isfinite)(m(3)) ); g_test_level=0; }
if( (std::isinf) (m(3))) { g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; }
if(!(std::isnan) (m(3))) { g_test_level=1; VERIFY( (numext::isnan)(m(3)) ); g_test_level=0; }
if( (std::isfinite)(m(3))) { g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; }
if(!(std::isnan) (m(3))) { g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; }
}
T hidden_zero = (std::numeric_limits<T>::min)()*(std::numeric_limits<T>::min)();
m(4) /= hidden_zero;
@@ -62,11 +62,11 @@ void check_inf_nan(bool dryrun) {
}
else
{
if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !(numext::isfinite)(m(4)) ); g_test_level=0;
if(!(std::isinf) (m(3))) g_test_level=1; VERIFY( (numext::isinf)(m(4)) ); g_test_level=0;
if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(4)) ); g_test_level=0;
if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0;
if(!(std::isnan) (m(3))) g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0;
if( (std::isfinite)(m(3))) { g_test_level=1; VERIFY( !(numext::isfinite)(m(4)) ); g_test_level=0; }
if(!(std::isinf) (m(3))) { g_test_level=1; VERIFY( (numext::isinf)(m(4)) ); g_test_level=0; }
if( (std::isnan) (m(3))) { g_test_level=1; VERIFY( !(numext::isnan)(m(4)) ); g_test_level=0; }
if( (std::isfinite)(m(3))) { g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; }
if(!(std::isnan) (m(3))) { g_test_level=1; VERIFY( m.hasNaN() ); g_test_level=0; }
}
m(3) = 0;
if(dryrun)
@@ -80,11 +80,11 @@ void check_inf_nan(bool dryrun) {
}
else
{
if(!(std::isfinite)(m(3))) g_test_level=1; VERIFY( (numext::isfinite)(m(3)) ); g_test_level=0;
if( (std::isinf) (m(3))) g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0;
if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !(numext::isnan)(m(3)) ); g_test_level=0;
if( (std::isfinite)(m(3))) g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0;
if( (std::isnan) (m(3))) g_test_level=1; VERIFY( !m.hasNaN() ); g_test_level=0;
if(!(std::isfinite)(m(3))) { g_test_level=1; VERIFY( (numext::isfinite)(m(3)) ); g_test_level=0; }
if( (std::isinf) (m(3))) { g_test_level=1; VERIFY( !(numext::isinf)(m(3)) ); g_test_level=0; }
if( (std::isnan) (m(3))) { g_test_level=1; VERIFY( !(numext::isnan)(m(3)) ); g_test_level=0; }
if( (std::isfinite)(m(3))) { g_test_level=1; VERIFY( !m.allFinite() ); g_test_level=0; }
if( (std::isnan) (m(3))) { g_test_level=1; VERIFY( !m.hasNaN() ); g_test_level=0; }
}
}

View File

@@ -164,7 +164,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// test sort
if (inner > 1) {
bool StorageOrdersMatch = DenseMatrix::IsRowMajor == SparseMatrixType::IsRowMajor;
bool StorageOrdersMatch = int(DenseMatrix::IsRowMajor) == int(SparseMatrixType::IsRowMajor);
DenseMatrix m1(rows, cols);
m1.setZero();
SparseMatrixType m2(rows, cols);