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