]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/include_private/boost/math/tools/test.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / math / include_private / boost / math / tools / test.hpp
index 2da1d947011ab785c452a66e2c239799daaa6a01..14b7e2b432eeaf748000978b4e638db6fbe2ec5b 100644 (file)
@@ -67,7 +67,7 @@ T relative_error(T a, T b)
 
 
 template <class T>
-void set_output_precision(T)
+void set_output_precision(T, std::ostream& os)
 {
 #ifdef BOOST_MSVC
 #pragma warning(push)
@@ -75,7 +75,7 @@ void set_output_precision(T)
 #endif
    if(std::numeric_limits<T>::digits10)
    {
-      std::cout << std::setprecision(std::numeric_limits<T>::digits10 + 2);
+      os << std::setprecision(std::numeric_limits<T>::digits10 + 2);
    }
 #ifdef BOOST_MSVC
 #pragma warning(pop)
@@ -85,14 +85,17 @@ void set_output_precision(T)
 template <class Seq>
 void print_row(const Seq& row, std::ostream& os = std::cout)
 {
-   set_output_precision(row[0]);
-   for(unsigned i = 0; i < row.size(); ++i)
-   {
-      if(i)
-         os << ", ";
-      os << row[i];
+   try {
+      set_output_precision(row[0], os);
+      for (unsigned i = 0; i < row.size(); ++i)
+      {
+         if (i)
+            os << ", ";
+         os << row[i];
+      }
+      os << std::endl;
    }
-   os << std::endl;
+   catch (const std::exception&) {}
 }
 
 //
@@ -205,6 +208,7 @@ test_result<Real> test_hetero(const A& a, F1 test_func, F2 expect_func)
       }
       catch(const std::exception& e)
       {
+         std::cerr << "Unexpected exception at entry: " << i << "\n";
          std::cerr << e.what() << std::endl;
          print_row(row, std::cerr);
          BOOST_ERROR("Unexpected exception.");