X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/760ac839baf413929cd31cc32ffd6dba6b781a81..13a704ac64c9ed54ec92d50031172f7eed309d3b:/t/op/inc.t diff --git a/t/op/inc.t b/t/op/inc.t old mode 100644 new mode 100755 index aee91f7..f59115e --- a/t/op/inc.t +++ b/t/op/inc.t @@ -1,16 +1,13 @@ #!./perl - -# $RCSfile$ - -print "1..6\n"; +print "1..12\n"; # Verify that addition/subtraction properly upgrade to doubles. -# These tests are only useful on machines with 32 bit longs, -# and one's complement negation, but shouldn't fail anywhere. +# These tests are only significant on machines with 32 bit longs, +# and two's complement negation, but shouldn't fail anywhere. $a = 2147483647; -$a++; +$c=$a++; if ($a == 2147483648) {print "ok 1\n"} else @@ -50,3 +47,51 @@ if ($a == -2147483649) {print "ok 6\n"} else {print "not ok 6\n";} + +$a = 2147483648; +$a = -$a; +$c=$a--; +if ($a == -2147483649) + {print "ok 7\n"} +else + {print "not ok 7\n";} + +$a = 2147483648; +$a = -$a; +$c=--$a; +if ($a == -2147483649) + {print "ok 8\n"} +else + {print "not ok 8\n";} + +$a = 2147483648; +$a = -$a; +$a=$a-1; +if ($a == -2147483649) + {print "ok 9\n"} +else + {print "not ok 9\n";} + +$a = 2147483648; +$b = -$a; +$c=$b--; +if ($b == -$a-1) + {print "ok 10\n"} +else + {print "not ok 10\n";} + +$a = 2147483648; +$b = -$a; +$c=--$b; +if ($b == -$a-1) + {print "ok 11\n"} +else + {print "not ok 11\n";} + +$a = 2147483648; +$b = -$a; +$b=$b-1; +if ($b == -(++$a)) + {print "ok 12\n"} +else + {print "not ok 12\n";}