1N/A# $RCSfile: subval.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:13 $ 1N/A if ($_[0]) { 'true2'; } 1N/A if ($_[0]) { return 'true2'; } else { return 'true3'; } 1N/A unless ($_[0]) { 'true2'; } else { 'true3'; } 1N/Aif (&foo1(0) eq '0') {
print "ok 1\n";}
else {
print "not ok 1 $foo\n";}
1N/Aif (&foo1(1) eq 'true2') {
print "ok 2\n";}
else {
print "not ok 2\n";}
1N/Aif (&foo2(0) eq 'true3') {
print "ok 3\n";}
else {
print "not ok 3\n";}
1N/Aif (&foo2(1) eq 'true2') {
print "ok 4\n";}
else {
print "not ok 4\n";}
1N/Aif (&foo3(0) eq 'true2') {
print "ok 5\n";}
else {
print "not ok 5\n";}
1N/Aif (&foo3(1) eq '1') {
print "ok 6\n";}
else {
print "not ok 6\n";}
1N/Aif (&foo4(0) eq 'true2') {
print "ok 7\n";}
else {
print "not ok 7\n";}
1N/Aif (&foo4(1) eq 'true3') {
print "ok 8\n";}
else {
print "not ok 8\n";}
1N/Aif (&foo5(0) eq '0') {
print "ok 9\n";}
else {
print "not ok 9\n";}
1N/Aif (&foo5(1) eq 'true2') {
print "ok 10\n";}
else {
print "not ok 10\n";}
1N/Aif (&foo6(0) eq 'true2') {
print "ok 11\n";}
else {
print "not ok 11\n";}
1N/Aif (&foo6(1) eq '1') {
print "ok 12\n";}
else {
print "not ok 12 $x\n";}
1N/A# Now test to see that recursion works using a Fibonacci number generator 1N/A@
good =
(0,1,1,2,3,5,8,13,21,34,55,89);
1N/Afor ($i = 1; $i <= 10; $i++) { 1N/Aprint $x
eq '1:2:3' ?
"ok 26\n" :
"not ok 26 $x\n";
1N/A print "$p:$f:$l" eq "$P:$F:$L" ? "ok $num\n" : "not ok $num $p:$f:$l ne $P:$F:$L\n"; 1N/Aprint FOO "blah blah\n"; 1N/Aclose F or die "Can't close: $!"; 1N/A eof F ? print "not ok $i\n" : print "ok $i\n"; 1N/A close F or die "Can't close: $!"; 1N/A eof UNIQ ? print "(not ok $i)\n" : print "ok $i\n"; 1N/A eof F ? print "not ok $main'i\n" : print "ok $main'i\n"; 1N/A eof F ? print "not ok $main'i\n" : print "ok $main'i\n";