Skip to content

Commit 49ba4bb

Browse files
committed
Add additional powers of ten testing
1 parent 0328e0f commit 49ba4bb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/test_to_chars.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,25 @@ void test_777()
774774
test_value(value3, "-2111000000", chars_format::fixed, 0);
775775
}
776776

777+
template <typename T>
778+
void test_more_powers_10()
779+
{
780+
test_value(T{1, -6}, "0.000001", chars_format::fixed);
781+
test_value(T{1, -5}, "0.00001", chars_format::fixed);
782+
test_value(T{1, -4}, "0.0001", chars_format::fixed);
783+
test_value(T{1, -3}, "0.001", chars_format::fixed);
784+
test_value(T{1, -2}, "0.01", chars_format::fixed);
785+
test_value(T{1, -1}, "0.1", chars_format::fixed);
786+
test_value(T{1, 0}, "1", chars_format::fixed);
787+
test_value(T{1, 1}, "10", chars_format::fixed);
788+
test_value(T{1, 2}, "100", chars_format::fixed);
789+
test_value(T{1, 3}, "1000", chars_format::fixed);
790+
test_value(T{1, 4}, "10000", chars_format::fixed);
791+
test_value(T{1, 5}, "100000", chars_format::fixed);
792+
test_value(T{1, 6}, "1000000", chars_format::fixed);
793+
test_value(T{1, 7}, "10000000", chars_format::fixed);
794+
}
795+
777796
int main()
778797
{
779798
test_non_finite_values<decimal32>();
@@ -884,6 +903,10 @@ int main()
884903
test_777<decimal64_fast>();
885904
test_777<decimal128_fast>();
886905

906+
test_more_powers_10<decimal32>();
907+
test_more_powers_10<decimal64>();
908+
test_more_powers_10<decimal128>();
909+
887910
return boost::report_errors();
888911
}
889912

0 commit comments

Comments
 (0)