Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78753 - trunk/libs/math/test
From: john_at_[hidden]
Date: 2012-05-29 14:24:30


Author: johnmaddock
Date: 2012-05-29 14:24:29 EDT (Tue, 29 May 2012)
New Revision: 78753
URL: http://svn.boost.org/trac/boost/changeset/78753

Log:
Update to allow for infinite range.
Text files modified:
   trunk/libs/math/test/test_out_of_range.hpp | 22 ++++++++++++++--------
   1 files changed, 14 insertions(+), 8 deletions(-)

Modified: trunk/libs/math/test/test_out_of_range.hpp
==============================================================================
--- trunk/libs/math/test/test_out_of_range.hpp (original)
+++ trunk/libs/math/test/test_out_of_range.hpp 2012-05-29 14:24:29 EDT (Tue, 29 May 2012)
@@ -15,7 +15,7 @@
 void check_support(const Distro& d)
 {
    typedef typename Distro::value_type value_type;
- if(range(d).first != -boost::math::tools::max_value<value_type>())
+ if((boost::math::isfinite)(range(d).first) && (range(d).first != -boost::math::tools::max_value<value_type>()))
    {
       value_type m = boost::math::float_prior(range(d).first);
       BOOST_ASSERT(m != range(d).first);
@@ -24,7 +24,7 @@
       BOOST_CHECK_THROW(cdf(d, m), std::domain_error);
       BOOST_CHECK_THROW(cdf(complement(d, m)), std::domain_error);
    }
- if(range(d).second != boost::math::tools::max_value<value_type>())
+ if((boost::math::isfinite)(range(d).second) && (range(d).second != boost::math::tools::max_value<value_type>()))
    {
       value_type m = boost::math::float_next(range(d).second);
       BOOST_ASSERT(m != range(d).first);
@@ -35,12 +35,18 @@
    }
    if(std::numeric_limits<value_type>::has_infinity)
    {
- BOOST_CHECK_THROW(pdf(d, std::numeric_limits<value_type>::infinity()), std::domain_error);
- BOOST_CHECK_THROW(cdf(d, std::numeric_limits<value_type>::infinity()), std::domain_error);
- BOOST_CHECK_THROW(cdf(complement(d, std::numeric_limits<value_type>::infinity())), std::domain_error);
- BOOST_CHECK_THROW(pdf(d, -std::numeric_limits<value_type>::infinity()), std::domain_error);
- BOOST_CHECK_THROW(cdf(d, -std::numeric_limits<value_type>::infinity()), std::domain_error);
- BOOST_CHECK_THROW(cdf(complement(d, -std::numeric_limits<value_type>::infinity())), std::domain_error);
+ if((boost::math::isfinite)(range(d).second))
+ {
+ BOOST_CHECK_THROW(pdf(d, std::numeric_limits<value_type>::infinity()), std::domain_error);
+ BOOST_CHECK_THROW(cdf(d, std::numeric_limits<value_type>::infinity()), std::domain_error);
+ BOOST_CHECK_THROW(cdf(complement(d, std::numeric_limits<value_type>::infinity())), std::domain_error);
+ }
+ if((boost::math::isfinite)(range(d).first))
+ {
+ BOOST_CHECK_THROW(pdf(d, -std::numeric_limits<value_type>::infinity()), std::domain_error);
+ BOOST_CHECK_THROW(cdf(d, -std::numeric_limits<value_type>::infinity()), std::domain_error);
+ BOOST_CHECK_THROW(cdf(complement(d, -std::numeric_limits<value_type>::infinity())), std::domain_error);
+ }
       BOOST_CHECK_THROW(quantile(d, std::numeric_limits<value_type>::infinity()), std::domain_error);
       BOOST_CHECK_THROW(quantile(d, -std::numeric_limits<value_type>::infinity()), std::domain_error);
       BOOST_CHECK_THROW(quantile(complement(d, std::numeric_limits<value_type>::infinity())), std::domain_error);


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