Skip to content

Commit bf5f6a2

Browse files
committed
Test negative values with negative exponents
1 parent 087823a commit bf5f6a2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/test_to_chars_quantum.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,23 @@ constexpr std::array<const char*, 6> decimals_with_exp_strings = {
8686
"4.200000e+51",
8787
};
8888

89+
template <typename T>
90+
const std::array<T, 5> negative_values = {
91+
T {-321, -49},
92+
T {-3210, -50},
93+
T {-32100, -51},
94+
T {-321000, -52},
95+
T {-3210000, -53}
96+
};
97+
98+
constexpr std::array<const char*, 5> negative_values_strings = {
99+
"-3.21e-47",
100+
"-3.210e-47",
101+
"-3.2100e-47",
102+
"-3.21000e-47",
103+
"-3.210000e-47"
104+
};
105+
89106
int main()
90107
{
91108
test_to_chars_scientific(decimals<decimal32_t>, strings);
@@ -96,5 +113,9 @@ int main()
96113
test_to_chars_scientific(decimals_with_exp<decimal64_t>, decimals_with_exp_strings);
97114
test_to_chars_scientific(decimals_with_exp<decimal128_t>, decimals_with_exp_strings);
98115

116+
test_to_chars_scientific(negative_values<decimal32_t>, negative_values_strings);
117+
test_to_chars_scientific(negative_values<decimal64_t>, negative_values_strings);
118+
test_to_chars_scientific(negative_values<decimal128_t>, negative_values_strings);
119+
99120
return boost::report_errors();
100121
}

0 commit comments

Comments
 (0)