// 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!!")
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();
}
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)
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);
#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();
}
-