Commit | Line | Data |
---|---|---|
8d063cd8 LW |
1 | #!./perl |
2 | ||
59110972 | 3 | print "1..13\n"; |
8d063cd8 LW |
4 | |
5 | print "ok 1\n" if 1; | |
6 | print "not ok 1\n" unless 1; | |
7 | ||
8 | print "ok 2\n" unless 0; | |
9 | print "not ok 2\n" if 0; | |
10 | ||
11 | 1 && (print "not ok 3\n") if 0; | |
12 | 1 && (print "ok 3\n") if 1; | |
13 | 0 || (print "not ok 4\n") if 0; | |
14 | 0 || (print "ok 4\n") if 1; | |
15 | ||
16 | $x = 0; | |
17 | do {$x[$x] = $x;} while ($x++) < 10; | |
18 | if (join(' ',@x) eq '0 1 2 3 4 5 6 7 8 9 10') { | |
19 | print "ok 5\n"; | |
20 | } else { | |
79072805 | 21 | print "not ok 5 @x\n"; |
8d063cd8 LW |
22 | } |
23 | ||
24 | $x = 15; | |
25 | $x = 10 while $x < 10; | |
26 | if ($x == 15) {print "ok 6\n";} else {print "not ok 6\n";} | |
a687059c | 27 | |
ecca16b0 CS |
28 | $y[$_] = $_ * 2 foreach @x; |
29 | if (join(' ',@y) eq '0 2 4 6 8 10 12 14 16 18 20') { | |
30 | print "ok 7\n"; | |
31 | } else { | |
32 | print "not ok 7 @y\n"; | |
33 | } | |
34 | ||
2722144b | 35 | # Well this is fragile... |
2b17841a | 36 | open(foo,'./TEST') || open(foo,'TEST') || open(foo,'t/TEST'); |
a687059c LW |
37 | $x = 0; |
38 | $x++ while <foo>; | |
2722144b | 39 | print $x > 50 && $x < 2000 ? "ok 8\n" : "not ok 8\n"; |
1aec8766 | 40 | |
41 | $x = -0.5; | |
42 | print "not " if scalar($x) < 0 and $x >= 0; | |
ecca16b0 | 43 | print "ok 9\n"; |
1aec8766 | 44 | |
45 | print "not " unless (-(-$x) < 0) == ($x < 0); | |
ecca16b0 | 46 | print "ok 10\n"; |
1aec8766 | 47 | |
ecca16b0 CS |
48 | print "ok 11\n" if $x < 0; |
49 | print "not ok 11\n" unless $x < 0; | |
1aec8766 | 50 | |
ecca16b0 CS |
51 | print "ok 12\n" unless $x > 0; |
52 | print "not ok 12\n" if $x > 0; | |
1aec8766 | 53 | |
59110972 RH |
54 | # This used to cause a segfault |
55 | $x = "".("".do{"foo" for (1)}); | |
56 | print "ok 13\n"; |