blob: 330f7b2dab795b6874454e22e4eabf1b3144d67e [file] [log] [blame]
<html>
<head>
<meta charset='utf-8'>
<style>
.pass {
font-weight: bold;
color: green;
}
.fail {
font-weight: bold;
color: red;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function SputnikError(message)
{
this.message = message;
}
SputnikError.prototype.toString = function ()
{
return 'SputnikError: ' + this.message;
};
var sputnikException;
function testPrint(msg)
{
var span = document.createElement("span");
document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace
span.innerHTML = msg + '<br />';
}
function escapeHTML(text)
{
return text.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;");
}
function printTestPassed(msg)
{
testPrint('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
}
function printTestFailed(msg)
{
testPrint('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
}
function testFailed(msg)
{
throw new SputnikError(msg);
}
var successfullyParsed = false;
</script>
</head>
<body>
<p>S15.1.1.1_R4</p>
<div id='console'></div>
<script>
try {
/**
* @name: S15.1.1.1_R4;
* @section: 15.1.1.1, 11;
* @description: The NaN is not ReadOnly, check Operators that use ToNumber;
*/
// CHECK#1
NaN = true;
NaN++;
if (NaN !== 2) {
testFailed('#1: NaN = true; NaN++; NaN === 2');
}
// CHECK#2
NaN = true;
NaN--;
if (NaN !== 0) {
testFailed('#2: NaN = true; NaN--; NaN === 0');
}
// CHECK#3
NaN = true;
++NaN;
if (NaN !== 2) {
testFailed('#3: NaN = true; ++NaN; NaN === 2');
}
// CHECK#4
NaN = true;
--NaN;
if (NaN !== 0) {
testFailed('#4: NaN = true; --NaN; NaN === 0');
}
// CHECK#5
NaN = true;
+NaN;
if (NaN !== true) {
testFailed('#5: NaN = true; +NaN; NaN === true');
}
// CHECK#6
NaN = true;
-NaN;
if (NaN !== true) {
testFailed('#6: NaN = true; -NaN; NaN === true');
}
// CHECK#7
NaN = true;
NaN * 1;
if (NaN !== true) {
testFailed('#7: NaN = true; NaN * 1; NaN === true');
}
// CHECK#8
NaN = true;
NaN / 1;
if (NaN !== true) {
testFailed('#8: NaN = true; NaN / 1; NaN === true');
}
// CHECK#9
NaN = true;
NaN % 1;
if (NaN !== true) {
testFailed('#9: NaN = true; NaN % 1; NaN === true');
}
// CHECK#10
NaN = true;
NaN + 1;
if (NaN !== true) {
testFailed('#10: NaN = true; NaN + 1; NaN === true');
}
// CHECK#11
NaN = true;
NaN - 1;
if (NaN !== true) {
testFailed('#11: NaN = true; NaN - 1; NaN === true');
}
// CHECK#12
NaN = true;
NaN > 1;
if (NaN !== true) {
testFailed('#12: NaN = true; NaN > 1; NaN === true');
}
// CHECK#13
NaN = true;
NaN < 1;
if (NaN !== true) {
testFailed('#13: NaN = true; NaN < 1; NaN === true');
}
// CHECK#14
NaN = true;
NaN >= 1;
if (NaN !== true) {
testFailed('#14: NaN = true; NaN >= 1; NaN === true');
}
// CHECK#15
NaN = true;
NaN <= 1;
if (NaN !== true) {
testFailed('#15: NaN = true; NaN <= 1; NaN === true');
}
// CHECK#16
NaN = true;
NaN == true;
if (NaN !== true) {
testFailed('#16: NaN = true; NaN == true; NaN === true');
}
// CHECK#17
NaN = true;
NaN != 1;
if (NaN !== true) {
testFailed('#17: NaN = true; NaN != 1; NaN === true');
}
// CHECK#18
NaN = true;
NaN === true;
if (NaN !== true) {
testFailed('#18: NaN = true; NaN === true; NaN === true');
}
// CHECK#19
NaN = true;
NaN !== true;
if (NaN !== true) {
testFailed('#19: NaN = true; NaN !== true; NaN === true');
}
} catch (ex) {
sputnikException = ex;
}
var successfullyParsed = true;
</script>
<script>
if (!successfullyParsed)
printTestFailed('successfullyParsed is not set');
else if (sputnikException)
printTestFailed(sputnikException);
else
printTestPassed("");
testPrint('<br /><span class="pass">TEST COMPLETE</span>');
</script>
</body>
</html>