From 72950effdffd58fde8fdf25a4d548b58ed87aa5c Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 20 Jul 2016 18:21:30 +0200 Subject: enable testing of Boost.Multiprecision with expression templates --- test/boostmultiprec.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'test/boostmultiprec.cpp') diff --git a/test/boostmultiprec.cpp b/test/boostmultiprec.cpp index a75711ff4..a83ae4b78 100644 --- a/test/boostmultiprec.cpp +++ b/test/boostmultiprec.cpp @@ -7,6 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include + #ifdef EIGEN_TEST_MAX_SIZE #undef EIGEN_TEST_MAX_SIZE #endif @@ -57,13 +59,16 @@ #include namespace mp = boost::multiprecision; -typedef mp::number, mp::et_off> Real; +typedef mp::number, mp::et_off> Real; // swith to et_on for testing with expression templates namespace Eigen { template<> struct NumTraits : GenericNumTraits { static inline Real dummy_precision() { return 1e-50; } }; + template + struct NumTraits > : NumTraits {}; + template<> Real test_precision() { return 1e-50; } } @@ -82,10 +87,11 @@ namespace multiprecision { return internal::isApprox(a, b, test_precision()); } - inline bool test_isApproxOrLessThan(const Real& a, const Real& b) - { return internal::isApproxOrLessThan(a, b, test_precision()); } + inline bool test_isApproxOrLessThan(const Real& a, const Real& b) { + return internal::isApproxOrLessThan(a, b, test_precision()); + } - Real get_test_precision(const Real*) { + Real get_test_precision(const Real&) { return test_precision(); } @@ -108,6 +114,14 @@ void test_boostmultiprec() std::cout << "NumTraits::lowest() = " << NumTraits::lowest() << std::endl; std::cout << "NumTraits::highest() = " << NumTraits::highest() << std::endl; + // chekc stream output + { + Mat A(10,10); + A.setRandom(); + std::stringstream ss; + ss << A; + } + for(int i = 0; i < g_repeat; i++) { int s = internal::random(1,EIGEN_TEST_MAX_SIZE); -- cgit v1.2.3