aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-07-12 16:40:02 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-07-12 16:40:02 +0200
commit7ee378d89da93d2556ba000f59783c4c0e32e9a0 (patch)
tree4223aa456491464498382673b47edda0b5891fe9 /test
parent61c3f55362969ca20d88120f0ca226d3c23668d8 (diff)
Fix various scalar type conversion warnings.
Diffstat (limited to 'test')
-rw-r--r--test/geo_quaternion.cpp4
-rw-r--r--test/sizeof.cpp2
-rw-r--r--test/sparse.h4
-rw-r--r--test/sparse_basic.cpp16
4 files changed, 13 insertions, 13 deletions
diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp
index e011879a5..1694b32c7 100644
--- a/test/geo_quaternion.cpp
+++ b/test/geo_quaternion.cpp
@@ -32,7 +32,7 @@ template<typename QuatType> void check_slerp(const QuatType& q0, const QuatType&
Scalar theta_tot = AA(q1*q0.inverse()).angle();
if(theta_tot>M_PI)
theta_tot = Scalar(2.*M_PI)-theta_tot;
- for(Scalar t=0; t<=1.001; t+=0.1)
+ for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1))
{
QuatType q = q0.slerp(t,q1);
Scalar theta = AA(q*q0.inverse()).angle();
@@ -156,7 +156,7 @@ template<typename Scalar, int Options> void quaternion(void)
check_slerp(q1,q2);
q1 = AngleAxisx(b, v1.normalized());
- q2 = AngleAxisx(b+M_PI, v1.normalized());
+ q2 = AngleAxisx(b+Scalar(M_PI), v1.normalized());
check_slerp(q1,q2);
q1 = AngleAxisx(b, v1.normalized());
diff --git a/test/sizeof.cpp b/test/sizeof.cpp
index c454780a6..d9ad35620 100644
--- a/test/sizeof.cpp
+++ b/test/sizeof.cpp
@@ -13,7 +13,7 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
{
typedef typename MatrixType::Scalar Scalar;
if (MatrixType::RowsAtCompileTime!=Dynamic && MatrixType::ColsAtCompileTime!=Dynamic)
- VERIFY(sizeof(MatrixType)==sizeof(Scalar)*std::ptrdiff_t(MatrixType::SizeAtCompileTime));
+ VERIFY(std::ptrdiff_t(sizeof(MatrixType))==std::ptrdiff_t(sizeof(Scalar))*std::ptrdiff_t(MatrixType::SizeAtCompileTime));
else
VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));
}
diff --git a/test/sparse.h b/test/sparse.h
index 1a5ceb38d..a09c65e5f 100644
--- a/test/sparse.h
+++ b/test/sparse.h
@@ -66,10 +66,10 @@ initSparse(double density,
//sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));
sparseMat.reserve(VectorXi::Constant(IsRowMajor ? refMat.rows() : refMat.cols(), int((1.5*density)*(IsRowMajor?refMat.cols():refMat.rows()))));
- for(int j=0; j<sparseMat.outerSize(); j++)
+ for(Index j=0; j<sparseMat.outerSize(); j++)
{
//sparseMat.startVec(j);
- for(int i=0; i<sparseMat.innerSize(); i++)
+ for(Index i=0; i<sparseMat.innerSize(); i++)
{
int ai(i), aj(j);
if(IsRowMajor)
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index d466b51da..498ecfe29 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -449,12 +449,12 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// test conservative resize
{
- std::vector< std::pair<int,int> > inc;
- inc.push_back(std::pair<int,int>(-3,-2));
- inc.push_back(std::pair<int,int>(0,0));
- inc.push_back(std::pair<int,int>(3,2));
- inc.push_back(std::pair<int,int>(3,0));
- inc.push_back(std::pair<int,int>(0,3));
+ std::vector< std::pair<Index,Index> > inc;
+ inc.push_back(std::pair<Index,Index>(-3,-2));
+ inc.push_back(std::pair<Index,Index>(0,0));
+ inc.push_back(std::pair<Index,Index>(3,2));
+ inc.push_back(std::pair<Index,Index>(3,0));
+ inc.push_back(std::pair<Index,Index>(0,3));
for(size_t i = 0; i< inc.size(); i++) {
Index incRows = inc[i].first;
@@ -472,9 +472,9 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// Insert new values
if (incRows > 0)
- m1.insert(refMat1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1;
+ m1.insert(m1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1;
if (incCols > 0)
- m1.insert(0, refMat1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1;
+ m1.insert(0, m1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1;
VERIFY_IS_APPROX(m1, refMat1);