|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67211 - trunk/libs/math/test
From: pbristow_at_[hidden]
Date: 2010-12-13 11:34:14
Author: pbristow
Date: 2010-12-13 11:34:14 EST (Mon, 13 Dec 2010)
New Revision: 67211
URL: http://svn.boost.org/trac/boost/changeset/67211
Log:
Test Corrected handling of cases that should raise overflow_error
Text files modified:
trunk/libs/math/test/test_laplace.cpp | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
Modified: trunk/libs/math/test/test_laplace.cpp
==============================================================================
--- trunk/libs/math/test/test_laplace.cpp (original)
+++ trunk/libs/math/test/test_laplace.cpp 2010-12-13 11:34:14 EST (Mon, 13 Dec 2010)
@@ -454,9 +454,16 @@
template <class RealType>
void test_extreme_function_arguments()
{
- boost::math::laplace_distribution<RealType> L1(0, 1);
- boost::math::laplace_distribution<RealType> L2(1, 2);
+ using boost::math::policies::policy;
+ using boost::math::policies::overflow_error;
+ using boost::math::policies::ignore_error;
+
+ typedef policy<
+ overflow_error<ignore_error> // if argument value causes overflow.
+ > ignore_overflow_policy;
+ boost::math::laplace_distribution<RealType, ignore_overflow_policy> L1(0, 1);
+ boost::math::laplace_distribution<RealType, ignore_overflow_policy> L2(1, 2);
// check pdf at x = +/- infinity
BOOST_CHECK_THROW(pdf(L1, +std::numeric_limits<RealType>::infinity()), std::domain_error);
BOOST_CHECK_THROW(pdf(L1, -std::numeric_limits<RealType>::infinity()), std::domain_error);
@@ -469,11 +476,12 @@
BOOST_CHECK_THROW(cdf(L2, +std::numeric_limits<RealType>::infinity()), std::domain_error);
BOOST_CHECK_THROW(cdf(L2, -std::numeric_limits<RealType>::infinity()), std::domain_error);
- // check quantile at p = 0,1
- BOOST_CHECK_EQUAL( quantile(L1, 0), -std::numeric_limits<RealType>::infinity() );
- BOOST_CHECK_EQUAL( quantile(L1, 1), +std::numeric_limits<RealType>::infinity() );
- BOOST_CHECK_EQUAL( quantile(L2, 0), -std::numeric_limits<RealType>::infinity() );
- BOOST_CHECK_EQUAL( quantile(L2, 1), +std::numeric_limits<RealType>::infinity() );
+
+ // check quantile at p = 0, 1 which return infinity.
+ BOOST_CHECK_EQUAL(quantile(L1, 0), -std::numeric_limits<RealType>::infinity() );
+ BOOST_CHECK_EQUAL(quantile(L1, 1), +std::numeric_limits<RealType>::infinity() );
+ BOOST_CHECK_EQUAL(quantile(L2, 0), -std::numeric_limits<RealType>::infinity() );
+ BOOST_CHECK_EQUAL(quantile(L2, 1), +std::numeric_limits<RealType>::infinity() );
}
BOOST_AUTO_TEST_CASE( vs_GNU_Octave )
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