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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:ef787e9f99e4
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_T1.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 explicit transformation
10 */
11
12 // CHECK#1
13 if (isNaN(Number(Number.NaN)) !== true) {
14 $ERROR('#1: Number(NaN) === Not-a-Number. Actual: ' + (Number(NaN)));
15 }
16
17 // CHECK#2
18 if (Number(+0) !== +0) {
19 $ERROR('#2.1: Number(+0) === 0. Actual: ' + (Number(+0)));
20 } else {
21 if (1/Number(+0) !== Number.POSITIVE_INFINITY) {
22 $ERROR('#2.2: Number(+0) === +0. Actual: -0');
23 }
24 }
25
26 // CHECK#3
27 if (Number(-0) !== -0) {
28 $ERROR('#3.1: Number(-0) === 0. Actual: ' + (Number(-0)));
29 } else {
30 if (1/Number(-0) !== Number.NEGATIVE_INFINITY) {
31 $ERROR('#3.2: Number(-0) === -0. Actual: +0');
32 }
33 }
34
35 // CHECK#4
36 if (Number(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) {
37 $ERROR('#4: Number(+Infinity) === +Infinity. Actual: ' + (Number(+Infinity)));
38 }
39
40 // CHECK#5
41 if (Number(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) {
42 $ERROR('#5: Number(-Infinity) === -Infinity. Actual: ' + (Number(-Infinity)));
43 }
44
45 // CHECK#6
46 if (Number(Number.MAX_VALUE) !== Number.MAX_VALUE) {
47 $ERROR('#6: Number(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (Number(Number.MAX_VALUE)));
48 }
49
50 // CHECK#7
51 if (Number(Number.MIN_VALUE) !== Number.MIN_VALUE) {
52 $ERROR('#7: Number(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (Number(Number.MIN_VALUE)));
53 }
54

mercurial