<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>S11.6.2_A4_T2</p>
<div id='console'></div>
<script>
try {

/**
* @name: S11.6.2_A4_T2;
* @section: 11.6.2, 11.6.3;
* @assertion: Operator x - y produces the same result as x + (-y); 
* @description: The difference of two infinities of opposite sign is the infinity of minuend sign;
*/

//CHECK#1
if (Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY ) {
  testFailed('#1: Infinity - -Infinity === Infinity. Actual: ' + (Infinity - -Infinity));
}

//CHECK#2
if (Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY ) {
  testFailed('#2: -Infinity - Infinity === -Infinity. Actual: ' + (-Infinity - Infinity));
}




} 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>
