blob: 396040d490286ff936a3eb7927fa5ae53ad0e89f [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: If ToBoolean(x) is true, return y
6es5id: 11.11.1_A4_T2
7description: Type(x) and Type(y) vary between primitive number and Number object
8---*/
9
10//CHECK#1
11if ((-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
20if ((-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
29if ((isNaN(0.1 && NaN)) !== true) {
30 $ERROR('#3: (0.1 && NaN) === Not-a-Number');
31}
32
33//CHECK#4
34var y = new Number(0);
35if ((new Number(-1) && y) !== y) {
36 $ERROR('#4: (var y = new Number(0); (new Number(-1) && y) === y');
37}
38
39//CHECK#5
40var y = new Number(NaN);
41if ((new Number(0) && y) !== y) {
42 $ERROR('#5: (var y = new Number(NaN); (new Number(0) && y) === y');
43}
44
45//CHECK#6
46var y = new Number(-1);
47if ((new Number(NaN) && y) !== y) {
48 $ERROR('#6: (var y = new Number(-1); (new Number(NaN) && y) === y');
49}