summaryrefslogtreecommitdiff
path: root/libs/math/test/test_expint.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/math/test/test_expint.hpp')
-rw-r--r--libs/math/test/test_expint.hpp47
1 files changed, 24 insertions, 23 deletions
diff --git a/libs/math/test/test_expint.hpp b/libs/math/test/test_expint.hpp
index b242484af1..81fb6a6b09 100644
--- a/libs/math/test/test_expint.hpp
+++ b/libs/math/test/test_expint.hpp
@@ -17,9 +17,10 @@
#include "handle_test_result.hpp"
#include "test_expint_hooks.hpp"
+#include "table_type.hpp"
#ifndef SC_
-#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
+#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
#endif
template <class T>
@@ -37,7 +38,7 @@ T other_expint_wrapper(T n, T z)
boost::math::itrunc(n), z);
}
#endif
-template <class T>
+template <class Real, class T>
void do_test_expint(const T& data, const char* type_name, const char* test_name)
{
//
@@ -45,7 +46,7 @@ void do_test_expint(const T& data, const char* type_name, const char* test_name)
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -60,10 +61,10 @@ void do_test_expint(const T& data, const char* type_name, const char* test_name)
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expint", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value && other::expint(2u, 2.0))
@@ -72,17 +73,17 @@ void do_test_expint(const T& data, const char* type_name, const char* test_name)
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0, 1),
- extract_result(2));
+ bind_func<Real>(funcp, 0, 1),
+ extract_result<Real>(2));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::expint", test_name);
}
#endif
std::cout << std::endl;
}
-template <class T>
+template <class Real, class T>
void do_test_expint_Ei(const T& data, const char* type_name, const char* test_name)
{
//
@@ -90,7 +91,7 @@ void do_test_expint_Ei(const T& data, const char* type_name, const char* test_na
//
using namespace std;
typedef typename T::value_type row_type;
- typedef typename row_type::value_type value_type;
+ typedef Real value_type;
std::cout << test_name << " with type " << type_name << std::endl;
@@ -105,10 +106,10 @@ void do_test_expint_Ei(const T& data, const char* type_name, const char* test_na
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expint", test_name);
#ifdef TEST_OTHER
if(boost::is_floating_point<value_type>::value && other::expint(2.0))
@@ -117,10 +118,10 @@ void do_test_expint_Ei(const T& data, const char* type_name, const char* test_na
//
// test expint against data:
//
- result = boost::math::tools::test(
+ result = boost::math::tools::test_hetero<Real>(
data,
- bind_func(funcp, 0),
- extract_result(1));
+ bind_func<Real>(funcp, 0),
+ extract_result<Real>(1));
handle_test_result(result, data[result.worst()], result.worst(), type_name, "other::expint", test_name);
}
#endif
@@ -133,24 +134,24 @@ void test_expint(T, const char* name)
// The actual test data is rather verbose, so it's in a separate file
//
#include "expint_data.ipp"
- do_test_expint(expint_data, name, "Exponential Integral En");
+ do_test_expint<T>(expint_data, name, "Exponential Integral En");
#include "expint_small_data.ipp"
- do_test_expint(expint_small_data, name, "Exponential Integral En: small z values");
+ do_test_expint<T>(expint_small_data, name, "Exponential Integral En: small z values");
#include "expint_1_data.ipp"
- do_test_expint(expint_1_data, name, "Exponential Integral E1");
+ do_test_expint<T>(expint_1_data, name, "Exponential Integral E1");
#include "expinti_data.ipp"
- do_test_expint_Ei(expinti_data, name, "Exponential Integral Ei");
+ do_test_expint_Ei<T>(expinti_data, name, "Exponential Integral Ei");
if(boost::math::tools::log_max_value<T>() > 100)
{
#include "expinti_data_double.ipp"
- do_test_expint_Ei(expinti_data_double, name, "Exponential Integral Ei: double exponent range");
+ do_test_expint_Ei<T>(expinti_data_double, name, "Exponential Integral Ei: double exponent range");
}
#if (defined(LDBL_MAX_10_EXP) && (LDBL_MAX_10_EXP > 2000)) || defined(TEST_UDT)
if(boost::math::tools::log_max_value<T>() > 1000)
{
#include "expinti_data_long.ipp"
- do_test_expint_Ei(expinti_data_long, name, "Exponential Integral Ei: long exponent range");
+ do_test_expint_Ei<T>(expinti_data_long, name, "Exponential Integral Ei: long exponent range");
}
#endif
}