summaryrefslogtreecommitdiffstats
path: root/libtests/qutil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r--libtests/qutil.cc57
1 files changed, 5 insertions, 52 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc
index ad77f3ea..4e8c7362 100644
--- a/libtests/qutil.cc
+++ b/libtests/qutil.cc
@@ -19,58 +19,11 @@ void string_conversion_test()
<< QUtil::int_to_string(16059, -7) << std::endl
<< QUtil::double_to_string(3.14159) << std::endl
<< QUtil::double_to_string(3.14159, 3) << std::endl
- << QUtil::double_to_string(1000.123, -1024) << std::endl;
-
- try
- {
- // int_to_string bounds error
- std::cout << QUtil::int_to_string(1, 50) << std::endl;
- }
- catch (std::logic_error &e)
- {
- std::cout << "exception 1: " << e.what() << std::endl;
- }
-
- try
- {
- // QUtil::int_to_string bounds error
- std::cout << QUtil::int_to_string(1, -50) << std::endl;
- }
- catch (std::logic_error& e)
- {
- std::cout << "exception 2: " << e.what() << std::endl;
- }
-
- try
- {
- // QUtil::int_to_string bounds error
- std::cout << QUtil::int_to_string(-1, 49) << std::endl;
- }
- catch (std::logic_error& e)
- {
- std::cout << "exception 3: " << e.what() << std::endl;
- }
-
-
- try
- {
- // QUtil::double_to_string bounds error
- std::cout << QUtil::double_to_string(3.14159, 1024) << std::endl;
- }
- catch (std::logic_error& e)
- {
- std::cout << "exception 4: " << e.what() << std::endl;
- }
-
- try
- {
- // QUtil::double_to_string bounds error
- std::cout << QUtil::double_to_string(1000.0, 95) << std::endl;
- }
- catch (std::logic_error& e)
- {
- std::cout << "exception 5: " << e.what() << std::endl;
- }
+ << QUtil::double_to_string(1000.123, -1024) << std::endl
+ << QUtil::double_to_string(.1234, 5) << 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;
std::string embedded_null = "one";
embedded_null += '\0';