aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qtest
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-06-20 00:53:22 +0200
committerJay Berkenbilt <ejb@ql.org>2019-06-21 19:17:21 +0200
commita66828caff16a4ad64b9d69b5db1c5a5e60418cc (patch)
tree1f4d5ab4b20668a845d9f7d09b6be5152985c4d3 /libtests/qtest
parentbdf29ca33e1b9cd73c46a71019e88a964a1dd91f (diff)
downloadqpdf-a66828caff16a4ad64b9d69b5db1c5a5e60418cc.tar.zst
New safe type converters in QIntC
Diffstat (limited to 'libtests/qtest')
-rw-r--r--libtests/qtest/qintc.test18
-rw-r--r--libtests/qtest/qintc/qintc.out13
2 files changed, 31 insertions, 0 deletions
diff --git a/libtests/qtest/qintc.test b/libtests/qtest/qintc.test
new file mode 100644
index 00000000..4b2dc3a5
--- /dev/null
+++ b/libtests/qtest/qintc.test
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+require 5.008;
+BEGIN { $^W = 1; }
+use strict;
+
+chdir("qintc") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+my $td = new TestDriver('qintc');
+
+$td->runtest("QINTC",
+ {$td->COMMAND => "qintc"},
+ {$td->FILE => "qintc.out",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES | $td->RM_WS_ONLY_LINES);
+
+$td->report(1);
diff --git a/libtests/qtest/qintc/qintc.out b/libtests/qtest/qintc/qintc.out
new file mode 100644
index 00000000..9b6d35d9
--- /dev/null
+++ b/libtests/qtest/qintc/qintc.out
@@ -0,0 +1,13 @@
+QIntC::to_int<int32_t>(i1): -1153374643 -1153374643 PASSED
+QIntC::to_uint<uint32_t>(u1): 3141592653 3141592653 PASSED
+QIntC::to_int<uint32_t>(u1): integer out of range converting 3141592653 from a 4-byte unsigned type to a 4-byte signed type PASSED
+QIntC::to_uint<int32_t>(i1): integer out of range converting -1153374643 from a 4-byte signed type to a 4-byte unsigned type PASSED
+QIntC::to_int<uint64_t>(ul1): integer out of range converting 1099511627776 from a 8-byte unsigned type to a 4-byte signed type PASSED
+QIntC::to_int<uint64_t>(ul2): 12345 12345 PASSED
+QIntC::to_uint<uint64_t>(ul2): 12345 12345 PASSED
+QIntC::to_offset<uint32_t>(u1): 3141592653 3141592653 PASSED
+QIntC::to_offset<int32_t>(i1): -1153374643 -1153374643 PASSED
+QIntC::to_size<int32_t>(i1): integer out of range converting -1153374643 from a 4-byte signed type to a 8-byte unsigned type PASSED
+QIntC::to_char<int32_t>(i2): 81 Q PASSED
+QIntC::to_uchar<int32_t>(i2): 81 Q PASSED
+QIntC::to_uchar<char>(c1): integer out of range converting ÷ from a 1-byte signed type to a 1-byte unsigned type PASSED