js/src/tests/test262/ch09/9.3/S9.3_A4.2_T2.js

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

mercurial