This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test case for change#5700 (from M. J. T. Guy)
[perl5.git]
/
t
/
op
/
int.t
diff --git
a/t/op/int.t
b/t/op/int.t
old mode 100644
(file)
new mode 100755
(executable)
index
ff351aa
..
6ac0866
--- a/
t/op/int.t
+++ b/
t/op/int.t
@@
-1,8
+1,11
@@
#!./perl
#!./perl
-# $Header: int.t,v 4.0 91/03/20 01:53:08 lwall Locked $
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
-print "1..
4
\n";
+print "1..
6
\n";
# compile time evaluation
# compile time evaluation
@@
-15,3
+18,13
@@
if (int(-1.234) == -1) {print "ok 2\n";} else {print "not ok 2\n";}
$x = 1.234;
if (int($x) == 1) {print "ok 3\n";} else {print "not ok 3\n";}
if (int(-$x) == -1) {print "ok 4\n";} else {print "not ok 4\n";}
$x = 1.234;
if (int($x) == 1) {print "ok 3\n";} else {print "not ok 3\n";}
if (int(-$x) == -1) {print "ok 4\n";} else {print "not ok 4\n";}
+
+$x = length("abc") % -10;
+print $x == -7 ? "ok 5\n" : "# expected -7, got $x\nnot ok 5\n";
+
+{
+ use integer;
+ $x = length("abc") % -10;
+ $y = (3/-10)*-10;
+ print $x+$y == 3 && abs($x) < 10 ? "ok 6\n" : "not ok 6\n";
+}