Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
04c29d09 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | unshift @INC, '../lib'; |
6 | } |
7 | |
4bb9f687 |
8 | print "1..6\n"; |
8d063cd8 |
9 | |
10 | # compile time evaluation |
11 | |
12 | if (int(1.234) == 1) {print "ok 1\n";} else {print "not ok 1\n";} |
13 | |
14 | if (int(-1.234) == -1) {print "ok 2\n";} else {print "not ok 2\n";} |
15 | |
16 | # run time evaluation |
17 | |
18 | $x = 1.234; |
19 | if (int($x) == 1) {print "ok 3\n";} else {print "not ok 3\n";} |
20 | if (int(-$x) == -1) {print "ok 4\n";} else {print "not ok 4\n";} |
4bb9f687 |
21 | |
22 | $x = length("abc") % -10; |
23 | print $x == -7 ? "ok 5\n" : "# expected -7, got $x\nnot ok 5\n"; |
24 | |
25 | { |
26 | use integer; |
27 | $x = length("abc") % -10; |
28 | print $x == 3 ? "ok 6\n" : "# expected 3, got $x\nnot ok 6\n"; |
29 | } |