aboutsummaryrefslogtreecommitdiffstats
path: root/libtests
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-15 20:56:04 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-16 19:39:26 +0200
commit60ec94a7c35ff3f7153c99deff29afef91500622 (patch)
tree91de8c310c6c0f8e5803d6b3ede4f00e5f3048ed /libtests
parent173b944ef8f1dd3f971a6089a52fcd1ae07ca8f1 (diff)
downloadqpdf-60ec94a7c35ff3f7153c99deff29afef91500622.tar.zst
Add QUtil::is_long_long
Diffstat (limited to 'libtests')
-rw-r--r--libtests/qtest/qutil/qutil.out2
-rw-r--r--libtests/qutil.cc25
2 files changed, 27 insertions, 0 deletions
diff --git a/libtests/qtest/qutil/qutil.out b/libtests/qtest/qutil/qutil.out
index e9c53170..d91acba9 100644
--- a/libtests/qtest/qutil/qutil.out
+++ b/libtests/qtest/qutil/qutil.out
@@ -129,3 +129,5 @@ delete file
D:20210209144925-05'00'
D:20210210011925+05'30'
D:20210209191925Z
+---- is_long_long
+done
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;
}