aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-11-07 16:38:14 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-11-07 16:38:14 +0100
commit76c230a84d4857722e4a72e9007302a504af0fb7 (patch)
tree0565d86ff27ff165bab2e8b0b6c11876a6394bc1 /test
parent57327cc2d5aab1cc51dd1308bd0d000f2ccb623c (diff)
Add an option to test evaluators globally
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt7
-rw-r--r--test/main.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 5b9e92f01..04cb11d60 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -126,6 +126,13 @@ endif(TEST_LIB)
set_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT "Official")
add_custom_target(BuildOfficial)
+option(EIGEN_TEST_EVALUATORS "Enable work in progress evaluators" OFF)
+ add_definitions("-DEIGEN_TEST_EVALUATORS=1")
+ add_definitions("-DEIGEN_ENABLE_EVALUATORS=1")
+if(EIGEN_TEST_EVALUATORS)
+
+endif(EIGEN_TEST_EVALUATORS)
+
ei_add_test(meta)
ei_add_test(sizeof)
ei_add_test(dynalloc)
diff --git a/test/main.h b/test/main.h
index c889fa6c5..9dd8bc535 100644
--- a/test/main.h
+++ b/test/main.h
@@ -271,7 +271,13 @@ inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
template<typename Type1, typename Type2>
inline bool test_isApprox(const Type1& a, const Type2& b)
{
+#ifdef EIGEN_TEST_EVALUATORS
+ typename internal::eval<Type1>::type a_eval(a);
+ typename internal::eval<Type2>::type b_eval(b);
+ return a_eval.isApprox(b_eval, test_precision<typename Type1::Scalar>());
+#else
return a.isApprox(b, test_precision<typename Type1::Scalar>());
+#endif
}
// The idea behind this function is to compare the two scalars a and b where