summaryrefslogtreecommitdiff
path: root/t/op/pack.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2002-03-16 21:52:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-18 13:40:28 +0000
commit196b62db48c48e65dfbfa734e2c0981779160ea3 (patch)
tree841f1a95a572f7adba292306d6908fa3393e7816 /t/op/pack.t
parent34073cabb53a557532d5a01f749b64f7e241d789 (diff)
downloadperl-196b62db48c48e65dfbfa734e2c0981779160ea3.tar.gz
another pack "w" thing
Message-ID: <20020316215215.GF330@Bagpuss.unfortu.net> p4raw-id: //depot/perl@15287
Diffstat (limited to 't/op/pack.t')
-rwxr-xr-xt/op/pack.t21
1 files changed, 19 insertions, 2 deletions
diff --git a/t/op/pack.t b/t/op/pack.t
index 6b812363b2..20fdb37eb7 100755
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-plan tests => 5619;
+plan tests => 5625;
use strict;
use warnings;
@@ -122,11 +122,28 @@ sub list_eq ($$) {
$y = pack('w*', Math::BigInt::->new(5000000000));
};
is($x, $y);
+
+ $x = pack 'w', ~0;
+ $y = pack 'w', (~0).'';
+ is($x, $y);
+ is(unpack ('w',$x), ~0);
+ is(unpack ('w',$y), ~0);
+
+ $x = pack 'w', ~0 - 1;
+ $y = pack 'w', (~0) - 2;
+
+ if (~0 - 1 == (~0) - 2) {
+ is($x, $y, "NV arithmetic");
+ } else {
+ isnt($x, $y, "IV/NV arithmetic");
+ }
+ cmp_ok(unpack ('w',$x), '==', ~0 - 1);
+ cmp_ok(unpack ('w',$y), '==', ~0 - 2);
}
{
- # test exeptions
+ # test exceptions
my $x;
eval { $x = unpack 'w', pack 'C*', 0xff, 0xff};
like($@, qr/^Unterminated compressed integer/);