diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-02-05 18:57:29 -0500 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2011-02-05 18:57:29 -0500 |
commit | 9b13e9aeceffd56fb1560a8aef51079ae65f13c4 (patch) | |
tree | 15ae653c7db613570d8e3b9c40b2737cb04d70fd /failtest | |
parent | 8aee724274ea4d70f926c544cf57e706c61a3e82 (diff) |
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.
Diffstat (limited to 'failtest')
-rw-r--r-- | failtest/CMakeLists.txt | 17 | ||||
-rw-r--r-- | failtest/block_nonconst_ctor_on_const_xpr_0.cpp | 15 | ||||
-rw-r--r-- | failtest/block_nonconst_ctor_on_const_xpr_1.cpp | 15 | ||||
-rw-r--r-- | failtest/block_nonconst_ctor_on_const_xpr_2.cpp | 16 | ||||
-rw-r--r-- | failtest/diagonal_nonconst_ctor_on_const_xpr.cpp | 15 | ||||
-rw-r--r-- | failtest/failtest_sanity_check.cpp | 5 | ||||
-rw-r--r-- | failtest/transpose_nonconst_ctor_on_const_xpr.cpp | 15 |
7 files changed, 98 insertions, 0 deletions
diff --git a/failtest/CMakeLists.txt b/failtest/CMakeLists.txt new file mode 100644 index 000000000..424ce1795 --- /dev/null +++ b/failtest/CMakeLists.txt @@ -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() diff --git a/failtest/block_nonconst_ctor_on_const_xpr_0.cpp b/failtest/block_nonconst_ctor_on_const_xpr_0.cpp new file mode 100644 index 000000000..40b82014f --- /dev/null +++ b/failtest/block_nonconst_ctor_on_const_xpr_0.cpp @@ -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() {} diff --git a/failtest/block_nonconst_ctor_on_const_xpr_1.cpp b/failtest/block_nonconst_ctor_on_const_xpr_1.cpp new file mode 100644 index 000000000..ef6d53702 --- /dev/null +++ b/failtest/block_nonconst_ctor_on_const_xpr_1.cpp @@ -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() {} diff --git a/failtest/block_nonconst_ctor_on_const_xpr_2.cpp b/failtest/block_nonconst_ctor_on_const_xpr_2.cpp new file mode 100644 index 000000000..43f18aecf --- /dev/null +++ b/failtest/block_nonconst_ctor_on_const_xpr_2.cpp @@ -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() {} diff --git a/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp b/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 000000000..76398a2c2 --- /dev/null +++ b/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp @@ -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() {} diff --git a/failtest/failtest_sanity_check.cpp b/failtest/failtest_sanity_check.cpp new file mode 100644 index 000000000..769fa942d --- /dev/null +++ b/failtest/failtest_sanity_check.cpp @@ -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 diff --git a/failtest/transpose_nonconst_ctor_on_const_xpr.cpp b/failtest/transpose_nonconst_ctor_on_const_xpr.cpp new file mode 100644 index 000000000..4223e7fd7 --- /dev/null +++ b/failtest/transpose_nonconst_ctor_on_const_xpr.cpp @@ -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() {} |