aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qutil.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-12 09:44:12 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-13 08:30:00 +0100
commit07f40bd25442f25c0af948ae1b0dac7fdff1688c (patch)
tree3fca13d92b02bc3712d98c3c43f9612ae4c56cf1 /libtests/qutil.cc
parent8fbc8579f2481dc3eeb962e99522047291e16fbe (diff)
downloadqpdf-07f40bd25442f25c0af948ae1b0dac7fdff1688c.tar.zst
QUtil::double_to_string: trim trailing zeroes with option to disable
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r--libtests/qutil.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc
index 965c4352..abe05f35 100644
--- a/libtests/qutil.cc
+++ b/libtests/qutil.cc
@@ -117,13 +117,19 @@ void string_conversion_test()
std::cout << QUtil::int_to_string(16059) << std::endl
<< QUtil::int_to_string(16059, 7) << std::endl
<< QUtil::int_to_string(16059, -7) << std::endl
- << QUtil::double_to_string(3.14159) << std::endl
+ << QUtil::double_to_string(3.14159, 0, false) << std::endl
<< QUtil::double_to_string(3.14159, 3) << std::endl
- << QUtil::double_to_string(1000.123, -1024) << std::endl
- << QUtil::double_to_string(.1234, 5) << std::endl
+ << QUtil::double_to_string(1000.123, -1024, false) << std::endl
+ << QUtil::double_to_string(.1234, 5, false) << std::endl
<< QUtil::double_to_string(.0001234, 5) << std::endl
<< QUtil::double_to_string(.123456, 5) << std::endl
<< QUtil::double_to_string(.000123456, 5) << std::endl
+ << QUtil::double_to_string(1.01020, 5, true) << std::endl
+ << QUtil::double_to_string(1.00000, 5, true) << std::endl
+ << QUtil::double_to_string(1, 5, true) << std::endl
+ << QUtil::double_to_string(1, 5, false) << std::endl
+ << QUtil::double_to_string(10, 2, false) << std::endl
+ << QUtil::double_to_string(10, 2, true) << std::endl
<< QUtil::int_to_string_base(16059, 10) << std::endl
<< QUtil::int_to_string_base(16059, 8) << std::endl
<< QUtil::int_to_string_base(16059, 16) << std::endl