Skip to content

Commit b9dcbee

Browse files
committed
Add reproducer test set
1 parent 7d44a84 commit b9dcbee

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

test/Jamfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ run-fail benchmark_uint256.cpp ;
4848

4949
run compare_dec128_and_fast.cpp ;
5050
compile-fail concepts_test.cpp ;
51+
5152
run crash_report_1.cpp ;
5253
run github_issue_426.cpp ;
5354
run github_issue_448.cpp ;
@@ -69,6 +70,8 @@ run github_issue_1057.cpp ;
6970
compile-fail github_issue_1087.cpp ;
7071
run github_issue_1091.cpp ;
7172
run github_issue_1094.cpp ;
73+
run github_issue_1112.cpp ;
74+
7275
run link_1.cpp link_2.cpp link_3.cpp ;
7376
run quick.cpp ;
7477
run random_decimal32_comp.cpp ;

test/github_issue_1112.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2025 Matt Borland
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// https://www.boost.org/LICENSE_1_0.txt
4+
//
5+
// See: https://github.com/cppalliance/decimal/issues/1112
6+
7+
#include <boost/decimal.hpp>
8+
#include <boost/core/lightweight_test.hpp>
9+
10+
using namespace boost::decimal;
11+
12+
template <typename T>
13+
void reproducer()
14+
{
15+
const auto dec_res {static_cast<int>(nearbyint(T{2325, -1}))};
16+
const auto dbl_res {static_cast<int>(std::nearbyint(232.5))};
17+
BOOST_TEST_EQ(dec_res, dbl_res);
18+
}
19+
20+
int main()
21+
{
22+
reproducer<decimal32_t>();
23+
reproducer<decimal64_t>();
24+
reproducer<decimal128_t>();
25+
26+
return boost::report_errors();
27+
}

0 commit comments

Comments
 (0)