Implement new regex escape \N
[p5sagit/p5-mst-13.2.git] / t / op / 64bitint.t
index 5ea1f2d..399030a 100644 (file)
@@ -3,7 +3,7 @@
 BEGIN {
        eval { my $q = pack "q", 0 };
        if ($@) {
-               print "1..0\n# Skip: no 64-bit types\n";
+               print "1..0 # Skip: no 64-bit types\n";
                exit(0);
        }
        chdir 't' if -d 't';
@@ -17,7 +17,7 @@ BEGIN {
 use warnings;
 no warnings qw(overflow portable);
 
-print "1..63\n";
+print "1..67\n";
 
 # as 6 * 6 = 36, the last digit of 6**n will always be six. Hence the last
 # digit of 16**n will always be six. Hence 16**n - 1 will always end in 5.
@@ -172,13 +172,19 @@ if ($^O ne 'unicos') {
     print "ok 28\n";
 
     $a = -9223372036854775808;
-    $c = $a--;
+    {
+       no warnings 'imprecision';
+       $c = $a--;
+    }
     print "not "
        unless $a == -9223372036854775809 && $c == -9223372036854775808;
     print "ok 29\n";
 
     $a = -9223372036854775808;
-    $c = --$a;
+    {
+       no warnings 'imprecision';
+       $c = --$a;
+    }
     print "not "
        unless $a == -9223372036854775809 && $c == $a;
     print "ok 30\n";
@@ -191,14 +197,20 @@ if ($^O ne 'unicos') {
     
     $a = 9223372036854775808;
     $a = -$a;
-    $c = $a--;
+    {
+       no warnings 'imprecision';
+       $c = $a--;
+    }
     print "not "
        unless $a == -9223372036854775809 && $c == -9223372036854775808;
     print "ok 32\n";
     
     $a = 9223372036854775808;
     $a = -$a;
-    $c = --$a;
+    {
+       no warnings 'imprecision';
+       $c = --$a;
+    }
     print "not "
        unless $a == -9223372036854775809 && $c == $a;
     print "ok 33\n";
@@ -212,14 +224,20 @@ if ($^O ne 'unicos') {
 
     $a = 9223372036854775808;
     $b = -$a;
-    $c = $b--;
+    {
+       no warnings 'imprecision';
+       $c = $b--;
+    }
     print "not "
        unless $b == -$a-1 && $c == -$a;
     print "ok 35\n";
 
     $a = 9223372036854775808;
     $b = -$a;
-    $c = --$b;
+    {
+       no warnings 'imprecision';
+       $c = --$b;
+    }
     print "not "
        unless $b == -$a-1 && $c == $b;
     print "ok 36\n";
@@ -379,4 +397,39 @@ if ($q == -9223372036854775806) {
   print "not ok 63 # 0x8000000000000000 % -9223372036854775807 => $q\n";
 }
 
+{
+  use integer;
+  $q = hex "0x123456789abcdef0";
+  if ($q == 0x123456789abcdef0 and $q != 0x123456789abcdef1) {
+    print "ok 64\n";
+  } else {
+    printf "not ok 64 # hex \"0x123456789abcdef0\" = $q (%X)\n", $q;
+    print "# Should not be floating point\n" if $q =~ tr/e.//;
+  }
+
+  $q = oct "0x123456789abcdef0";
+  if ($q == 0x123456789abcdef0 and $q != 0x123456789abcdef1) {
+    print "ok 65\n";
+  } else {
+    printf "not ok 65 # oct \"0x123456789abcdef0\" = $q (%X)\n", $q;
+    print "# Should not be floating point\n" if $q =~ tr/e.//;
+  }
+
+  $q = oct "765432176543217654321";
+  if ($q == 0765432176543217654321 and $q != 0765432176543217654322) {
+    print "ok 66\n";
+  } else {
+    printf "not ok 66 # oct \"765432176543217654321\" = $q (%o)\n", $q;
+    print "# Should not be floating point\n" if $q =~ tr/e.//;
+  }
+
+  $q = oct "0b0101010101010101010101010101010101010101010101010101010101010101";
+  if ($q == 0x5555555555555555 and $q != 0x5555555555555556) {
+    print "ok 67\n";
+  } else {
+    printf "not ok 67 # oct \"0b0101010101010101010101010101010101010101010101010101010101010101\" = $q (%b)\n", $q;
+    print "# Should not be floating point\n" if $q =~ tr/e.//;
+  }
+}
+
 # eof