Boost logo

Boost-Commit :

From: johnmaddock_at_[hidden]
Date: 2007-07-23 12:41:43


Author: johnmaddock
Date: 2007-07-23 12:41:41 EDT (Mon, 23 Jul 2007)
New Revision: 7516
URL: http://svn.boost.org/trac/boost/changeset/7516

Log:
Added tests for forwarding functions, and fixed a few bugs detected!

Added:
   sandbox/math_toolkit/policy/libs/math/test/test_policy_sf.cpp
Text files modified:
   sandbox/math_toolkit/policy/boost/math/special_functions/math_fwd.hpp | 6 +++---
   sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 | 2 ++
   2 files changed, 5 insertions(+), 3 deletions(-)

Modified: sandbox/math_toolkit/policy/boost/math/special_functions/math_fwd.hpp
==============================================================================
--- sandbox/math_toolkit/policy/boost/math/special_functions/math_fwd.hpp (original)
+++ sandbox/math_toolkit/policy/boost/math/special_functions/math_fwd.hpp 2007-07-23 12:41:41 EDT (Mon, 23 Jul 2007)
@@ -659,7 +659,7 @@
 \
    template <class T1, class T2, class T3, class T4>\
    inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \
- ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibeta_inv(a, b, q, py, Policy()); }\
+ ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibetac_inv(a, b, q, py, Policy()); }\
 \
    template <class RT1, class RT2, class RT3>\
    inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
@@ -675,11 +675,11 @@
 \
    template <class T1, class T2, class T3>\
    inline typename boost::math::tools::promote_args<T1, T2, T3>::type \
- ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibeta_invb(a, b, q, Policy()); }\
+ ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_invb(a, b, q, Policy()); }\
 \
    template <class RT1, class RT2, class RT3>\
    inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \
- ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibeta_inv(a, b, q, Policy()); }\
+ ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibetac_inv(a, b, q, Policy()); }\
 \
    template <class RT1, class RT2, class RT3>\
    inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \

Modified: sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2
==============================================================================
--- sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 (original)
+++ sandbox/math_toolkit/policy/libs/math/test/Jamfile.v2 2007-07-23 12:41:41 EDT (Mon, 23 Jul 2007)
@@ -70,6 +70,7 @@
 run test_uniform.cpp ;
 run test_weibull.cpp ;
 run test_policy.cpp ;
+run test_policy_sf.cpp ;
 
 run test_bessel_j.cpp ;
 run test_bessel_y.cpp ;
@@ -165,3 +166,4 @@
 
 
 
+

Added: sandbox/math_toolkit/policy/libs/math/test/test_policy_sf.cpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/policy/libs/math/test/test_policy_sf.cpp 2007-07-23 12:41:41 EDT (Mon, 23 Jul 2007)
@@ -0,0 +1,128 @@
+// (C) Copyright John Maddock 2007.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/test/included/test_exec_monitor.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/math/special_functions.hpp>
+
+//
+// DESCRIPTION:
+// ~~~~~~~~~~~~
+//
+// This file provides very basic sanity checks for the special functions
+// declared with BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS, basically we
+// just want to make sure that the inline forwarding functions do
+// actually forward to the right function!!
+//
+
+namespace test{
+
+ typedef boost::math::policy::policy<> policy;
+
+ BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(policy);
+
+}
+
+#define TEST_POLICY_SF(call)\
+ BOOST_CHECK_EQUAL(boost::math::call , test::call)
+
+int test_main(int, char* [])
+{
+ int i;
+ TEST_POLICY_SF(tgamma(3.0));
+ TEST_POLICY_SF(tgamma1pm1(0.25));
+ TEST_POLICY_SF(lgamma(50.0));
+ TEST_POLICY_SF(lgamma(50.0, &i));
+ TEST_POLICY_SF(digamma(12.0));
+ TEST_POLICY_SF(tgamma_ratio(12.0, 13.5));
+ TEST_POLICY_SF(tgamma_delta_ratio(100.0, 0.25));
+ TEST_POLICY_SF(factorial<double>(8));
+ TEST_POLICY_SF(unchecked_factorial<double>(3));
+ TEST_POLICY_SF(double_factorial<double>(5));
+ TEST_POLICY_SF(rising_factorial(20.5, 5));
+ TEST_POLICY_SF(falling_factorial(10.2, 7));
+ TEST_POLICY_SF(tgamma(12.0, 13.0));
+ TEST_POLICY_SF(tgamma_lower(12.0, 13.0));
+ TEST_POLICY_SF(gamma_p(12.0, 13.0));
+ TEST_POLICY_SF(gamma_q(12.0, 15.0));
+ TEST_POLICY_SF(gamma_p_inv(12.0, 0.25));
+ TEST_POLICY_SF(gamma_q_inv(15.0, 0.25));
+ TEST_POLICY_SF(gamma_p_inva(12.0, 0.25));
+ TEST_POLICY_SF(gamma_q_inva(12.0, 0.25));
+ TEST_POLICY_SF(erf(2.5));
+ TEST_POLICY_SF(erfc(2.5));
+ TEST_POLICY_SF(erf_inv(0.25));
+ TEST_POLICY_SF(erfc_inv(0.25));
+ TEST_POLICY_SF(beta(12.0, 15.0));
+ TEST_POLICY_SF(beta(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(betac(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(ibeta(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(ibetac(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(ibeta_inv(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(ibetac_inv(12.0, 15.0, 0.25));
+ TEST_POLICY_SF(ibeta_inva(12.0, 0.75, 0.25));
+ TEST_POLICY_SF(ibetac_inva(12.0, 0.75, 0.25));
+ TEST_POLICY_SF(ibeta_invb(12.0, 0.75, 0.25));
+ TEST_POLICY_SF(ibetac_invb(12.0, 0.75, 0.25));
+ TEST_POLICY_SF(gamma_p_derivative(12.0, 15.0));
+ TEST_POLICY_SF(ibeta_derivative(12.0, 15.75, 0.25));
+ TEST_POLICY_SF(fpclassify(12.0));
+ TEST_POLICY_SF(isfinite(12.0));
+ TEST_POLICY_SF(isnormal(12.0));
+ TEST_POLICY_SF(isnan(12.0));
+ TEST_POLICY_SF(isinf(12.0));
+ TEST_POLICY_SF(log1p(0.0025));
+ TEST_POLICY_SF(expm1(0.0025));
+ TEST_POLICY_SF(cbrt(30.0));
+ TEST_POLICY_SF(sqrt1pm1(0.0025));
+ TEST_POLICY_SF(powm1(1.0025, 12.0));
+ TEST_POLICY_SF(legendre_p(5, 0.75));
+ TEST_POLICY_SF(legendre_p(7, 3, 0.75));
+ TEST_POLICY_SF(legendre_q(5, 0.75));
+ TEST_POLICY_SF(legendre_next(2, 0.25, 12.0, 5.0));
+ TEST_POLICY_SF(legendre_next(2, 2, 0.25, 12.0, 5.0));
+ TEST_POLICY_SF(laguerre(5, 12.2));
+ TEST_POLICY_SF(laguerre(7, 3, 5.0));
+ TEST_POLICY_SF(laguerre_next(2, 5.0, 12.0, 5.0));
+ TEST_POLICY_SF(laguerre_next(5, 3, 5.0, 20.0, 10.0));
+ TEST_POLICY_SF(hermite(1, 2.0));
+ TEST_POLICY_SF(hermite_next(2, 2.0, 3.0, 2.0));
+ TEST_POLICY_SF(spherical_harmonic_r(5, 4, 0.75, 0.25));
+ TEST_POLICY_SF(spherical_harmonic_i(5, 4, 0.75, 0.25));
+ TEST_POLICY_SF(ellint_1(0.25));
+ TEST_POLICY_SF(ellint_1(0.25, 0.75));
+ TEST_POLICY_SF(ellint_2(0.25));
+ TEST_POLICY_SF(ellint_2(0.25, 0.75));
+ TEST_POLICY_SF(ellint_3(0.25, 0.75));
+ TEST_POLICY_SF(ellint_3(0.25, 0.125, 0.75));
+ TEST_POLICY_SF(ellint_rc(3.0, 5.0));
+ TEST_POLICY_SF(ellint_rd(2.0, 3.0, 4.0));
+ TEST_POLICY_SF(ellint_rf(2.0, 3.0, 4.0));
+ TEST_POLICY_SF(ellint_rj(2.0, 3.0, 5.0, 0.25));
+ TEST_POLICY_SF(hypot(5.0, 3.0));
+ TEST_POLICY_SF(sinc_pi(3.0));
+ TEST_POLICY_SF(sinhc_pi(2.0));
+ TEST_POLICY_SF(asinh(12.0));
+ TEST_POLICY_SF(acosh(5.0));
+ TEST_POLICY_SF(atanh(0.75));
+ TEST_POLICY_SF(sin_pi(5.0));
+ TEST_POLICY_SF(cos_pi(6.0));
+ TEST_POLICY_SF(cyl_neumann(2.0, 5.0));
+ TEST_POLICY_SF(cyl_neumann(2, 5.0));
+ TEST_POLICY_SF(cyl_bessel_j(2.0, 5.0));
+ TEST_POLICY_SF(cyl_bessel_j(2, 5.0));
+ TEST_POLICY_SF(cyl_bessel_i(3.0, 5.0));
+ TEST_POLICY_SF(cyl_bessel_i(3, 5.0));
+ TEST_POLICY_SF(cyl_bessel_k(3.0, 5.0));
+ TEST_POLICY_SF(cyl_bessel_k(3, 5.0));
+ TEST_POLICY_SF(sph_bessel(3, 5.0));
+ TEST_POLICY_SF(sph_bessel(3, 5));
+ TEST_POLICY_SF(sph_neumann(3, 5.0));
+ TEST_POLICY_SF(sph_neumann(3, 5));
+ return 0;
+}
+
+
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk