Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78777 - trunk/libs/math/test
From: pbristow_at_[hidden]
Date: 2012-05-31 05:36:25


Author: pbristow
Date: 2012-05-31 05:36:24 EDT (Thu, 31 May 2012)
New Revision: 78777
URL: http://svn.boost.org/trac/boost/changeset/78777

Log:
added check_out_of Range
Text files modified:
   trunk/libs/math/test/test_chi_squared.cpp | 31 ++++++++++++++++++++++---------
   1 files changed, 22 insertions(+), 9 deletions(-)

Modified: trunk/libs/math/test/test_chi_squared.cpp
==============================================================================
--- trunk/libs/math/test/test_chi_squared.cpp (original)
+++ trunk/libs/math/test/test_chi_squared.cpp 2012-05-31 05:36:24 EDT (Thu, 31 May 2012)
@@ -8,6 +8,14 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#ifdef _MSC_VER
+# pragma warning(disable: 4100) // unreferenced formal parameter.
+// Seems an entirely spurious warning - formal parameter T IS used - get error if /* T */
+//# pragma warning(disable: 4535) // calling _set_se_translator() requires /EHa (in Boost.test)
+// Enable C++ Exceptions Yes With SEH Exceptions (/EHa) prevents warning 4535.
+# pragma warning(disable: 4127) // conditional expression is constant
+#endif
+
 #include <boost/math/concepts/real_concept.hpp> // for real_concept
 using ::boost::math::concepts::real_concept;
 
@@ -18,6 +26,8 @@
 #include <boost/test/test_exec_monitor.hpp> // for test_main
 #include <boost/test/floating_point_comparison.hpp> // for BOOST_CHECK_CLOSE
 
+#include "test_out_of_range.hpp"
+
 #include <iostream>
 using std::cout;
 using std::endl;
@@ -279,14 +289,14 @@
 };
 
 template <class RealType> // Any floating-point type RealType.
-void test_spots(RealType)
+void test_spots(RealType T)
 {
   // Basic sanity checks, test data is to three decimal places only
   // so set tolerance to 0.001 expressed as a persentage.
 
   RealType tolerance = 0.001f * 100;
 
- cout << "Tolerance = " << tolerance << "%." << endl;
+ cout << "Tolerance for type " << typeid(T).name() << " is " << tolerance << " %" << endl;
 
   using boost::math::chi_squared_distribution;
   using ::boost::math::chi_squared;
@@ -519,6 +529,9 @@
     BOOST_CHECK_EQUAL(
        ceil(chi_squared_distribution<RealType>::find_degrees_of_freedom(
          -10, 0.05f, 0.01f, 100)), static_cast<RealType>(2826));
+
+ check_out_of_range<boost::math::chi_squared_distribution<RealType> >(1); // (All) valid constructor parameter values.
+
 } // template <class RealType>void test_spots(RealType)
 
 int test_main(int, char* [])
@@ -546,13 +559,13 @@
 
 Output:
 
-Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_chi_squared.exe"
-Running 1 test case...
-Tolerance = 0.1%.
-Tolerance = 0.1%.
-Tolerance = 0.1%.
-Tolerance = 0.1%.
-*** No errors detected
+Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\test_chi_squared.exe"
+ Running 1 test case...
+ Tolerance for type float is 0.1 %
+ Tolerance for type double is 0.1 %
+ Tolerance for type long double is 0.1 %
+ Tolerance for type class boost::math::concepts::real_concept is 0.1 %
+
 
 */
 


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