File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
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 );
12+ std::uniform_int_distribution<> dist (-1 , -1 );
913
1014using namespace boost ::decimal;
1115
@@ -23,7 +27,7 @@ void test_rounding_up()
2327 const auto mode {boost::decimal::fesetround (rounding_mode::fe_dec_upward)};
2428 if (mode != rounding_mode::fe_dec_default)
2529 {
26- const T value {2325 , - 1 }; // The result will be wrong if computed at compile time
30+ const T value {2325 , dist (rng) }; // The result will be wrong if computed at compile time
2731 const auto dec_res {static_cast <int >(nearbyint (value))};
2832 BOOST_TEST_EQ (dec_res, 233 );
2933 }
@@ -35,7 +39,7 @@ void test_rounding_down()
3539 const auto mode {boost::decimal::fesetround (rounding_mode::fe_dec_downward)};
3640 if (mode != rounding_mode::fe_dec_default)
3741 {
38- const T value {2325 , - 1 }; // The result will be wrong if computed at compile time
42+ const T value {2325 , dist (rng) }; // The result will be wrong if computed at compile time
3943 const auto dec_res {static_cast <int >(nearbyint (value))};
4044 BOOST_TEST_EQ (dec_res, 232 );
4145 }
You can’t perform that action at this time.
0 commit comments