blob: 15aa4fc37c76197de06d12737d70bdc4290a4ecd [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>test of bitwise operators mixing integers, null, and undefined</title>
<style>
.failure { color: red; }
.success { color: green; }
</style>
<script type="text/javascript">
if (window.testRunner) testRunner.dumpAsText();
function log(msg) {
document.getElementById("log").innerHTML += msg;
}
function logTest(expression, expected) {
var result;
try {
result = eval(expression);
} catch (e) {
result = e;
}
if (result != expected)
log("<li class='failure'>FAILED: " + expression + " = " + result + " -- expected: " + expected + "</li>");
else
log("<li class='success'>SUCCESS: " + expression + " = " + result + "</li>");
}
function runTest() {
logTest("0 & null", 0);
logTest("0 & undefined", 0);
logTest("1 & null", 0);
logTest("1 & undefined", 0);
logTest("0 | null", 0);
logTest("0 | undefined", 0);
logTest("1 | null", 1);
logTest("1 | undefined", 1);
logTest("0 ^ null", 0);
logTest("0 ^ undefined", 0);
logTest("1 ^ null", 1);
logTest("1 ^ undefined", 1);
}
</script>
</head>
This tests the bitwise operators work correctly in conjunction with undefined and null.<br />
<body onload="runTest()">
<ul id="log"></ul>
</body>
</html>