From a66828caff16a4ad64b9d69b5db1c5a5e60418cc Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 19 Jun 2019 18:53:22 -0400 Subject: New safe type converters in QIntC --- libtests/qtest/qintc.test | 18 ++++++++++++++++++ libtests/qtest/qintc/qintc.out | 13 +++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 libtests/qtest/qintc.test create mode 100644 libtests/qtest/qintc/qintc.out (limited to 'libtests/qtest') 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(i1): -1153374643 -1153374643 PASSED +QIntC::to_uint(u1): 3141592653 3141592653 PASSED +QIntC::to_int(u1): integer out of range converting 3141592653 from a 4-byte unsigned type to a 4-byte signed type PASSED +QIntC::to_uint(i1): integer out of range converting -1153374643 from a 4-byte signed type to a 4-byte unsigned type PASSED +QIntC::to_int(ul1): integer out of range converting 1099511627776 from a 8-byte unsigned type to a 4-byte signed type PASSED +QIntC::to_int(ul2): 12345 12345 PASSED +QIntC::to_uint(ul2): 12345 12345 PASSED +QIntC::to_offset(u1): 3141592653 3141592653 PASSED +QIntC::to_offset(i1): -1153374643 -1153374643 PASSED +QIntC::to_size(i1): integer out of range converting -1153374643 from a 4-byte signed type to a 8-byte unsigned type PASSED +QIntC::to_char(i2): 81 Q PASSED +QIntC::to_uchar(i2): 81 Q PASSED +QIntC::to_uchar(c1): integer out of range converting ÷ from a 1-byte signed type to a 1-byte unsigned type PASSED -- cgit v1.2.3-54-g00ecf