diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-15 14:26:03 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-15 14:26:03 +0000 |
commit | 9f62e1ec6945a49a52880c6619a9badbeb4bb8ea (patch) | |
tree | 8eb24ed98df7be84f8ca74b894eff2c309b3cc60 /t | |
parent | 549a6b102c2ac8c43e32b815191190bc29aef348 (diff) | |
download | perl-9f62e1ec6945a49a52880c6619a9badbeb4bb8ea.tar.gz |
Fix the bin/oct/hex constant overflow tests for
long long platforms.
p4raw-id: //depot/cfgperl@3674
Diffstat (limited to 't')
-rw-r--r-- | t/pragma/warn/util | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/t/pragma/warn/util b/t/pragma/warn/util index ea3aed5cca..fc1e6dde3f 100644 --- a/t/pragma/warn/util +++ b/t/pragma/warn/util @@ -45,8 +45,10 @@ Illegal binary digit '9' ignored at - line 3. BEGIN { require Config ; import Config } $^W =1 ; sub make_bin { "1" x $_[0] } -$n = make_bin(8 * $Config{longsize} ) ; -$o = make_bin(8 * $Config{longsize} + 1) ; +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_bin(8 * $s ) ; +$o = make_bin(8 * $s + 1) ; { use warning 'unsafe' ; my $a = oct "0b$n" ; @@ -56,15 +58,17 @@ $o = make_bin(8 * $Config{longsize} + 1) ; } my $b = oct "0b$o" ; EXPECT -Integer overflow in binary number at - line 10. -Integer overflow in binary number at - line 14. +Integer overflow in binary number at - line 12. +Integer overflow in binary number at - line 16. ######## # util.c BEGIN { require Config ; import Config } $^W =1 ; sub make_oct { ("","1","3")[$_[0]%3] . "7" x int($_[0]/3) } -$n = make_oct(8 * $Config{longsize} ); -$o = make_oct(8 * $Config{longsize} + 1); +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_oct(8 * $s ); +$o = make_oct(8 * $s + 1); { use warning 'unsafe' ; my $a = oct "$n" ; @@ -74,15 +78,17 @@ $o = make_oct(8 * $Config{longsize} + 1); } my $b = oct "$o" ; EXPECT -Integer overflow in octal number at - line 10. -Integer overflow in octal number at - line 14. +Integer overflow in octal number at - line 12. +Integer overflow in octal number at - line 16. ######## # util.c BEGIN { require Config ; import Config } $^W =1 ; sub make_hex { ("","1","3","7")[$_[0]%4] . "f" x int($_[0]/4) } -$n = make_hex(8 * $Config{longsize} ) ; -$o = make_hex(8 * $Config{longsize} + 1) ; +my $s = $Config{longsize}; +eval { pack "q", 0 }; eval { $s = length pack "q", 0 } unless $@; +$n = make_hex(8 * $s ) ; +$o = make_hex(8 * $s + 1) ; { use warning 'unsafe' ; my $a = hex "$n" ; @@ -92,6 +98,6 @@ $o = make_hex(8 * $Config{longsize} + 1) ; } my $b = hex "$o" ; EXPECT -Integer overflow in hexadecimal number at - line 10. -Integer overflow in hexadecimal number at - line 14. +Integer overflow in hexadecimal number at - line 12. +Integer overflow in hexadecimal number at - line 16. |