From 07f40bd25442f25c0af948ae1b0dac7fdff1688c Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 12 Feb 2021 03:44:12 -0500 Subject: QUtil::double_to_string: trim trailing zeroes with option to disable --- libtests/qutil.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libtests/qutil.cc') 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 -- cgit v1.2.3-54-g00ecf