Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Number/S9.3_A3_T1.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_T1
9 description: False and true convert to Number by explicit transformation
10 ---*/
11
12 // CHECK#1
13 if (Number(false) !== +0) {
14 $ERROR('#1.1: Number(false) === 0. Actual: ' + (Number(false)));
15 } else {
16 if (1 / Number(false) !== Number.POSITIVE_INFINITY) {
17 $ERROR('#1.2: Number(false) === +0. Actual: -0');
18 }
19 }
20
21 // CHECK#2
22 if (Number(true) !== 1) {
23 $ERROR('#2: Number(true) === 1. Actual: ' + (Number(true)));
24 }