Boost logo

Boost-Commit :

From: pbristow_at_[hidden]
Date: 2007-09-16 11:19:00


Author: pbristow
Date: 2007-09-16 11:19:00 EDT (Sun, 16 Sep 2007)
New Revision: 39319
URL: http://svn.boost.org/trac/boost/changeset/39319

Log:
added test to suit addition of special caese x = infinity for pdf and cdf

Text files modified:
   sandbox/math_toolkit/libs/math/test/test_normal.cpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: sandbox/math_toolkit/libs/math/test/test_normal.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/test_normal.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/test_normal.cpp 2007-09-16 11:19:00 EDT (Sun, 16 Sep 2007)
@@ -93,10 +93,12 @@
     normal_distribution<RealType> N01;
   if(std::numeric_limits<RealType>::has_infinity)
   {
- BOOST_CHECK_EQUAL(pdf(N01, +std::numeric_limits<double>::infinity()), 0); // x = + infinity, pdf = 0
- BOOST_CHECK_EQUAL(pdf(N01, -std::numeric_limits<double>::infinity()), 0); // x = - infinity, pdf = 0
- BOOST_CHECK_EQUAL(cdf(N01, +std::numeric_limits<double>::infinity()), 1); // x = + infinity, cdf = 1
- BOOST_CHECK_EQUAL(cdf(N01, -std::numeric_limits<double>::infinity()), 0); // x = - infinity, cdf = 0
+ BOOST_CHECK_EQUAL(pdf(N01, +std::numeric_limits<RealType>::infinity()), 0); // x = + infinity, pdf = 0
+ BOOST_CHECK_EQUAL(pdf(N01, -std::numeric_limits<RealType>::infinity()), 0); // x = - infinity, pdf = 0
+ BOOST_CHECK_EQUAL(cdf(N01, +std::numeric_limits<RealType>::infinity()), 1); // x = + infinity, cdf = 1
+ BOOST_CHECK_EQUAL(cdf(N01, -std::numeric_limits<RealType>::infinity()), 0); // x = - infinity, cdf = 0
+ BOOST_CHECK_EQUAL(cdf(complement(N01, +std::numeric_limits<RealType>::infinity())), 0); // x = + infinity, c cdf = 0
+ BOOST_CHECK_EQUAL(cdf(complement(N01, -std::numeric_limits<RealType>::infinity())), 1); // x = - infinity, c cdf = 1
     BOOST_CHECK_THROW(boost::math::normal_distribution<RealType> nbad1(std::numeric_limits<RealType>::infinity(), static_cast<RealType>(1)), std::domain_error); // +infinite mean
           BOOST_CHECK_THROW(boost::math::normal_distribution<RealType> nbad1(-std::numeric_limits<RealType>::infinity(), static_cast<RealType>(1)), std::domain_error); // -infinite mean
           BOOST_CHECK_THROW(boost::math::normal_distribution<RealType> nbad1(static_cast<RealType>(0), std::numeric_limits<RealType>::infinity()), std::domain_error); // infinite sd


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