mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Factorize VERIFY_EVALUATION_COUNT in unit tests
This commit is contained in:
17
test/ref.cpp
17
test/ref.cpp
@@ -12,25 +12,10 @@
|
||||
#undef EIGEN_DEFAULT_TO_ROW_MAJOR
|
||||
#endif
|
||||
|
||||
static long int nb_temporaries;
|
||||
|
||||
inline void on_temporary_creation(long int) {
|
||||
// here's a great place to set a breakpoint when debugging failures in this test!
|
||||
nb_temporaries++;
|
||||
}
|
||||
|
||||
#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }
|
||||
#define TEST_ENABLE_TEMPORARY_TRACKING
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#define VERIFY_EVALUATION_COUNT(XPR,N) {\
|
||||
nb_temporaries = 0; \
|
||||
XPR; \
|
||||
if(nb_temporaries!=N) std::cerr << "nb_temporaries == " << nb_temporaries << "\n"; \
|
||||
VERIFY( (#XPR) && nb_temporaries==N ); \
|
||||
}
|
||||
|
||||
|
||||
// test Ref.h
|
||||
|
||||
template<typename MatrixType> void ref_matrix(const MatrixType& m)
|
||||
|
||||
Reference in New Issue
Block a user