Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78784 - trunk/libs/math/test
From: john_at_[hidden]
Date: 2012-05-31 07:58:07


Author: johnmaddock
Date: 2012-05-31 07:58:06 EDT (Thu, 31 May 2012)
New Revision: 78784
URL: http://svn.boost.org/trac/boost/changeset/78784

Log:
Enhance exponential_distribution tests.
Refs #6934.
Text files modified:
   trunk/libs/math/test/test_exponential_dist.cpp | 13 ++++++++++---
   1 files changed, 10 insertions(+), 3 deletions(-)

Modified: trunk/libs/math/test/test_exponential_dist.cpp
==============================================================================
--- trunk/libs/math/test/test_exponential_dist.cpp (original)
+++ trunk/libs/math/test/test_exponential_dist.cpp 2012-05-31 07:58:06 EDT (Thu, 31 May 2012)
@@ -14,7 +14,6 @@
 
 #include <boost/test/test_exec_monitor.hpp> // Boost.Test
 #include <boost/test/floating_point_comparison.hpp>
-
 #include "test_out_of_range.hpp"
 
 #include <iostream>
@@ -252,8 +251,16 @@
        quantile(dist, RealType(2)),
        std::domain_error);
 
- check_out_of_range<boost::math::exponential_distribution<RealType> >(1); // (All) valid constructor parameter values.
-
+ check_out_of_range<exponential_distribution<RealType> >(2);
+ BOOST_CHECK_THROW(exponential_distribution<RealType>(0), std::domain_error);
+ BOOST_CHECK_THROW(exponential_distribution<RealType>(-1), std::domain_error);
+ if(std::numeric_limits<RealType>::has_infinity)
+ {
+ RealType inf = std::numeric_limits<RealType>::infinity();
+ BOOST_CHECK_EQUAL(pdf(exponential_distribution<RealType>(2), inf), 0);
+ BOOST_CHECK_EQUAL(cdf(exponential_distribution<RealType>(2), inf), 1);
+ BOOST_CHECK_EQUAL(cdf(complement(exponential_distribution<RealType>(2), inf)), 0);
+ }
 } // template <class RealType>void test_spots(RealType)
 
 int test_main(int, char* [])


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