mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
failtest: a new cmake-based test suite for testing stuff that should fail to build. This first batch imports some const correctness checks from bug #54.
This commit is contained in:
17
failtest/CMakeLists.txt
Normal file
17
failtest/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
message(STATUS "Running the failtests")
|
||||
|
||||
ei_add_failtest("failtest_sanity_check")
|
||||
ei_add_failtest("block_nonconst_ctor_on_const_xpr_0")
|
||||
ei_add_failtest("block_nonconst_ctor_on_const_xpr_1")
|
||||
ei_add_failtest("block_nonconst_ctor_on_const_xpr_2")
|
||||
ei_add_failtest("transpose_nonconst_ctor_on_const_xpr")
|
||||
ei_add_failtest("diagonal_nonconst_ctor_on_const_xpr")
|
||||
|
||||
if (EIGEN_FAILTEST_FAILURE_COUNT)
|
||||
message(FATAL_ERROR "${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "
|
||||
"Failtests succeed when they generate build errors. "
|
||||
"To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}.")
|
||||
else()
|
||||
message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
15
failtest/block_nonconst_ctor_on_const_xpr_0.cpp
Normal file
15
failtest/block_nonconst_ctor_on_const_xpr_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(CV_QUALIFIER Matrix3d &m){
|
||||
Block<Matrix3d,3,3> b(m,0,0);
|
||||
}
|
||||
|
||||
int main() {}
|
||||
15
failtest/block_nonconst_ctor_on_const_xpr_1.cpp
Normal file
15
failtest/block_nonconst_ctor_on_const_xpr_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(CV_QUALIFIER Matrix3d &m){
|
||||
Block<Matrix3d> b(m,0,0,3,3);
|
||||
}
|
||||
|
||||
int main() {}
|
||||
16
failtest/block_nonconst_ctor_on_const_xpr_2.cpp
Normal file
16
failtest/block_nonconst_ctor_on_const_xpr_2.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(CV_QUALIFIER Matrix3d &m){
|
||||
// row/column constructor
|
||||
Block<Matrix3d,3,1> b(m,0);
|
||||
}
|
||||
|
||||
int main() {}
|
||||
15
failtest/diagonal_nonconst_ctor_on_const_xpr.cpp
Normal file
15
failtest/diagonal_nonconst_ctor_on_const_xpr.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(CV_QUALIFIER Matrix3d &m){
|
||||
Diagonal<Matrix3d> d(m);
|
||||
}
|
||||
|
||||
int main() {}
|
||||
5
failtest/failtest_sanity_check.cpp
Normal file
5
failtest/failtest_sanity_check.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
|
||||
This is just some text that won't compile as a C++ file, as a basic sanity check for failtest.
|
||||
#else
|
||||
int main() {}
|
||||
#endif
|
||||
15
failtest/transpose_nonconst_ctor_on_const_xpr.cpp
Normal file
15
failtest/transpose_nonconst_ctor_on_const_xpr.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(CV_QUALIFIER Matrix3d &m){
|
||||
Transpose<Matrix3d> t(m);
|
||||
}
|
||||
|
||||
int main() {}
|
||||
Reference in New Issue
Block a user