Skip to content

Commit 7129335

Browse files
committed
Add reproducer
1 parent 36b0954 commit 7129335

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

test/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ run github_issue_799.cpp ;
5454
run github_issue_802.cpp ;
5555
run github_issue_805.cpp ;
5656
run github_issue_808.cpp ;
57+
run github_issue_900.cpp ;
5758
run link_1.cpp link_2.cpp link_3.cpp ;
5859
run quick.cpp ;
5960
run random_decimal32_comp.cpp ;

test/github_issue_900.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
#include <boost/decimal.hpp>
6+
#include <boost/core/lightweight_test.hpp>
7+
8+
using namespace boost::decimal;
9+
10+
template <typename Dec>
11+
void to_chars_helper()
12+
{
13+
const Dec default_value;
14+
char buffer[64];
15+
16+
const auto r = to_chars(buffer, buffer + sizeof(buffer), default_value);
17+
18+
if (BOOST_TEST(r))
19+
{
20+
*r.ptr = '\0';
21+
BOOST_TEST_CSTR_EQ(buffer, "0.0e+00");
22+
}
23+
}
24+
25+
int main()
26+
{
27+
to_chars_helper<decimal32>();
28+
to_chars_helper<decimal64>();
29+
to_chars_helper<decimal128>();
30+
31+
to_chars_helper<decimal32_fast>();
32+
to_chars_helper<decimal64_fast>();
33+
to_chars_helper<decimal128_fast>();
34+
35+
return boost::report_errors();
36+
}

0 commit comments

Comments
 (0)