Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/unsigned-right-shift/S9.6_A1.js

raw
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 value is NaN, +0, -0, +Infinity, or -Infinity, return +0
6 es5id: 9.6_A1
7 description: For testing use operator >>>0
8 ---*/
9
10 // CHECK#1
11 if ((Number.NaN >>> 0) !== +0) {
12 $ERROR('#1.1: (Number.NaN >>> 0) === 0. Actual: ' + ((Number.NaN >>> 0)));
13 } else if (1/(Number.NaN >>> 0) !== Number.POSITIVE_INFINITY) {
14 $ERROR('#1.2: (Number.NaN >>> 0) === +0. Actual: -0');
15 }
16
17 // CHECK#2
18 if ((Number("abc") >>> 0) !== +0) {
19 $ERROR('#2.1: (Number("abc") >>> 0) === 0. Actual: ' + ((Number("abc") >>> 0)));
20 } else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) {
21 $ERROR('#2.2: (0 >>> 0) === +0. Actual: -0');
22 }
23
24 // CHECK#3
25 if ((0 >>> 0) !== +0) {
26 $ERROR('#3.1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0)));
27 } else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) {
28 $ERROR('#3.2: (0 >>> 0) === +0. Actual: -0');
29 }
30
31 // CHECK#4
32 if ((-0 >>> 0) !== +0) {
33 $ERROR("#4.1: (-0 >>> 0) === 0");
34 } else if (1/(-0 >>> 0) !== Number.POSITIVE_INFINITY) {
35 $ERROR("#4.2: (-0 >>> 0) === +0. Actual: -0");
36 }
37
38 // CHECK#5
39 if ((Number.POSITIVE_INFINITY >>> 0) !== +0) {
40 $ERROR('#5.1: (Number.POSITIVE_INFINITY >>> 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY >>> 0)));
41 } else if (1/(Number.POSITIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) {
42 $ERROR('#5.2: (Number.POSITIVE_INFINITY >>> 0) === +0. Actual: -0');
43 }
44
45 // CHECK#6
46 if ((Number.NEGATIVE_INFINITY >>> 0) !== +0) {
47 $ERROR("#6.1: (Number.NEGATIVE_INFINITY >>> 0) === 0");
48 } else if (1/(Number.NEGATIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) {
49 $ERROR("#6.2: (Number.NEGATIVE_INFINITY >>> 0) === +0. Actual: -0");
50 }