| 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 false, return x |
| 6 |
es5id: 11.11.1_A3_T2 |
| 7 |
description: Type(x) and Type(y) vary between primitive number and Number object |
| 8 |
---*/ |
| 9 |
|
| 10 |
//CHECK#1 |
| 11 |
if ((-0 && -1) !== 0) { |
| 12 |
$ERROR('#1.1: (-0 && -1) === 0'); |
| 13 |
} else { |
| 14 |
if ((1 / (-0 && -1)) !== Number.NEGATIVE_INFINITY) { |
| 15 |
$ERROR('#1.2: (-0 && -1) === -0'); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
//CHECK#2 |
| 20 |
if ((0 && new Number(-1)) !== 0) { |
| 21 |
$ERROR('#2.1: (0 && new Number(-1)) === 0'); |
| 22 |
} else { |
| 23 |
if ((1 / (0 && new Number(-1))) !== Number.POSITIVE_INFINITY) { |
| 24 |
$ERROR('#2.2: (0 && new Number(-1)) === +0'); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
//CHECK#3 |
| 29 |
if ((isNaN(NaN && 1)) !== true) { |
| 30 |
$ERROR('#3: (NaN && 1) === Not-a-Number'); |
| 31 |
} |