diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-15 20:56:04 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-16 19:39:26 +0200 |
commit | 60ec94a7c35ff3f7153c99deff29afef91500622 (patch) | |
tree | 91de8c310c6c0f8e5803d6b3ede4f00e5f3048ed /libtests/qutil.cc | |
parent | 173b944ef8f1dd3f971a6089a52fcd1ae07ca8f1 (diff) | |
download | qpdf-60ec94a7c35ff3f7153c99deff29afef91500622.tar.zst |
Add QUtil::is_long_long
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r-- | libtests/qutil.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc index f79f9a3f..ea0aece7 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -676,6 +676,29 @@ timestamp_test() QUtil::qpdf_time_to_pdf_time(QUtil::get_current_qpdf_time()))); } +void +is_long_long_test() +{ + auto check = [](char const* s, bool v) { + if (QUtil::is_long_long(s) != v) { + std::cout << "failed: " << s << std::endl; + } + }; + check("12312312", true); + check("12312312.34", false); + check("-12312312", true); + check("-12312312.34", false); + check("1e2", false); + check("9223372036854775807", true); + check("9223372036854775808", false); + check("-9223372036854775808", true); + check("-9223372036854775809", false); + check("123123123123123123123123123123123123", false); + check("potato", false); + check("0123", false); + std::cout << "done" << std::endl; +} + int main(int argc, char* argv[]) { @@ -710,6 +733,8 @@ main(int argc, char* argv[]) rename_delete_test(); std::cout << "---- timestamp" << std::endl; timestamp_test(); + std::cout << "---- is_long_long" << std::endl; + is_long_long_test(); } catch (std::exception& e) { std::cout << "unexpected exception: " << e.what() << std::endl; } |