Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
[WebKit-https.git] / LayoutTests / fast / js / bitwise-and-on-undefined.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
3 <html>
4     <head>
5         <meta http-equiv="content-type" content="text/html; charset=UTF-8">
6         <title>test of bitwise operators mixing integers, null, and undefined</title>
7         <style>
8             .failure { color: red; }
9             .success { color: green; }
10         </style>
11         <script type="text/javascript">
12
13             if (window.layoutTestController)  layoutTestController.dumpAsText();
14
15             function log(msg) {
16                 document.getElementById("log").innerHTML += msg;
17             }
18
19             function logTest(expression, expected) {
20                 var result;
21                 try {
22                     result = eval(expression);
23                 } catch (e) {
24                     result = e;
25                 }
26                 if (result != expected)
27                     log("<li class='failure'>FAILED: " + expression + " = " + result + " -- expected: " + expected + "</li>");
28                 else
29                     log("<li class='success'>SUCCESS: " + expression + " = " + result + "</li>");
30                 
31             }
32             
33             function runTest() {
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);
46             }
47             
48         </script>
49         
50     </head>
51     This tests the bitwise operators work correctly in conjunction with undefined and null.<br />
52     <body onload="runTest()">
53         <ul id="log"></ul>
54     </body>
55 </html>