{
- # test exceptions
+ print "# test exceptions\n";
my $x;
eval { $x = unpack 'w', pack 'C*', 0xff, 0xff};
like($@, qr/^Unterminated compressed integer/);
}
-#
-# test the "p" template
+print "# test the 'p' template\n";
# literals
is(unpack("p",pack("p","foo")), "foo");
# see #ifdef __osf__ in pp.c pp_unpack
is((unpack("i",pack("i",-1))), -1);
-# test the pack lengths of s S i I l L
-# test the pack lengths of n N v V
+print "# test the pack lengths of s S i I l L n N v V\n";
+
my @lengths = qw(s 2 S 2 i -4 I -4 l 4 L 4 n 2 N 4 v 2 V 4);
while (my ($format, $expect) = splice @lengths, 0, 2) {
my $len = length(pack($format, 0));
}
-# test unpack-pack lengths
+print "# test unpack-pack lengths\n";
+
my @templates = qw(c C i I s S l L n N v V f d q Q);
foreach my $t (@templates) {
}
}
-# packing native shorts/ints/longs
+print "# packing native shorts/ints/longs\n";
is(length(pack("s!", 0)), $Config{shortsize});
is(length(pack("i!", 0)), $Config{intsize});
$total += $_;
}
}
+ print "# numbers test for $format\n";
foreach (@_) {
SKIP: {
my $out = eval {unpack($format, pack($format, $_))};
0, 1,9223372036854775807, 9223372036854775808,
18446744073709551615);
-# pack nvNV byteorders
+print "# pack nvNV byteorders\n";
is(pack("n", 0xdead), "\xde\xad");
is(pack("v", 0xdead), "\xad\xde");