summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-03-19 09:24:18 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-03-19 09:24:18 +0000
commit03bfcac8f4be6db5e31d8e504887b86016c2bc4e (patch)
tree237b61078bd9579c107d1f20a5fa25e9ca1fbeef /t/op
parent5463e635e29aad1605d20ed3ea9f8b3e487e0102 (diff)
parent64c66fb6d001b6ad9c6dcec93084b647d4c6eb13 (diff)
downloadperl-03bfcac8f4be6db5e31d8e504887b86016c2bc4e.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@15315
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/pack.t23
1 files changed, 20 insertions, 3 deletions
diff --git a/t/op/pack.t b/t/op/pack.t
index 6b812363b2..42be19e598 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/);
@@ -319,7 +336,7 @@ sub numbers_with_total {
# UVs (in which case ~0 is NV, ~0-1 will be the same NV) then we can't
# correctly in perl calculate UV totals for long checksums, as pp_unpack
# is using UV maths, and we've only got NVs.
- $skip_if_longer_than = $Config{d_nv_preserves_uv_bits};
+ $skip_if_longer_than = $Config{nv_preserves_uv_bits};
}
foreach ('', 1, 2, 3, 15, 16, 17, 31, 32, 33, 53, 54, 63, 64, 65) {