#!./perl
# $RCSfile: cmdopt.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:17 $
print "1..44\n";
# test the optimization of constants
if (1) { print "ok 1\n";} else { print "not ok 1\n";}
if (0) { print "not ok 3\n";} else { print "ok 3\n";}
if (!0) { print "ok 6\n";} else { print "not ok 6\n";}
if (!1) { print "not ok 8\n";} else { print "ok 8\n";}
$x = 1;
if (1 && $x) { print "ok 9\n";} else { print "not ok 9\n";}
if (0 && $x) { print "not ok 10\n";} else { print "ok 10\n";}
$x = '';
if (1 && $x) { print "not ok 11\n";} else { print "ok 11\n";}
if (0 && $x) { print "not ok 12\n";} else { print "ok 12\n";}
$x = 1;
if (1 || $x) { print "ok 13\n";} else { print "not ok 13\n";}
if (0 || $x) { print "ok 14\n";} else { print "not ok 14\n";}
$x = '';
if (1 || $x) { print "ok 15\n";} else { print "not ok 15\n";}
if (0 || $x) { print "not ok 16\n";} else { print "ok 16\n";}
# test the optimization of variables
$x = 1;
if ($x) { print "ok 17\n";} else { print "not ok 17\n";}
$x = '';
if ($x) { print "not ok 19\n";} else { print "ok 19\n";}
# test optimization of string operations
$a = 'a';
if ($a =~ /a/) { print "ok 23\n";} else { print "not ok 23\n";}
if ($a !~ /a/) { print "not ok 24\n";} else { print "ok 24\n";}
# test interaction of logicals and other operations
$a = 'a';
$x = 1;
$x = '';
$x = 1;
$x = '';
$x = 1;
if ($a =~ /a/ && $x) { print "ok 33\n";} else { print "not ok 33\n";}
if ($a !~ /a/ && $x) { print "not ok 34\n";} else { print "ok 34\n";}
$x = '';
if ($a =~ /a/ && $x) { print "not ok 35\n";} else { print "ok 35\n";}
if ($a !~ /a/ && $x) { print "not ok 36\n";} else { print "ok 36\n";}
$x = 1;
if ($a =~ /a/ || $x) { print "ok 37\n";} else { print "not ok 37\n";}
if ($a !~ /a/ || $x) { print "ok 38\n";} else { print "not ok 38\n";}
$x = '';
if ($a =~ /a/ || $x) { print "ok 39\n";} else { print "not ok 39\n";}
if ($a !~ /a/ || $x) { print "not ok 40\n";} else { print "ok 40\n";}
$x = 1;
$x = '';