| <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, "&").replace(/</g, "<"); |
| } |
| |
| 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.7.2_A2.1_T1</p> |
| <div id='console'></div> |
| <script> |
| try { |
| |
| /** |
| * @name: S11.7.2_A2.1_T1; |
| * @section: 11.7.2; |
| * @assertion: Operator x >> y uses GetValue; |
| * @description: Either Type is not Reference or GetBase is not null; |
| */ |
| |
| //CHECK#1 |
| if (-4 >> 1 !== -2) { |
| testFailed('#1: -4 >> 1 === -2. Actual: ' + (-4 >> 1)); |
| } |
| |
| //CHECK#2 |
| var x = -4; |
| if (x >> 1 !== -2) { |
| testFailed('#2: var x = -4; x >> 1 === -2. Actual: ' + (x >> 1)); |
| } |
| |
| //CHECK#3 |
| var y = 1; |
| if (-4 >> y !== -2) { |
| testFailed('#3: var y = 1; -4 >> y === -2. Actual: ' + (-4 >> y)); |
| } |
| |
| //CHECK#4 |
| var x = -4; |
| var y = 1; |
| if (x >> y !== -2) { |
| testFailed('#4: var x = -4; var y = 1; x >> y === -2. Actual: ' + (x >> y)); |
| } |
| |
| //CHECK#5 |
| var objectx = new Object(); |
| var objecty = new Object(); |
| objectx.prop = -4; |
| objecty.prop = 1; |
| if (objectx.prop >> objecty.prop !== -2) { |
| testFailed('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = -4; objecty.prop = 1; objectx.prop >> objecty.prop === -2. Actual: ' + (objectx.prop >> objecty.prop)); |
| } |
| |
| } 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> |