Skip to content

Commit 251d0a3

Browse files
committed
Force runtime evaluation
1 parent 3a856fc commit 251d0a3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/github_issue_1105.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
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

1013
using namespace boost::decimal;
1114

1215
template <typename T>
1316
void 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()
3540
int main()
3641
{
3742
test<decimal32_t>();
43+
test<decimal64_t>();
44+
test<decimal128_t>();
3845

3946
return boost::report_errors();
4047
}

0 commit comments

Comments
 (0)