1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5 <meta http-equiv=
"content-type" content=
"text/html; charset=UTF-8">
6 <title>test of bitwise operators mixing integers, null, and undefined
</title>
8 .failure { color: red; }
9 .success { color: green; }
11 <script type=
"text/javascript">
13 if (window
.testRunner
) testRunner
.dumpAsText();
16 document
.getElementById("log").innerHTML
+= msg
;
19 function logTest(expression
, expected
) {
22 result
= eval(expression
);
26 if (result
!= expected
)
27 log("<li class='failure'>FAILED: " + expression
+ " = " + result
+ " -- expected: " + expected
+ "</li>");
29 log("<li class='success'>SUCCESS: " + expression
+ " = " + result
+ "</li>");
34 logTest("0 & null", 0);
35 logTest("0 & undefined", 0);
36 logTest("1 & null", 0);
37 logTest("1 & undefined", 0);
38 logTest("0 | null", 0);
39 logTest("0 | undefined", 0);
40 logTest("1 | null", 1);
41 logTest("1 | undefined", 1);
42 logTest("0 ^ null", 0);
43 logTest("0 ^ undefined", 0);
44 logTest("1 ^ null", 1);
45 logTest("1 ^ undefined", 1);
51 This tests the bitwise operators work correctly in conjunction with undefined and null.
<br />
52 <body onload=
"runTest()">