File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 66
77#include < boost/decimal.hpp>
88#include < boost/core/lightweight_test.hpp>
9+ #include < random>
10+
11+ static std::mt19937_64 rng (42 );
912
1013using namespace boost ::decimal;
1114
1215template <typename T>
1316void test ()
1417{
15- const T one {1 , 0 };
18+ std::uniform_int_distribution<int > dist (1 , 1 );
19+
20+ const T one {dist (rng), 0 };
1621 const T zero {0 , 0 };
1722
18- const T val {1 , -5 };
23+ const T val {dist (rng) , -5 };
1924 int val_exp {};
2025 const auto val_sig {frexp10 (val, &val_exp)};
2126
2227 const auto next {nextafter (val, one)};
2328 int next_exp {};
2429 const auto next_sig {frexp10 (next, &next_exp)};
2530 BOOST_TEST_EQ (next_exp, val_exp);
26- BOOST_TEST_EQ (next_sig, val_sig + 1u );
31+ BOOST_TEST_EQ (next_sig, val_sig + 1U );
2732
2833 const auto prev {nextafter (val, zero)};
2934 int prev_exp {};
@@ -35,6 +40,8 @@ void test()
3540int main ()
3641{
3742 test<decimal32_t >();
43+ test<decimal64_t >();
44+ test<decimal128_t >();
3845
3946 return boost::report_errors ();
4047}
You can’t perform that action at this time.
0 commit comments