Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Boolean/S15.6.1.1_A1_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 Returns a boolean value (not a Boolean object) computed by
7 ToBoolean(value)
8 esid: sec-terms-and-definitions-boolean-value
9 es5id: 15.6.1.1_A1_T2
10 description: Used various number values as argument
11 ---*/
12
13 //CHECK#1
14 if (typeof Boolean(0) !== "boolean") {
15 $ERROR('#1.1: typeof Boolean(0) should be "boolean", actual is "' + typeof Boolean(0) + '"');
16 }
17 if (Boolean(0) !== false) {
18 $ERROR('#1.2: Boolean(0) should be false, actual is ' + Boolean(0));
19 }
20
21 //CHECK#2
22 if (typeof Boolean(-1) !== "boolean") {
23 $ERROR('#2.1: typeof Boolean(-1) should be "boolean", actual is "' + typeof Boolean(-1) + '"');
24 }
25 if (Boolean(-1) !== true) {
26 $ERROR('#2.2: Boolean(-1) should be true, actual is ' + Boolean(-1));
27 }
28
29 //CHECK#3
30 if (typeof Boolean(-Infinity) !== "boolean") {
31 $ERROR('#3.1: typeof Boolean(-Infinity) should be "boolean", actual is "' + typeof Boolean(-Infinity) + '"');
32 }
33 if (Boolean(-Infinity) !== true) {
34 $ERROR('#3.2: Boolean(-Infinity) should be true, actual is ' + Boolean(-Infinity));
35 }
36
37 //CHECK#4
38 if (typeof Boolean(NaN) !== "boolean") {
39 $ERROR('#4.1: typeof Boolean(NaN) should be "boolean", actual is "' + typeof Boolean(NaN) + '"');
40 }
41 if (Boolean(NaN) !== false) {
42 $ERROR('#4.2: Boolean(NaN) should be false, actual is ' + Boolean(NaN));
43 }