]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/test/daubechies_wavelet_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / daubechies_wavelet_test.cpp
index eb92c271cd248f9576c6f5d9dc2da95519b521d8..376b0fef91923e2ac60279022f8484c63afc9a70 100644 (file)
@@ -12,6 +12,7 @@
 #include <iostream>
 #include <random>
 #include <cmath>
+#include <boost/assert.hpp>
 #include <boost/core/demangle.hpp>
 #include <boost/hana/for_each.hpp>
 #include <boost/hana/ext/std/integer_sequence.hpp>
@@ -93,38 +94,46 @@ void test_quadratures()
             }
         }
         xlo = std::nextafter(xlo, std::numeric_limits<Real>::lowest());
-        xhi = std::nextafter(xhi, std::numeric_limits<Real>::max());
+        xhi = std::nextafter(xhi, (std::numeric_limits<Real>::max)());
     }
 
     xlo = a;
     xhi = b;
     for (int i = 0; i < samples; ++i) {
         std::cout << std::setprecision(std::numeric_limits<Real>::max_digits10);
-        assert(abs(psi(xlo)) <= 5);
-        assert(abs(psi(xhi)) <= 5);
+        BOOST_ASSERT(abs(psi(xlo)) <= 5);
+        BOOST_ASSERT(abs(psi(xhi)) <= 5);
         if constexpr (p > 2)
         {
-            assert(abs(psi.prime(xlo)) <= 5);
-            assert(abs(psi.prime(xhi)) <= 5);
+            BOOST_ASSERT(abs(psi.prime(xlo)) <= 5);
+            BOOST_ASSERT(abs(psi.prime(xhi)) <= 5);
             if constexpr (p >= 6)
             {
-                assert(abs(psi.double_prime(xlo)) <= 5);
-                assert(abs(psi.double_prime(xhi)) <= 5);
+                BOOST_ASSERT(abs(psi.double_prime(xlo)) <= 5);
+                BOOST_ASSERT(abs(psi.double_prime(xhi)) <= 5);
             }
         }
-        xlo = std::nextafter(xlo, std::numeric_limits<Real>::max());
+        xlo = std::nextafter(xlo, (std::numeric_limits<Real>::max)());
         xhi = std::nextafter(xhi, std::numeric_limits<Real>::lowest());
     }
 }
 
 int main()
 {
-    test_exact_value<double>();
-
-    boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i){
-        test_quadratures<float, i+3>();
-        test_quadratures<double, i+3>();
-    });
+    #ifndef __MINGW32__
+    try
+    {
+      test_exact_value<double>();
 
+      boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i) {
+         test_quadratures<float, i + 3>();
+         test_quadratures<double, i + 3>();
+         });
+    }
+    catch (std::bad_alloc)
+    {
+       // not much we can do about this, this test uses lots of memory!
+    }
+    #endif
     return boost::math::test::report_errors();
 }