Debian Codegraph @

js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_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: |
6 Result of number conversion from boolean value is 1 if the argument is
7 true, else is +0
8 es5id: 9.3_A3_T2
9 description: False and true convert to Number by implicit transformation
10 ---*/
11
12 // CHECK#1
13 if (+(false) !== +0) {
14 throw new Test262Error('#1.1: +(false) === 0. Actual: ' + (+(false)));
15 } else {
16 if (1/+(false) !== Number.POSITIVE_INFINITY) {
17 throw new Test262Error('#1.2: +(false) === +0. Actual: -0');
18 }
19 }
20
21 // CHECK#2
22 if (+(true) !== 1) {
23 throw new Test262Error('#2: +(true) === 1. Actual: ' + (+(true)));
24 }
25
26 reportCompare(0, 0);