Debian Codegraph @

js/src/tests/test262/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 description: Used various number values as argument
10 ---*/
11 assert.sameValue(typeof Boolean(0), "boolean", 'The value of `typeof Boolean(0)` is expected to be "boolean"');
12 assert.sameValue(Boolean(0), false, 'Boolean(0) must return false');
13 assert.sameValue(typeof Boolean(-1), "boolean", 'The value of `typeof Boolean(-1)` is expected to be "boolean"');
14 assert.sameValue(Boolean(-1), true, 'Boolean(-1) must return true');
15
16 assert.sameValue(
17 typeof Boolean(-Infinity),
18 "boolean",
19 'The value of `typeof Boolean(-Infinity)` is expected to be "boolean"'
20 );
21
22 assert.sameValue(Boolean(-Infinity), true, 'Boolean(-Infinity) must return true');
23 assert.sameValue(typeof Boolean(NaN), "boolean", 'The value of `typeof Boolean(NaN)` is expected to be "boolean"');
24 assert.sameValue(Boolean(NaN), false, 'Boolean(NaN) must return false');
25
26 reportCompare(0, 0);