Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / math / test / test_poisson.cpp
index cd8bf35..1911485 100644 (file)
@@ -23,7 +23,8 @@
 #  pragma warning(disable: 4127) // conditional expression is constant.
 #endif
 
-#include <boost/test/test_exec_monitor.hpp> // Boost.Test
+#define BOOST_TEST_MAIN
+#include <boost/test/unit_test.hpp> // Boost.Test
 #include <boost/test/floating_point_comparison.hpp>
 
 #include <boost/math/concepts/real_concept.hpp> // for real_concept
@@ -34,6 +35,7 @@
 #include <boost/math/special_functions/gamma.hpp> // for (incomplete) gamma.
 //   using boost::math::qamma_Q;
 #include "table_type.hpp"
+#include "test_out_of_range.hpp"
 
 #include <iostream>
    using std::cout;
@@ -144,6 +146,26 @@ void test_spots(RealType)
       static_cast<RealType>(-1)),  // bad probability. 
       std::domain_error);
 
+  BOOST_CHECK_THROW(
+     quantile(poisson_distribution<RealType>(static_cast<RealType>(1)), 
+      static_cast<RealType>(1)),  // bad probability. 
+      std::overflow_error);
+
+  BOOST_CHECK_THROW(
+     quantile(complement(poisson_distribution<RealType>(static_cast<RealType>(1)), 
+      static_cast<RealType>(0))),  // bad probability. 
+      std::overflow_error);
+
+  BOOST_CHECK_EQUAL(
+     quantile(poisson_distribution<RealType>(static_cast<RealType>(1)), 
+      static_cast<RealType>(0)),  // bad probability. 
+      0);
+
+  BOOST_CHECK_EQUAL(
+     quantile(complement(poisson_distribution<RealType>(static_cast<RealType>(1)), 
+      static_cast<RealType>(1))),  // bad probability. 
+      0);
+
   // Check some test values.
 
   BOOST_CHECK_CLOSE( // mode
@@ -485,12 +507,12 @@ void test_spots(RealType)
      x = quantile(complement(p6, poisson_quantile_data[i][1]));
      BOOST_CHECK_EQUAL(x, floor(poisson_quantile_data[i][3] + 0.5f));
   }
-
+   check_out_of_range<poisson_distribution<RealType> >(1);
 } // template <class RealType>void test_spots(RealType)
 
 //
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( test_main )
 {
   // Check that can construct normal distribution using the two convenience methods:
   using namespace boost::math;
@@ -606,8 +628,8 @@ int test_main(int, char* [])
 #endif
 #endif
 #endif
-   return 0;
-} // int test_main(int, char* [])
+   
+} // BOOST_AUTO_TEST_CASE( test_main )
 
 /*