aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/main.h b/test/main.h
index 04c6722a4..ef471acc8 100644
--- a/test/main.h
+++ b/test/main.h
@@ -69,6 +69,26 @@
// shuts down ICC's remark #593: variable "XXX" was set but never used
#define TEST_SET_BUT_UNUSED_VARIABLE(X) EIGEN_UNUSED_VARIABLE(X)
+#ifdef TEST_ENABLE_TEMPORARY_TRACKING
+
+static long int nb_temporaries;
+
+inline void on_temporary_creation(long int size) {
+ // here's a great place to set a breakpoint when debugging failures in this test!
+ if(size!=0) nb_temporaries++;
+}
+
+#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }
+
+#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 ); \
+ }
+
+#endif
+
// the following file is automatically generated by cmake
#include "split_test_helper.h"