]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/multiprecision/test/test_cpp_int.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / multiprecision / test / test_cpp_int.cpp
index 8f9b4fa3877d085e040baa7c47881a55df960ec3..b809e3794b3fe128ddbf4c1898ad483588dc53f8 100644 (file)
@@ -24,6 +24,9 @@
 #include <boost/timer.hpp>
 #include "test.hpp"
 
+#ifdef _MSC_VER
+#pragma warning(disable:4127)  //  Conditional expression is constant
+#endif
 
 #if !defined(TEST1) && !defined(TEST2) && !defined(TEST3)
 #define TEST1
@@ -387,7 +390,7 @@ struct tester
       BOOST_CHECK_EQUAL(msb(a), msb(a1));
    }
 
-   void test_bug_cases()
+   static void test_bug_cases()
    {
       if(!std::numeric_limits<test_type>::is_bounded)
       {
@@ -517,6 +520,14 @@ struct tester
       BOOST_CHECK(r < b);
       BOOST_CHECK_EQUAL(a - c * b, r);
 #endif
+      for(ui = 0; ui < 1000; ++ui)
+      {
+         boost::multiprecision::mpz_int t;
+         boost::multiprecision::mpz_int s1 = sqrt(boost::multiprecision::mpz_int(ui), t);
+         a = sqrt(test_type(ui), b);
+         BOOST_CHECK_EQUAL(a.str(), s1.str());
+         BOOST_CHECK_EQUAL(b.str(), t.str());
+      }
    }
 
    void test()
@@ -593,7 +604,11 @@ struct tester
          // Tests run on the compiler farm time out after 300 seconds,
          // so don't get too close to that:
          //
+#ifndef CI_SUPPRESS_KNOWN_ISSUES
          if(tim.elapsed() > 200)
+#else
+         if (tim.elapsed() > 25)
+#endif
          {
             std::cout << "Timeout reached, aborting tests now....\n";
             break;
@@ -606,6 +621,7 @@ struct tester
 int main()
 {
    using namespace boost::multiprecision;
+
 #ifdef TEST1
    tester<cpp_int> t1;
    t1.test();
@@ -618,6 +634,14 @@ int main()
    // Unchecked test verifies modulo arithmetic:
    tester<number<cpp_int_backend<2048, 2048, signed_magnitude, unchecked, void> > > t3;
    t3.test();
+#endif
+#ifdef TEST4
+   tester<number<cpp_int_backend<0, 2048, signed_magnitude, unchecked, std::allocator<void> > > > t4;
+   t4.test();
+#endif
+#ifdef TEST5
+   tester<number<cpp_int_backend<0, 2048, signed_magnitude, unchecked > > > t5;
+   t5.test();
 #endif
    return boost::report_errors();
 }