Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / bitwise-and-on-undefined.html
blob15aa4fc37c76197de06d12737d70bdc4290a4ecd
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
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">
13 if (window.testRunner) testRunner.dumpAsText();
15 function log(msg) {
16 document.getElementById("log").innerHTML += msg;
19 function logTest(expression, expected) {
20 var result;
21 try {
22 result = eval(expression);
23 } catch (e) {
24 result = e;
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>");
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);
48 </script>
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>