Add failtests for Ref<SparseMatrix>

This commit is contained in:
Gael Guennebaud 2015-02-09 10:24:07 +01:00
parent 3af29caae8
commit 554aa9b31d
6 changed files with 85 additions and 0 deletions

View File

@ -41,6 +41,12 @@ ei_add_failtest("ref_5")
ei_add_failtest("swap_1")
ei_add_failtest("swap_2")
ei_add_failtest("sparse_ref_1")
ei_add_failtest("sparse_ref_2")
ei_add_failtest("sparse_ref_3")
ei_add_failtest("sparse_ref_4")
ei_add_failtest("sparse_ref_5")
if (EIGEN_FAILTEST_FAILURE_COUNT)
message(FATAL_ERROR
"${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "

18
failtest/sparse_ref_1.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "../Eigen/Sparse"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define CV_QUALIFIER const
#else
#define CV_QUALIFIER
#endif
using namespace Eigen;
void call_ref(Ref<SparseMatrix<float> > a) { }
int main()
{
SparseMatrix<float> a(10,10);
CV_QUALIFIER SparseMatrix<float>& ac(a);
call_ref(ac);
}

15
failtest/sparse_ref_2.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "../Eigen/Sparse"
using namespace Eigen;
void call_ref(Ref<SparseMatrix<float> > a) { }
int main()
{
SparseMatrix<float> A(10,10);
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
call_ref(A.row(3));
#else
call_ref(A.col(3));
#endif
}

15
failtest/sparse_ref_3.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "../Eigen/Sparse"
using namespace Eigen;
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
void call_ref(Ref<SparseMatrix<float> > a) { }
#else
void call_ref(const Ref<const SparseMatrix<float> > &a) { }
#endif
int main()
{
SparseMatrix<float> a(10,10);
call_ref(a+a);
}

15
failtest/sparse_ref_4.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "../Eigen/Sparse"
using namespace Eigen;
void call_ref(Ref<SparseMatrix<float> > a) {}
int main()
{
SparseMatrix<float> A(10,10);
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
call_ref(A.transpose());
#else
call_ref(A);
#endif
}

16
failtest/sparse_ref_5.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "../Eigen/Sparse"
using namespace Eigen;
void call_ref(Ref<SparseMatrix<float> > a) { }
int main()
{
SparseMatrix<float> a(10,10);
SparseMatrixBase<SparseMatrix<float> > &ac(a);
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
call_ref(ac);
#else
call_ref(ac.derived());
#endif
}