aboutsummaryrefslogtreecommitdiff
path: root/test/ref.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/ref.cpp')
-rw-r--r--test/ref.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/test/ref.cpp b/test/ref.cpp
index 44bbd3bf1..769db0414 100644
--- a/test/ref.cpp
+++ b/test/ref.cpp
@@ -12,27 +12,23 @@
#undef EIGEN_DEFAULT_TO_ROW_MAJOR
#endif
-static int nb_temporaries;
-
-inline void on_temporary_creation(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
+// Deal with i387 extended precision
+#if EIGEN_ARCH_i386 && !(EIGEN_ARCH_x86_64)
-// test Ref.h
+#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(4,4)
+#pragma GCC optimize ("-ffloat-store")
+#else
+#undef VERIFY_IS_EQUAL
+#define VERIFY_IS_EQUAL(X,Y) VERIFY_IS_APPROX(X,Y)
+#endif
+
+#endif
template<typename MatrixType> void ref_matrix(const MatrixType& m)
{
@@ -71,7 +67,6 @@ template<typename MatrixType> void ref_matrix(const MatrixType& m)
rm2 = m2.block(i,j,brows,bcols);
VERIFY_IS_EQUAL(m1, m2);
-
ConstRefDynMat rm3 = m1.block(i,j,brows,bcols);
m1.block(i,j,brows,bcols) *= 2;
m2.block(i,j,brows,bcols) *= 2;
@@ -237,6 +232,12 @@ int test_ref_overload_fun1(Ref<MatrixXf> ) { return 3; }
int test_ref_overload_fun2(Ref<const MatrixXd> ) { return 4; }
int test_ref_overload_fun2(Ref<const MatrixXf> ) { return 5; }
+void test_ref_ambiguous(const Ref<const ArrayXd> &A, Ref<ArrayXd> B)
+{
+ B = A;
+ B = A - A;
+}
+
// See also bug 969
void test_ref_overloads()
{
@@ -249,6 +250,9 @@ void test_ref_overloads()
VERIFY( test_ref_overload_fun2(Ad)==4 );
VERIFY( test_ref_overload_fun2(Ad+Bd)==4 );
VERIFY( test_ref_overload_fun2(Af+Bf)==5 );
+
+ ArrayXd A, B;
+ test_ref_ambiguous(A, B);
}
void test_ref()