aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2017-02-19 10:32:54 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2017-02-19 10:32:54 +0100
commitdeefa54a5419cc197bc43a04df1187f140da1efe (patch)
treec048f2f19155a650a60361b7b029ff8d927cde11 /test/main.h
parentf8a55cc062a3cba8230e621e0d5e855418a2d5e9 (diff)
Fix tracking of temporaries in unit tests
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/main.h b/test/main.h
index 1d5bdc1c4..25d2dcf43 100644
--- a/test/main.h
+++ b/test/main.h
@@ -41,6 +41,7 @@
#include <complex>
#include <deque>
#include <queue>
+#include <cassert>
#include <list>
#if __cplusplus >= 201103L
#include <random>
@@ -79,10 +80,12 @@
#ifdef TEST_ENABLE_TEMPORARY_TRACKING
static long int nb_temporaries;
+static long int nb_temporaries_on_assert = -1;
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++;
+ if(nb_temporaries_on_assert>0) assert(nb_temporaries<nb_temporaries_on_assert);
}
#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }