mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-02-17 18:09:55 +08:00
Add failtests for Ref<SparseMatrix>
This commit is contained in:
parent
3af29caae8
commit
554aa9b31d
@ -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
18
failtest/sparse_ref_1.cpp
Normal 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
15
failtest/sparse_ref_2.cpp
Normal 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
15
failtest/sparse_ref_3.cpp
Normal 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
15
failtest/sparse_ref_4.cpp
Normal 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
16
failtest/sparse_ref_5.cpp
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user