S9.3_A4.2_T2.js (1728B)
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: | 6 Result of number conversion from number value equals to the input 7 argument (no conversion) 8 es5id: 9.3_A4.2_T2 9 description: > 10 Number.NaN, +0, -0, Number.POSITIVE_INFINITY, 11 Number.NEGATIVE_INFINITY, Number.MAX_VALUE and Number.MIN_VALUE 12 convert to Number by implicit transformation 13 ---*/ 14 15 // CHECK#1 16 if (isNaN(+(Number.NaN)) !== true) { 17 throw new Test262Error('#1: +(NaN) === Not-a-Number. Actual: ' + (+(NaN))); 18 } 19 20 // CHECK#2 21 if (+(+0) !== +0) { 22 throw new Test262Error('#2.1: +(+0) === 0. Actual: ' + (+(+0))); 23 } else { 24 if (1/+(+0) !== Number.POSITIVE_INFINITY) { 25 throw new Test262Error('#2.2: +(+0) === +0. Actual: -0'); 26 } 27 } 28 29 // CHECK#3 30 if (+(-0) !== -0) { 31 throw new Test262Error('#3.1: +(-0) === 0. Actual: ' + (+(-0))); 32 } else { 33 if (1/+(-0) !== Number.NEGATIVE_INFINITY) { 34 throw new Test262Error('#3.2: +(-0) === -0. Actual: +0'); 35 } 36 } 37 38 // CHECK#4 39 if (+(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { 40 throw new Test262Error('#4: +(+Infinity) === +Infinity. Actual: ' + (+(+Infinity))); 41 } 42 43 // CHECK#5 44 if (+(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { 45 throw new Test262Error('#5: +(-Infinity) === -Infinity. Actual: ' + (+(-Infinity))); 46 } 47 48 // CHECK#6 49 if (+(Number.MAX_VALUE) !== Number.MAX_VALUE) { 50 throw new Test262Error('#6: +(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (+(Number.MAX_VALUE))); 51 } 52 53 // CHECK#7 54 if (+(Number.MIN_VALUE) !== Number.MIN_VALUE) { 55 throw new Test262Error('#7: +(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (+(Number.MIN_VALUE))); 56 } 57 58 reportCompare(0, 0);