S11.4.8_A2.1_T1.js (918B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: Operator ~x uses GetValue 6 es5id: 11.4.8_A2.1_T1 7 description: Either Type(x) is not Reference or GetBase(x) is not null 8 ---*/ 9 10 //CHECK#1 11 if (~0 !== -1) { 12 throw new Test262Error('#1: ~0 === -1. Actual: ' + (~0)); 13 } 14 15 //CHECK#2 16 if (~(~0) !== 0) { 17 throw new Test262Error('#2: ~(~0) === 0. Actual: ' + (~(~0))); 18 } 19 20 //CHECK#3 21 var x = 0; 22 if (~x !== -1) { 23 throw new Test262Error('#3: var x = 0; ~x === -1. Actual: ' + (~x)); 24 } 25 26 //CHECK#4 27 var x = 0; 28 if (~(~x) !== 0) { 29 throw new Test262Error('#4: var x = 0; ~(~x) === 0. Actual: ' + (~(~x))); 30 } 31 32 //CHECK#5 33 var object = new Object(); 34 object.prop = 0; 35 if (~object.prop !== -1) { 36 throw new Test262Error('#5: var object = new Object(); object.prop = 0; ~object.prop === -1. Actual: ' + (~object.prop)); 37 } 38 39 reportCompare(0, 0);