mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 16:49:38 +08:00
add more failtests
This commit is contained in:
parent
7ea6ac79a3
commit
80500b693c
@ -17,12 +17,20 @@ ei_add_failtest("map_nonconst_ctor_on_const_ptr_0")
|
|||||||
ei_add_failtest("map_nonconst_ctor_on_const_ptr_1")
|
ei_add_failtest("map_nonconst_ctor_on_const_ptr_1")
|
||||||
ei_add_failtest("map_nonconst_ctor_on_const_ptr_2")
|
ei_add_failtest("map_nonconst_ctor_on_const_ptr_2")
|
||||||
ei_add_failtest("map_nonconst_ctor_on_const_ptr_3")
|
ei_add_failtest("map_nonconst_ctor_on_const_ptr_3")
|
||||||
|
ei_add_failtest("map_nonconst_ctor_on_const_ptr_4")
|
||||||
|
|
||||||
|
ei_add_failtest("map_on_const_type_actually_const_0")
|
||||||
|
ei_add_failtest("map_on_const_type_actually_const_1")
|
||||||
|
ei_add_failtest("block_on_const_type_actually_const_0")
|
||||||
|
ei_add_failtest("block_on_const_type_actually_const_1")
|
||||||
|
ei_add_failtest("transpose_on_const_type_actually_const")
|
||||||
|
ei_add_failtest("diagonal_on_const_type_actually_const")
|
||||||
|
|
||||||
if (EIGEN_FAILTEST_FAILURE_COUNT)
|
if (EIGEN_FAILTEST_FAILURE_COUNT)
|
||||||
message(FATAL_ERROR "${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
|
message(FATAL_ERROR
|
||||||
"Failtests succeed when they generate build errors. "
|
"${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
|
||||||
"To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}.")
|
"To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}, "
|
||||||
|
"with and without #define EIGEN_SHOULD_FAIL_TO_BUILD.")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")
|
message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
|
16
failtest/block_on_const_type_actually_const_0.cpp
Normal file
16
failtest/block_on_const_type_actually_const_0.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(){
|
||||||
|
Matrix3f m;
|
||||||
|
Block<CV_QUALIFIER Matrix3f>(m, 0, 0, 3, 3).coeffRef(0, 0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
16
failtest/block_on_const_type_actually_const_1.cpp
Normal file
16
failtest/block_on_const_type_actually_const_1.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(){
|
||||||
|
MatrixXf m;
|
||||||
|
Block<CV_QUALIFIER MatrixXf, 3, 3>(m, 0, 0).coeffRef(0, 0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
16
failtest/diagonal_on_const_type_actually_const.cpp
Normal file
16
failtest/diagonal_on_const_type_actually_const.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(){
|
||||||
|
MatrixXf m;
|
||||||
|
Diagonal<CV_QUALIFIER MatrixXf>(m).coeffRef(0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
15
failtest/map_nonconst_ctor_on_const_ptr_4.cpp
Normal file
15
failtest/map_nonconst_ctor_on_const_ptr_4.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(const float *ptr, DenseIndex rows, DenseIndex cols){
|
||||||
|
Map<CV_QUALIFIER MatrixXf, Unaligned, OuterStride<> > m(ptr, rows, cols, OuterStride<>(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
15
failtest/map_on_const_type_actually_const_0.cpp
Normal file
15
failtest/map_on_const_type_actually_const_0.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(float *ptr){
|
||||||
|
Map<CV_QUALIFIER MatrixXf>(ptr, 1, 1).coeffRef(0,0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
15
failtest/map_on_const_type_actually_const_1.cpp
Normal file
15
failtest/map_on_const_type_actually_const_1.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(float *ptr){
|
||||||
|
Map<CV_QUALIFIER Vector3f>(ptr).coeffRef(0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
16
failtest/transpose_on_const_type_actually_const.cpp
Normal file
16
failtest/transpose_on_const_type_actually_const.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include "../Eigen/Core"
|
||||||
|
|
||||||
|
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||||
|
#define CV_QUALIFIER const
|
||||||
|
#else
|
||||||
|
#define CV_QUALIFIER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace Eigen;
|
||||||
|
|
||||||
|
void foo(){
|
||||||
|
MatrixXf m;
|
||||||
|
Transpose<CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {}
|
Loading…
x
Reference in New Issue
Block a user