3 # $Header: cmd.subval,v 3.0 89/10/18 15:24:52 lwall Locked $
7 if ($_[0]) { 'true2'; }
12 if ($_[0]) { return 'true2'; } else { return 'true3'; }
18 unless ($_[0]) { 'true2'; }
23 unless ($_[0]) { 'true2'; } else { 'true3'; }
38 if (do foo1(0) eq '0') {print "ok 1\n";} else {print "not ok 1 $foo\n";}
39 if (do foo1(1) eq 'true2') {print "ok 2\n";} else {print "not ok 2\n";}
40 if (do foo2(0) eq 'true3') {print "ok 3\n";} else {print "not ok 3\n";}
41 if (do foo2(1) eq 'true2') {print "ok 4\n";} else {print "not ok 4\n";}
43 if (do foo3(0) eq 'true2') {print "ok 5\n";} else {print "not ok 5\n";}
44 if (do foo3(1) eq '1') {print "ok 6\n";} else {print "not ok 6\n";}
45 if (do foo4(0) eq 'true2') {print "ok 7\n";} else {print "not ok 7\n";}
46 if (do foo4(1) eq 'true3') {print "ok 8\n";} else {print "not ok 8\n";}
48 if (do foo5(0) eq '0') {print "ok 9\n";} else {print "not ok 9\n";}
49 if (do foo5(1) eq 'true2') {print "ok 10\n";} else {print "not ok 10\n";}
50 if (do foo6(0) eq 'true2') {print "ok 11\n";} else {print "not ok 11\n";}
51 if (do foo6(1) eq '1') {print "ok 12\n";} else {print "not ok 12 $x\n";}
53 # Now test to see that recursion works using a Fibonacci number generator
63 $foo = do fib($arg-1) + do fib($arg-2);
69 @good = (0,1,1,2,3,5,8,13,21,34,55,89);
71 for ($i = 1; $i <= 10; $i++) {
73 if (do fib($i) == $good[$i]) {
77 print "not ok $foo\n";
85 print &ary1 eq 3 ? "ok 23\n" : "not ok 23\n";
87 print join(':',&ary1) eq '1:2:3' ? "ok 24\n" : "not ok 24\n";
97 print &ary2 eq 3 ? "ok 25\n" : "not ok 25\n";
100 print $x eq '1:2:3' ? "ok 26\n" : "not ok 26 $x\n";