| 1 | # tests loops. noop is a hack for perl>5.6 where | ||||||||||
| 2 | # the closing "}" of a loop counts as being executed if loop is empty. | ||||||||||
| 3 | |||||||||||
| 4 | 16 | my $_z; | |||||||||
| 5 | 6560 | ▶ | sub noop { | ||||||||
|
Subroutine
noop: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 6560 | $_z++; | |||||||||
| 7 | } | ||||||||||
| 8 | |||||||||||
| 9 | 16 | ▶ | sub foo { | ||||||||
|
Subroutine
foo: called CC=3 SCAR=11.0
| |||||||||||
| 10 | 16 | print "in sub foo\n"; | |||||||||
| 11 | 16 | foreach (1 .. 10) { | |||||||||
| 12 | 160 | noop(); | |||||||||
| 13 | 160 | foreach (1 .. 10) { | |||||||||
| 14 | 1600 | noop(); | |||||||||
| 15 | } | ||||||||||
| 16 | } | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 16 | ▶ | sub bar { | ||||||||
|
Subroutine
bar: called CC=3 SCAR=11.0
| |||||||||||
| 20 | 16 | print "in sub bar\n"; | |||||||||
| 21 | 16 | my ($x, $y); | |||||||||
| 22 | 16 | ▶ | while (10 > $x++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 160 | $y = 0; | |||||||||
| 24 | 160 | ▶ | while (10 > $y++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 1600 | noop(); | |||||||||
| 26 | } | ||||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 16 | ▶ | sub baz { | ||||||||
|
Subroutine
baz: called CC=3 SCAR=11.0
| |||||||||||
| 31 | 16 | print "in sub baz\n"; | |||||||||
| 32 | 16 | my ($x, $y) = (1); | |||||||||
| 33 | 16 | ▶ | do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 160 | $y = 1; | |||||||||
| 35 | 160 | ▶ | do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 1600 | noop(); | |||||||||
| 37 | 1600 | noop(); | |||||||||
| 38 | } while(10 > $y++); | ||||||||||
| 39 | } while(10 > $x++); | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 16 | foo(); | |||||||||
| 43 | 16 | bar(); | |||||||||
| 44 | 16 | baz(); | |||||||||