1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!./perl
BEGIN {
chdir 't' if -d 't';
@INC = qw(. ../lib);
}
require "test.pl";
plan( tests => 39 );
$x = 10000;
cmp_ok(0 + ++$x - 1,'==',10000,'scalar ++x - 1');
cmp_ok(0 + $x-- - 1,'==',10000,'scalar x-- - 1');
cmp_ok(1 * $x, '==',10000,'scalar 1 * x');
cmp_ok(0 + $x-- - 0,'==',10000,'scalar x-- - 0');
cmp_ok(1 + $x, '==',10000,'scalar 1 + x');
cmp_ok(1 + $x++, '==',10000,'scalar 1 + x++');
cmp_ok(0 + $x, '==',10000,'scalar x');
cmp_ok(0 + --$x + 1,'==',10000,'scalar --x + 1');
cmp_ok(0 + ++$x + 0,'==',10000,'scalar ++x + 0');
cmp_ok($x, '==',10000,'scalar x final');
$x[0] = 10000;
cmp_ok(0 + ++$x[0] - 1,'==',10000,'aelem ++x - 1');
cmp_ok(0 + $x[0]-- - 1,'==',10000,'aelem x-- - 1');
cmp_ok(1 * $x[0], '==',10000,'aelem 1 * x');
cmp_ok(0 + $x[0]-- - 0,'==',10000,'aelem x-- - 0');
cmp_ok(1 + $x[0], '==',10000,'aelem 1 + x');
cmp_ok(1 + $x[0]++, '==',10000,'aelem 1 + x++');
cmp_ok(0 + $x[0], '==',10000,'aelem x');
cmp_ok(0 + --$x[0] + 1,'==',10000,'aelem --x + 1');
cmp_ok(0 + ++$x[0] + 0,'==',10000,'aelem ++x + 0');
cmp_ok($x[0], '==',10000,'aelem x final');
$x{0} = 10000;
cmp_ok(0 + ++$x{0} - 1,'==',10000,'helem ++x - 1');
cmp_ok(0 + $x{0}-- - 1,'==',10000,'helem x-- - 1');
cmp_ok(1 * $x{0}, '==',10000,'helem 1 * x');
cmp_ok(0 + $x{0}-- - 0,'==',10000,'helem x-- - 0');
cmp_ok(1 + $x{0}, '==',10000,'helem 1 + x');
cmp_ok(1 + $x{0}++, '==',10000,'helem 1 + x++');
cmp_ok(0 + $x{0}, '==',10000,'helem x');
cmp_ok(0 + --$x{0} + 1,'==',10000,'helem --x + 1');
cmp_ok(0 + ++$x{0} + 0,'==',10000,'helem ++x + 0');
cmp_ok($x{0}, '==',10000,'helem x final');
# test magical autoincrement
cmp_ok(++($foo = '99'), 'eq','100','99 incr 100');
cmp_ok(++($foo = "99a"), 'eq','100','99a incr 100');
cmp_ok(++($foo = "99\0a"), 'eq','100','99\0a incr 100');
cmp_ok(++($foo = 'a0'), 'eq','a1','a0 incr a1');
cmp_ok(++($foo = 'Az'), 'eq','Ba','Az incr Ba');
cmp_ok(++($foo = 'zz'), 'eq','aaa','zzz incr aaa');
cmp_ok(++($foo = 'A99'),'eq','B00','A99 incr B00');
cmp_ok(++($foo = 'zi'), 'eq','zj','zi incr zj (EBCDIC i,j non-contiguous check)');
cmp_ok(++($foo = 'zr'), 'eq','zs','zr incr zs (EBCDIC r,s non-contiguous check)');
|