diff options
author | Bo Lindbergh <blgl@stacken.kth.se> | 2010-07-05 00:04:46 +0200 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2010-07-06 08:01:39 -0400 |
commit | 333f87f24de2f15740185612410ef911ccfed6a3 (patch) | |
tree | 0eb5cf49b613d51b7b716d3070879b6266355c5d /t/base | |
parent | 8d4088782934a96fb4c8a4688f9c24f45ea353fa (diff) | |
download | perl-333f87f24de2f15740185612410ef911ccfed6a3.tar.gz |
Tests for allowing uppercase X/B in hexadecimal/binary numbers (#76296).
Signed-off-by: David Golden <dagolden@cpan.org>
Diffstat (limited to 't/base')
-rw-r--r-- | t/base/num.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/base/num.t b/t/base/num.t index 06eea527f7..fbeddc9434 100644 --- a/t/base/num.t +++ b/t/base/num.t @@ -1,6 +1,6 @@ #!./perl -print "1..50\n"; +print "1..53\n"; # First test whether the number stringification works okay. # (Testing with == would exercize the IV/NV part, not the PV.) @@ -50,6 +50,8 @@ print $a eq "256" ? "ok 14\n" : "not ok 14 # $a\n"; $a = 1000; "$a"; print $a eq "1000" ? "ok 15\n" : "not ok 15 # $a\n"; +# more hex and binary tests below starting at 51 + # Okay, now test the numerics. # We may be assuming too much, given the painfully well-known floating # point sloppiness, but the following are still quite reasonable @@ -196,3 +198,14 @@ print $a == 10.0 ? "ok 49\n" : "not ok 49\n"; $a = 57.295779513082320876798154814169; print ok($a*10,572.95779513082320876798154814169,1e-10) ? "ok 50\n" : "not ok 50 # $a\n"; + +# Allow uppercase base markers (#76296) + +$a = 0Xabcdef; "$a"; +print $a eq "11259375" ? "ok 51\n" : "not ok 51 # $a\n"; + +$a = 0XFEDCBA; "$a"; +print $a eq "16702650" ? "ok 52\n" : "not ok 52 # $a\n"; + +$a = 0B1101; "$a"; +print $a eq "13" ? "ok 53\n" : "not ok 53 # $a\n"; |