This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Module-Build-0.28
[perl5.git] / t / op / auto.t
CommitLineData
8d063cd8
LW
1#!./perl
2
9d116dd7 3print "1..37\n";
8d063cd8
LW
4
5$x = 10000;
6if (0 + ++$x - 1 == 10000) { print "ok 1\n";} else {print "not ok 1\n";}
7if (0 + $x-- - 1 == 10000) { print "ok 2\n";} else {print "not ok 2\n";}
8if (1 * $x == 10000) { print "ok 3\n";} else {print "not ok 3\n";}
9if (0 + $x-- - 0 == 10000) { print "ok 4\n";} else {print "not ok 4\n";}
10if (1 + $x == 10000) { print "ok 5\n";} else {print "not ok 5\n";}
11if (1 + $x++ == 10000) { print "ok 6\n";} else {print "not ok 6\n";}
12if (0 + $x == 10000) { print "ok 7\n";} else {print "not ok 7\n";}
13if (0 + --$x + 1 == 10000) { print "ok 8\n";} else {print "not ok 8\n";}
14if (0 + ++$x + 0 == 10000) { print "ok 9\n";} else {print "not ok 9\n";}
15if ($x == 10000) { print "ok 10\n";} else {print "not ok 10\n";}
16
17$x[0] = 10000;
18if (0 + ++$x[0] - 1 == 10000) { print "ok 11\n";} else {print "not ok 11\n";}
19if (0 + $x[0]-- - 1 == 10000) { print "ok 12\n";} else {print "not ok 12\n";}
20if (1 * $x[0] == 10000) { print "ok 13\n";} else {print "not ok 13\n";}
21if (0 + $x[0]-- - 0 == 10000) { print "ok 14\n";} else {print "not ok 14\n";}
22if (1 + $x[0] == 10000) { print "ok 15\n";} else {print "not ok 15\n";}
23if (1 + $x[0]++ == 10000) { print "ok 16\n";} else {print "not ok 16\n";}
24if (0 + $x[0] == 10000) { print "ok 17\n";} else {print "not ok 17\n";}
25if (0 + --$x[0] + 1 == 10000) { print "ok 18\n";} else {print "not ok 18\n";}
26if (0 + ++$x[0] + 0 == 10000) { print "ok 19\n";} else {print "not ok 19\n";}
27if ($x[0] == 10000) { print "ok 20\n";} else {print "not ok 20\n";}
28
29$x{0} = 10000;
30if (0 + ++$x{0} - 1 == 10000) { print "ok 21\n";} else {print "not ok 21\n";}
31if (0 + $x{0}-- - 1 == 10000) { print "ok 22\n";} else {print "not ok 22\n";}
32if (1 * $x{0} == 10000) { print "ok 23\n";} else {print "not ok 23\n";}
33if (0 + $x{0}-- - 0 == 10000) { print "ok 24\n";} else {print "not ok 24\n";}
34if (1 + $x{0} == 10000) { print "ok 25\n";} else {print "not ok 25\n";}
35if (1 + $x{0}++ == 10000) { print "ok 26\n";} else {print "not ok 26\n";}
36if (0 + $x{0} == 10000) { print "ok 27\n";} else {print "not ok 27\n";}
37if (0 + --$x{0} + 1 == 10000) { print "ok 28\n";} else {print "not ok 28\n";}
38if (0 + ++$x{0} + 0 == 10000) { print "ok 29\n";} else {print "not ok 29\n";}
39if ($x{0} == 10000) { print "ok 30\n";} else {print "not ok 30\n";}
378cc40b
LW
40
41# test magical autoincrement
42
43if (++($foo = '99') eq '100') {print "ok 31\n";} else {print "not ok 31\n";}
44if (++($foo = 'a0') eq 'a1') {print "ok 32\n";} else {print "not ok 32\n";}
45if (++($foo = 'Az') eq 'Ba') {print "ok 33\n";} else {print "not ok 33\n";}
46if (++($foo = 'zz') eq 'aaa') {print "ok 34\n";} else {print "not ok 34\n";}
9d116dd7
JH
47if (++($foo = 'A99') eq 'B00') {print "ok 35\n";} else {print "not ok 35\n";}
48# EBCDIC guards: i and j, r and s, are not contiguous.
49if (++($foo = 'zi') eq 'zj') {print "ok 36\n";} else {print "not ok 36\n";}
50if (++($foo = 'zr') eq 'zs') {print "ok 37\n";} else {print "not ok 37\n";}