let eigen2 tests use the same ei_add_test macro, which required to prefix them with eigen2_ ; rename buildtests_eigen2 to eigen2_buildtests, etc.

This commit is contained in:
Benoit Jacob 2011-01-25 08:37:18 -05:00
parent dcfb58f529
commit 8acd43bbdb
47 changed files with 102 additions and 172 deletions

View File

@ -12,7 +12,11 @@ macro(ei_add_test_internal testname testname_with_suffix)
set(filename ${testname}.cpp)
add_executable(${targetname} ${filename})
add_dependencies(buildtests ${targetname})
if (targetname MATCHES "^eigen2_")
add_dependencies(eigen2_buildtests ${targetname})
else()
add_dependencies(buildtests ${targetname})
endif()
if(EIGEN_NO_ASSERTION_CHECKING)
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")

View File

@ -1,132 +1,58 @@
add_custom_target(buildtests_eigen2)
add_custom_target(check_eigen2 COMMAND "ctest")
add_dependencies(check_eigen2 buildtests_eigen2)
add_custom_target(eigen2_buildtests)
add_custom_target(eigen2_check COMMAND "ctest -R eigen2")
add_dependencies(eigen2_check eigen2_buildtests)
add_dependencies(buildtests eigen2_buildtests)
add_definitions("-DEIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API")
# Macro to add a test
#
# the unique parameter testname must correspond to a file
# <testname>.cpp which follows this pattern:
#
# #include "main.h"
# void test_<testname>() { ... }
#
# this macro add an executable test_<testname> as well as a ctest test
# named <testname>
#
# On platforms with bash simply run:
# "ctest -V" or "ctest -V -R <testname>"
# On other platform use ctest as usual
#
macro(ei_add_test_eigen2 testname)
set(targetname test_eigen2_${testname})
set(filename ${testname}.cpp)
add_executable(${targetname} ${filename})
add_dependencies(buildtests_eigen2 ${targetname})
if(NOT EIGEN_NO_ASSERTION_CHECKING)
if(MSVC)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "/EHsc")
else(MSVC)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-fexceptions")
endif(MSVC)
option(EIGEN_DEBUG_ASSERTS "Enable debuging of assertions" OFF)
if(EIGEN_DEBUG_ASSERTS)
set_target_properties(${targetname} PROPERTIES COMPILE_DEFINITIONS "EIGEN_DEBUG_ASSERTS=1")
endif(EIGEN_DEBUG_ASSERTS)
endif(NOT EIGEN_NO_ASSERTION_CHECKING)
if(${ARGC} GREATER 1)
ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV1}")
endif(${ARGC} GREATER 1)
ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")
if(TEST_LIB)
target_link_libraries(${targetname} Eigen2)
endif(TEST_LIB)
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
target_link_libraries(${targetname} ${EXTERNAL_LIBS})
if(${ARGC} GREATER 2)
string(STRIP "${ARGV2}" ARGV2_stripped)
string(LENGTH "${ARGV2_stripped}" ARGV2_stripped_length)
if(${ARGV2_stripped_length} GREATER 0)
target_link_libraries(${targetname} ${ARGV2})
endif(${ARGV2_stripped_length} GREATER 0)
endif(${ARGC} GREATER 2)
if(WIN32)
add_test(${testname} "${targetname}")
else(WIN32)
add_test(${testname} "${CMAKE_CURRENT_SOURCE_DIR}/runtest.sh" "${testname}")
endif(WIN32)
endmacro(ei_add_test_eigen2)
enable_testing()
if(TEST_LIB)
add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1")
endif(TEST_LIB)
ei_add_test_eigen2(meta)
ei_add_test_eigen2(sizeof)
ei_add_test_eigen2(dynalloc)
ei_add_test_eigen2(nomalloc)
ei_add_test_eigen2(first_aligned)
ei_add_test_eigen2(mixingtypes)
ei_add_test_eigen2(packetmath)
ei_add_test_eigen2(unalignedassert)
#ei_add_test_eigen2(vectorization_logic)
ei_add_test_eigen2(basicstuff)
ei_add_test_eigen2(linearstructure)
ei_add_test_eigen2(cwiseop)
ei_add_test_eigen2(sum)
ei_add_test_eigen2(product_small)
ei_add_test_eigen2(product_large ${EI_OFLAG})
ei_add_test_eigen2(adjoint)
ei_add_test_eigen2(submatrices)
ei_add_test_eigen2(miscmatrices)
ei_add_test_eigen2(commainitializer)
ei_add_test_eigen2(smallvectors)
ei_add_test_eigen2(map)
ei_add_test_eigen2(array)
ei_add_test_eigen2(triangular)
ei_add_test_eigen2(cholesky " " "${GSL_LIBRARIES}")
ei_add_test_eigen2(lu ${EI_OFLAG})
ei_add_test_eigen2(determinant ${EI_OFLAG})
ei_add_test_eigen2(inverse)
ei_add_test_eigen2(qr)
ei_add_test_eigen2(eigensolver " " "${GSL_LIBRARIES}")
ei_add_test_eigen2(svd)
ei_add_test_eigen2(geometry)
ei_add_test_eigen2(hyperplane)
ei_add_test_eigen2(parametrizedline)
ei_add_test_eigen2(alignedbox)
ei_add_test_eigen2(regression)
ei_add_test_eigen2(stdvector)
ei_add_test_eigen2(newstdvector)
ei_add_test(eigen2_meta)
ei_add_test(eigen2_sizeof)
ei_add_test(eigen2_dynalloc)
ei_add_test(eigen2_nomalloc)
ei_add_test(eigen2_first_aligned)
ei_add_test(eigen2_mixingtypes)
ei_add_test(eigen2_packetmath)
ei_add_test(eigen2_unalignedassert)
#ei_add_test(eigen2_vectorization_logic)
ei_add_test(eigen2_basicstuff)
ei_add_test(eigen2_linearstructure)
ei_add_test(eigen2_cwiseop)
ei_add_test(eigen2_sum)
ei_add_test(eigen2_product_small)
ei_add_test(eigen2_product_large ${EI_OFLAG})
ei_add_test(eigen2_adjoint)
ei_add_test(eigen2_submatrices)
ei_add_test(eigen2_miscmatrices)
ei_add_test(eigen2_commainitializer)
ei_add_test(eigen2_smallvectors)
ei_add_test(eigen2_map)
ei_add_test(eigen2_array)
ei_add_test(eigen2_triangular)
ei_add_test(eigen2_cholesky " " "${GSL_LIBRARIES}")
ei_add_test(eigen2_lu ${EI_OFLAG})
ei_add_test(eigen2_determinant ${EI_OFLAG})
ei_add_test(eigen2_inverse)
ei_add_test(eigen2_qr)
ei_add_test(eigen2_eigensolver " " "${GSL_LIBRARIES}")
ei_add_test(eigen2_svd)
ei_add_test(eigen2_geometry)
ei_add_test(eigen2_hyperplane)
ei_add_test(eigen2_parametrizedline)
ei_add_test(eigen2_alignedbox)
ei_add_test(eigen2_regression)
ei_add_test(eigen2_stdvector)
ei_add_test(eigen2_newstdvector)
if(QT4_FOUND)
ei_add_test_eigen2(qtvector " " "${QT_QTCORE_LIBRARY}")
ei_add_test(eigen2_qtvector " " "${QT_QTCORE_LIBRARY}")
endif(QT4_FOUND)
if(NOT EIGEN_DEFAULT_TO_ROW_MAJOR)
ei_add_test_eigen2(sparse_vector)
ei_add_test_eigen2(sparse_basic)
ei_add_test_eigen2(sparse_solvers " " "${SPARSE_LIBS}")
ei_add_test_eigen2(sparse_product)
ei_add_test(eigen2_sparse_vector)
ei_add_test(eigen2_sparse_basic)
ei_add_test(eigen2_sparse_solvers " " "${SPARSE_LIBS}")
ei_add_test(eigen2_sparse_product)
endif()
ei_add_test_eigen2(swap)
ei_add_test_eigen2(visitor)
ei_add_test_eigen2(bug_132)
ei_add_test(eigen2_swap)
ei_add_test(eigen2_visitor)
ei_add_test(eigen2_bug_132)
ei_add_test_eigen2(prec_inverse_4x4 ${EI_OFLAG})
ei_add_test(eigen2_prec_inverse_4x4 ${EI_OFLAG})

View File

@ -100,7 +100,7 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
}
void test_adjoint()
void test_eigen2_adjoint()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( adjoint(Matrix<float, 1, 1>()) );

View File

@ -65,7 +65,7 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),b0);
}
void test_alignedbox()
void test_eigen2_alignedbox()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( alignedbox(AlignedBox<float,2>()) );

View File

@ -129,7 +129,7 @@ template<typename VectorType> void lpNorm(const VectorType& v)
VERIFY_IS_APPROX(ei_pow(u.template lpNorm<5>(), typename VectorType::RealScalar(5)), u.cwise().abs().cwise().pow(5).sum());
}
void test_array()
void test_eigen2_array()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( array(Matrix<float, 1, 1>()) );

View File

@ -109,7 +109,7 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
}
}
void test_basicstuff()
void test_eigen2_basicstuff()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( basicStuff(Matrix<float, 1, 1>()) );

View File

@ -24,7 +24,7 @@
#include "main.h"
void test_bug_132() {
void test_eigen2_bug_132() {
enum { size = 100 };
MatrixXd A(size, size);
VectorXd b(size), c(size);

View File

@ -113,7 +113,7 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
#endif
}
void test_cholesky()
void test_eigen2_cholesky()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( cholesky(Matrix<double,1,1>()) );

View File

@ -24,7 +24,7 @@
#include "main.h"
void test_commainitializer()
void test_eigen2_commainitializer()
{
Matrix3d m3;
Matrix4d m4;

View File

@ -160,7 +160,7 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
VERIFY( !(m1.cwise()>m1.unaryExpr(bind2nd(plus<Scalar>(), Scalar(1)))).any() );
}
void test_cwiseop()
void test_eigen2_cwiseop()
{
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST( cwiseops(Matrix<float, 1, 1>()) );

View File

@ -62,7 +62,7 @@ template<typename MatrixType> void determinant(const MatrixType& m)
VERIFY_IS_APPROX(m2.determinant(), m1.determinant() * x);
}
void test_determinant()
void test_eigen2_determinant()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( determinant(Matrix<float, 1, 1>()) );

View File

@ -102,7 +102,7 @@ template<typename T> void check_dynaligned()
delete obj;
}
void test_dynalloc()
void test_eigen2_dynalloc()
{
// low level dynamic memory allocation
CALL_SUBTEST(check_handmade_aligned_malloc());

View File

@ -145,7 +145,7 @@ template<typename MatrixType> void eigensolver(const MatrixType& m)
}
void test_eigensolver()
void test_eigen2_eigensolver()
{
for(int i = 0; i < g_repeat; i++) {
// very important to test a 3x3 matrix since we provide a special path for it

View File

@ -25,21 +25,21 @@
#include "main.h"
template<typename Scalar>
void test_first_aligned_helper(Scalar *array, int size)
void test_eigen2_first_aligned_helper(Scalar *array, int size)
{
const int packet_size = sizeof(Scalar) * ei_packet_traits<Scalar>::size;
VERIFY(((std::size_t(array) + sizeof(Scalar) * ei_alignmentOffset(array, size)) % packet_size) == 0);
}
template<typename Scalar>
void test_none_aligned_helper(Scalar *array, int size)
void test_eigen2_none_aligned_helper(Scalar *array, int size)
{
VERIFY(ei_packet_traits<Scalar>::size == 1 || ei_alignmentOffset(array, size) == size);
}
struct some_non_vectorizable_type { float x; };
void test_first_aligned()
void test_eigen2_first_aligned()
{
EIGEN_ALIGN_128 float array_float[100];
test_first_aligned_helper(array_float, 50);

View File

@ -437,7 +437,7 @@ template<typename Scalar> void geometry(void)
}
void test_geometry()
void test_eigen2_geometry()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( geometry<float>() );

View File

@ -128,7 +128,7 @@ template<typename Scalar> void lines()
}
}
void test_hyperplane()
void test_eigen2_hyperplane()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( hyperplane(Hyperplane<float,2>()) );

View File

@ -65,7 +65,7 @@ template<typename MatrixType> void inverse(const MatrixType& m)
VERIFY_IS_APPROX(m1.transpose().inverse(), m1.inverse().transpose());
}
void test_inverse()
void test_eigen2_inverse()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( inverse(Matrix<double,1,1>()) );

View File

@ -84,7 +84,7 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
VERIFY_IS_APPROX(m1.block(0,0,rows,cols) * s1, m1 * s1);
}
void test_linearstructure()
void test_eigen2_linearstructure()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( linearStructure(Matrix<float, 1, 1>()) );

View File

@ -120,7 +120,7 @@ template<typename MatrixType> void lu_invertible()
VERIFY(lu.solve(m3, &m2));
}
void test_lu()
void test_eigen2_lu()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( lu_non_invertible<MatrixXf>() );

View File

@ -105,7 +105,7 @@ template<typename VectorType> void map_static_methods(const VectorType& m)
}
void test_map()
void test_eigen2_map()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( map_class_vector(Matrix<float, 1, 1>()) );

View File

@ -24,7 +24,7 @@
#include "main.h"
void test_meta()
void test_eigen2_meta()
{
typedef float & FloatRef;
typedef const float & ConstFloatRef;

View File

@ -51,7 +51,7 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows));
}
void test_miscmatrices()
void test_eigen2_miscmatrices()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( miscMatrices(Matrix<float, 1, 1>()) );

View File

@ -79,7 +79,7 @@ template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)
VERIFY_RAISES_ASSERT(vcf.dot(vf)); // yeah eventually we should allow this but i'm too lazy to make that change now in Dot.h
} // especially as that might be rewritten as cwise product .sum() which would make that automatic.
void test_mixingtypes()
void test_eigen2_mixingtypes()
{
// check that our operator new is indeed called:
CALL_SUBTEST(mixingtypes<3>());

View File

@ -133,7 +133,7 @@ void check_stdvector_quaternion(const QuaternionType&)
}
}
void test_newstdvector()
void test_eigen2_newstdvector()
{
// some non vectorizable fixed sizes
CALL_SUBTEST(check_stdvector_matrix(Vector2f()));

View File

@ -68,7 +68,7 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
VERIFY_IS_APPROX((m1*m1.transpose())*m2, m1*(m1.transpose()*m2));
}
void test_nomalloc()
void test_eigen2_nomalloc()
{
// check that our operator new is indeed called:
VERIFY_RAISES_ASSERT(MatrixXd dummy = MatrixXd::Random(3,3));

View File

@ -136,7 +136,7 @@ template<typename Scalar> void packetmath()
VERIFY(areApprox(ref, data2, PacketSize) && "ei_preduxp");
}
void test_packetmath()
void test_eigen2_packetmath()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( packetmath<float>() );

View File

@ -66,7 +66,7 @@ template<typename LineType> void parametrizedline(const LineType& _line)
VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),l0);
}
void test_parametrizedline()
void test_eigen2_parametrizedline()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( parametrizedline(ParametrizedLine<float,2>()) );

View File

@ -86,7 +86,7 @@ template<typename MatrixType> void inverse_general_4x4(int repeat)
VERIFY(error_max < (NumTraits<Scalar>::IsComplex ? 64.0 : 20.0));
}
void test_prec_inverse_4x4()
void test_eigen2_prec_inverse_4x4()
{
CALL_SUBTEST((inverse_permutation_4x4<Matrix4f>()));
CALL_SUBTEST(( inverse_general_4x4<Matrix4f>(200000 * g_repeat) ));

View File

@ -24,7 +24,7 @@
#include "product.h"
void test_product_large()
void test_eigen2_product_large()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );

View File

@ -25,7 +25,7 @@
#define EIGEN_NO_STATIC_ASSERT
#include "product.h"
void test_product_small()
void test_eigen2_product_small()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( product(Matrix<float, 3, 2>()) );

View File

@ -57,7 +57,7 @@ template<typename MatrixType> void qr(const MatrixType& m)
VERIFY_IS_APPROX(b, hess.matrixQ() * hess.matrixH() * hess.matrixQ().adjoint());
}
void test_qr()
void test_eigen2_qr()
{
for(int i = 0; i < 1; i++) {
CALL_SUBTEST( qr(Matrix2f()) );

View File

@ -142,7 +142,7 @@ void check_qtvector_quaternion(const QuaternionType&)
}
}
void test_qtvector()
void test_eigen2_qtvector()
{
// some non vectorizable fixed sizes
CALL_SUBTEST(check_qtvector_matrix(Vector2f()));

View File

@ -91,7 +91,7 @@ void check_fitHyperplane(int numPoints,
VERIFY(ei_abs(error) < ei_abs(tolerance));
}
void test_regression()
void test_eigen2_regression()
{
for(int i = 0; i < g_repeat; i++)
{

View File

@ -33,7 +33,7 @@ template<typename MatrixType> void verifySizeOf(const MatrixType&)
VERIFY(sizeof(MatrixType)==sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));
}
void test_sizeof()
void test_eigen2_sizeof()
{
CALL_SUBTEST( verifySizeOf(Matrix<float, 1, 1>()) );
CALL_SUBTEST( verifySizeOf(Matrix4d()) );

View File

@ -47,7 +47,7 @@ template<typename Scalar> void smallVectors()
VERIFY_IS_APPROX(x4, v4.w());
}
void test_smallvectors()
void test_eigen2_smallvectors()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( smallVectors<int>() );

View File

@ -320,7 +320,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
}
}
void test_sparse_basic()
void test_eigen2_sparse_basic()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( sparse_basic(SparseMatrix<double>(8, 8)) );

View File

@ -118,7 +118,7 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType&
}
void test_sparse_product()
void test_eigen2_sparse_product()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( sparse_product(SparseMatrix<double>(8, 8)) );

View File

@ -205,7 +205,7 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
}
void test_sparse_solvers()
void test_eigen2_sparse_solvers()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( sparse_solvers<double>(8, 8) );

View File

@ -88,7 +88,7 @@ template<typename Scalar> void sparse_vector(int rows, int cols)
}
void test_sparse_vector()
void test_eigen2_sparse_vector()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( sparse_vector<double>(8, 8) );

View File

@ -132,7 +132,7 @@ void check_stdvector_quaternion(const QuaternionType&)
}
}
void test_stdvector()
void test_eigen2_stdvector()
{
// some non vectorizable fixed sizes
CALL_SUBTEST(check_stdvector_matrix(Vector2f()));

View File

@ -150,7 +150,7 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
VERIFY(ei_real(ones.row(r1).dot(ones.row(r2))) == RealScalar(cols));
}
void test_submatrices()
void test_eigen2_submatrices()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( submatrices(Matrix<float, 1, 1>()) );

View File

@ -68,7 +68,7 @@ template<typename VectorType> void vectorSum(const VectorType& w)
}
}
void test_sum()
void test_eigen2_sum()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( matrixSum(Matrix<float, 1, 1>()) );

View File

@ -85,7 +85,7 @@ template<typename MatrixType> void svd(const MatrixType& m)
}
}
void test_svd()
void test_eigen2_svd()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( svd(Matrix3f()) );

View File

@ -89,7 +89,7 @@ template<typename MatrixType> void swap(const MatrixType& m)
VERIFY_RAISES_ASSERT(m1.row(0).swap(m1));
}
void test_swap()
void test_eigen2_swap()
{
CALL_SUBTEST( swap(Matrix3f()) ); // fixed size, no vectorization
CALL_SUBTEST( swap(Matrix4d()) ); // fixed size, possible vectorization

View File

@ -124,7 +124,7 @@ template<typename MatrixType> void triangular(const MatrixType& m)
}
void test_triangular()
void test_eigen2_triangular()
{
for(int i = 0; i < g_repeat ; i++) {
CALL_SUBTEST( triangular(Matrix<float, 1, 1>()) );

View File

@ -125,7 +125,7 @@ void unalignedassert()
#endif
}
void test_unalignedassert()
void test_eigen2_unalignedassert()
{
CALL_SUBTEST(unalignedassert());
}

View File

@ -112,7 +112,7 @@ template<typename VectorType> void vectorVisitor(const VectorType& w)
VERIFY_IS_APPROX(maxc, v.maxCoeff());
}
void test_visitor()
void test_eigen2_visitor()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST( matrixVisitor(Matrix<float, 1, 1>()) );