S11.11.2_A3_T2.js (991B)
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: If ToBoolean(x) is false, return y 6 es5id: 11.11.2_A3_T2 7 description: Type(x) and Type(y) vary between primitive number and Number object 8 ---*/ 9 10 //CHECK#1 11 if ((0 || -0) !== 0) { 12 throw new Test262Error('#1.1: (0 || -0) === 0'); 13 } else { 14 if ((1 / (0 || -0)) !== Number.NEGATIVE_INFINITY) { 15 throw new Test262Error('#1.2: (0 || -0) === -0'); 16 } 17 } 18 19 //CHECK#2 20 if ((-0 || 0) !== 0) { 21 throw new Test262Error('#2.1: (-0 || 0) === 0'); 22 } else { 23 if ((1 / (-0 || 0)) !== Number.POSITIVE_INFINITY) { 24 throw new Test262Error('#2.2: (-0 || 0) === +0'); 25 } 26 } 27 28 //CHECK#3 29 var y = new Number(-1); 30 if ((0 || y) !== y) { 31 throw new Test262Error('#3: (var y = new Number(-1); 0 || y) === y'); 32 } 33 34 //CHECK#4 35 var y = new Number(0); 36 if ((NaN || y) !== y) { 37 throw new Test262Error('#4: (var y = new Number(0); NaN || y) === y'); 38 } 39 40 reportCompare(0, 0);