]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/multiprecision/test/test_rational_io.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / multiprecision / test / test_rational_io.cpp
index 05e5a9ba52635cd30ea3cc73826f7c64e73f092f..b1d9b3692ff0e4d09955636cf3076bf7425cf2d2 100644 (file)
@@ -6,13 +6,13 @@
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #ifdef _MSC_VER
-#  define _SCL_SECURE_NO_WARNINGS
+#define _SCL_SECURE_NO_WARNINGS
 #endif
 
 #if !defined(TEST_MPQ) && !defined(TEST_TOMMATH) && !defined(TEST_CPP_INT)
-#  define TEST_MPQ
-#  define TEST_TOMMATH
-#  define TEST_CPP_INT
+#define TEST_MPQ
+#define TEST_TOMMATH
+#define TEST_CPP_INT
 
 #ifdef _MSC_VER
 #pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
@@ -45,18 +45,18 @@ template <class T>
 T generate_random()
 {
    typedef typename boost::multiprecision::component_type<T>::type int_type;
-   static boost::random::uniform_int_distribution<unsigned> ui(0, 20);
-   static boost::random::mt19937 gen;
-   int_type val = int_type(gen());
-   unsigned lim = ui(gen);
-   for(unsigned i = 0; i < lim; ++i)
+   static boost::random::uniform_int_distribution<unsigned>        ui(0, 20);
+   static boost::random::mt19937                                   gen;
+   int_type                                                        val = int_type(gen());
+   unsigned                                                        lim = ui(gen);
+   for (unsigned i = 0; i < lim; ++i)
    {
       val *= (gen.max)();
       val += gen();
    }
    int_type denom = int_type(gen());
-   lim = ui(gen);
-   for(unsigned i = 0; i < lim; ++i)
+   lim            = ui(gen);
+   for (unsigned i = 0; i < lim; ++i)
    {
       denom *= (gen.max)();
       denom += gen();
@@ -94,9 +94,11 @@ void do_round_trip(const T& val, std::ios_base::fmtflags f, const boost::mpl::fa
 }
 
 template <class T>
-struct is_number : public boost::mpl::false_{};
+struct is_number : public boost::mpl::false_
+{};
 template <class T>
-struct is_number<boost::multiprecision::number<T> > : public boost::mpl::true_{};
+struct is_number<boost::multiprecision::number<T> > : public boost::mpl::true_
+{};
 
 template <class T>
 void do_round_trip(const T& val, std::ios_base::fmtflags f)
@@ -108,17 +110,17 @@ template <class T>
 void do_round_trip(const T& val)
 {
    do_round_trip(val, std::ios_base::fmtflags(0));
-   if(val >= 0)
+   if (val >= 0)
    {
-      do_round_trip(val, std::ios_base::fmtflags(std::ios_base::showbase|std::ios_base::hex));
-      do_round_trip(val, std::ios_base::fmtflags(std::ios_base::showbase|std::ios_base::oct));
+      do_round_trip(val, std::ios_base::fmtflags(std::ios_base::showbase | std::ios_base::hex));
+      do_round_trip(val, std::ios_base::fmtflags(std::ios_base::showbase | std::ios_base::oct));
    }
 }
 
 template <class T>
 void test_round_trip()
 {
-   for(unsigned i = 0; i < 1000; ++i)
+   for (unsigned i = 0; i < 1000; ++i)
    {
       T val = generate_random<T>();
       do_round_trip(val);
@@ -135,12 +137,11 @@ int main()
 #endif
 #ifdef TEST_TOMMATH
    test_round_trip<boost::rational<boost::multiprecision::tom_int> >();
-   test_round_trip<boost::multiprecision::tom_rational >();
+   test_round_trip<boost::multiprecision::tom_rational>();
 #endif
 #ifdef TEST_CPP_INT
    test_round_trip<boost::rational<boost::multiprecision::cpp_int> >();
-   test_round_trip<boost::multiprecision::cpp_rational >();
+   test_round_trip<boost::multiprecision::cpp_rational>();
 #endif
    return boost::report_errors();
 }
-