Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79760 - trunk/libs/math/test
From: pbristow_at_[hidden]
Date: 2012-07-26 14:04:03


Author: pbristow
Date: 2012-07-26 14:04:02 EDT (Thu, 26 Jul 2012)
New Revision: 79760
URL: http://svn.boost.org/trac/boost/changeset/79760

Log:
Revised for Trac #7717
Text files modified:
   trunk/libs/math/test/test_students_t.cpp | 12 ++++++++++++
   1 files changed, 12 insertions(+), 0 deletions(-)

Modified: trunk/libs/math/test/test_students_t.cpp
==============================================================================
--- trunk/libs/math/test/test_students_t.cpp (original)
+++ trunk/libs/math/test/test_students_t.cpp 2012-07-26 14:04:02 EDT (Thu, 26 Jul 2012)
@@ -466,10 +466,20 @@
          static_cast<RealType>(1.0))),
          9);
 
+
     BOOST_CHECK_THROW(quantile(dist, -1), std::domain_error);
     BOOST_CHECK_THROW(quantile(dist, 2), std::domain_error);
     BOOST_CHECK_THROW(pdf(students_t_distribution<RealType>(0), 0), std::domain_error);
     BOOST_CHECK_THROW(pdf(students_t_distribution<RealType>(-1), 0), std::domain_error);
+
+ // Checks added for Trac #7717 report by Thomas Mang
+ BOOST_CHECK_EQUAL(mean(students_t_distribution<RealType>(2)), 0);
+ BOOST_CHECK_THROW(mean(students_t_distribution<RealType>(1)), std::domain_error);
+
+ BOOST_CHECK_THROW(variance(students_t_distribution<RealType>(1)), std::domain_error);
+ BOOST_CHECK_EQUAL(variance(students_t_distribution<RealType>(1.5)), std::numeric_limits<RealType>::infinity());
+ BOOST_CHECK_EQUAL(variance(students_t_distribution<RealType>(2)), std::numeric_limits<RealType>::infinity());
+
     check_out_of_range<students_t_distribution<RealType> >(1);
 } // template <class RealType>void test_spots(RealType)
 
@@ -481,6 +491,8 @@
    students_t_distribution<> myst2(2); // Using default RealType double.
    //students_t_distribution<double> myst3(2); // Using explicit RealType double.
 
+
+
     // Basic sanity-check spot values.
    // (Parameter value, arbitrarily zero, only communicates the floating point type).
   test_spots(0.0F); // Test float. OK at decdigits = 0 tolerance = 0.0001 %


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