Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * If value is NaN, +0, -0, +Infinity, or -Infinity, return +0
6 *
7 * @path ch09/9.6/S9.6_A1.js
8 * @description For testing use operator >>>0
9 */
11 // CHECK#1
12 if ((Number.NaN >>> 0) !== +0) {
13 $ERROR('#1.1: (Number.NaN >>> 0) === 0. Actual: ' + ((Number.NaN >>> 0)));
14 } else if (1/(Number.NaN >>> 0) !== Number.POSITIVE_INFINITY) {
15 $ERROR('#1.2: (Number.NaN >>> 0) === +0. Actual: -0');
16 }
18 // CHECK#2
19 if ((Number("abc") >>> 0) !== +0) {
20 $ERROR('#2.1: (Number("abc") >>> 0) === 0. Actual: ' + ((Number("abc") >>> 0)));
21 } else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) {
22 $ERROR('#2.2: (0 >>> 0) === +0. Actual: -0');
23 }
25 // CHECK#3
26 if ((0 >>> 0) !== +0) {
27 $ERROR('#3.1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0)));
28 } else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) {
29 $ERROR('#3.2: (0 >>> 0) === +0. Actual: -0');
30 }
32 // CHECK#4
33 if ((-0 >>> 0) !== +0) {
34 $ERROR("#4.1: (-0 >>> 0) === 0");
35 } else if (1/(-0 >>> 0) !== Number.POSITIVE_INFINITY) {
36 $ERROR("#4.2: (-0 >>> 0) === +0. Actual: -0");
37 }
39 // CHECK#5
40 if ((Number.POSITIVE_INFINITY >>> 0) !== +0) {
41 $ERROR('#5.1: (Number.POSITIVE_INFINITY >>> 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY >>> 0)));
42 } else if (1/(Number.POSITIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) {
43 $ERROR('#5.2: (Number.POSITIVE_INFINITY >>> 0) === +0. Actual: -0');
44 }
46 // CHECK#6
47 if ((Number.NEGATIVE_INFINITY >>> 0) !== +0) {
48 $ERROR("#6.1: (Number.NEGATIVE_INFINITY >>> 0) === 0");
49 } else if (1/(Number.NEGATIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) {
50 $ERROR("#6.2: (Number.NEGATIVE_INFINITY >>> 0) === +0. Actual: -0");
51 }