Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/logical-and/S11.11.1_A4_T2.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 ToBoolean(x) is true, return y
6 es5id: 11.11.1_A4_T2
7 description: Type(x) and Type(y) vary between primitive number and Number object
8 ---*/
9
10 //CHECK#1
11 if ((-1 && -0) !== 0) {
12 $ERROR('#1.1: (-1 && -0) === 0');
13 } else {
14 if ((1 / (-1 && -0)) !== Number.NEGATIVE_INFINITY) {
15 $ERROR('#1.2: (-1 && -0) === -0');
16 }
17 }
18
19 //CHECK#2
20 if ((-1 && 0) !== 0) {
21 $ERROR('#2.1: (-1 && 0) === 0');
22 } else {
23 if ((1 / (-1 && 0)) !== Number.POSITIVE_INFINITY) {
24 $ERROR('#2.2: (-1 && 0) === +0');
25 }
26 }
27
28 //CHECK#3
29 if ((isNaN(0.1 && NaN)) !== true) {
30 $ERROR('#3: (0.1 && NaN) === Not-a-Number');
31 }
32
33 //CHECK#4
34 var y = new Number(0);
35 if ((new Number(-1) && y) !== y) {
36 $ERROR('#4: (var y = new Number(0); (new Number(-1) && y) === y');
37 }
38
39 //CHECK#5
40 var y = new Number(NaN);
41 if ((new Number(0) && y) !== y) {
42 $ERROR('#5: (var y = new Number(NaN); (new Number(0) && y) === y');
43 }
44
45 //CHECK#6
46 var y = new Number(-1);
47 if ((new Number(NaN) && y) !== y) {
48 $ERROR('#6: (var y = new Number(-1); (new Number(NaN) && y) === y');
49 }