summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMarcus Holland-Moritz <mhx-perl@gmx.net>2004-04-06 03:40:10 +0000
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2004-04-06 03:40:10 +0000
commit068bd2e7e6b490383a9259507cd9652925bab47a (patch)
treeac7ff206167a9355c1d9ae57a7ca14e990f3bc27 /t
parente0ab1c0e1c533d7f19b4ffe230a3d921bf733a02 (diff)
downloadperl-068bd2e7e6b490383a9259507cd9652925bab47a.tar.gz
Make the ! suffix handle n/N/v/V as signed integers
within pack templates. p4raw-id: //depot/perl@22663
Diffstat (limited to 't')
-rwxr-xr-xt/op/pack.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/op/pack.t b/t/op/pack.t
index 6e3d6e4ff2..a4c8e91652 100755
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-plan tests => 5852;
+plan tests => 6076;
use strict;
use warnings;
@@ -510,6 +510,10 @@ numbers ('n', 0, 1, 32767, 32768, 65535);
numbers ('v', 0, 1, 32767, 32768, 65535);
numbers ('N', 0, 1, 2147483647, 2147483648, 4294967295);
numbers ('V', 0, 1, 2147483647, 2147483648, 4294967295);
+numbers ('n!', -32768, -1, 0, 1, 32767);
+numbers ('v!', -32768, -1, 0, 1, 32767);
+numbers ('N!', -2147483648, -1, 0, 1, 2147483647);
+numbers ('V!', -2147483648, -1, 0, 1, 2147483647);
# All these should have exact binary representations:
numbers ('f', -1, 0, 0.5, 42, 2**34);
numbers ('d', -(2**34), -1, 0, 1, 2**34);
@@ -539,6 +543,11 @@ is(pack("v", 0xdead), "\xad\xde");
is(pack("N", 0xdeadbeef), "\xde\xad\xbe\xef");
is(pack("V", 0xdeadbeef), "\xef\xbe\xad\xde");
+is(pack("n!", 0xdead), "\xde\xad");
+is(pack("v!", 0xdead), "\xad\xde");
+is(pack("N!", 0xdeadbeef), "\xde\xad\xbe\xef");
+is(pack("V!", 0xdeadbeef), "\xef\xbe\xad\xde");
+
{
# /