Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/unary-minus/S11.4.7_A4.2.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: Negating +0 produces -0, negating -0 produces +0
6 es5id: 11.4.7_A4.2
7 description: Checking Infinity
8 ---*/
9
10 //CHECK#1
11 var x = 0;
12 x = -x;
13 if (x !== -0) {
14 $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x));
15 } else {
16 if (1/x !== Number.NEGATIVE_INFINITY) {
17 $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0');
18 }
19 }
20
21 //CHECK#2
22 var x = -0;
23 x = -x;
24 if (x !== 0) {
25 $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x));
26 } else {
27 if (1/x !== Number.POSITIVE_INFINITY) {
28 $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0');
29 }
30 }