4 # test the logical operators '&&', '||', '!', 'and', 'or', 'not'
15 for my $i (undef, 0 .. 2, "", "0 but true") {
18 for my $j (undef, 0 .. 2, "", "0 but true") {
20 ((!$i || !$j) != !($i && $j))
21 or (!($i || $j) != (!$i && !$j))
22 or (!!($i || $j) != !(!$i && !$j))
23 or (!(!$i || !$j) != !!($i && $j))
26 ((!$i || !$j) == !!($i && $j))
27 and (!!($i || $j) == (!$i && !$j))
28 and ((!$i || $j) == ($i && !$j))
29 and (($i || !$j) != (!$i && $j))
37 print "ok ", ++$test, "\n";
42 (($i ||= 1) &&= 3) += 4;
43 print "not " unless $i == 7;
44 print "ok ", ++$test, "\n";
48 print "not " unless $i == 8;
49 print "ok ", ++$test, "\n";
52 $i = !$x || !$x || !$x || $y;
53 print "not " unless $i == 9;
54 print "ok ", ++$test, "\n";
59 print "not " unless $i == 10;
60 print "ok ", ++$test, "\n";
63 $i = !$x && !$x && !$x && $y;
64 print "not " unless $i == 11;
65 print "ok ", ++$test, "\n";