michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: /** michael@0: File Name: 15.6.1.js michael@0: ECMA Section: 15.6.1 The Boolean Function michael@0: 15.6.1.1 Boolean( value ) michael@0: 15.6.1.2 Boolean () michael@0: Description: Boolean( value ) should return a Boolean value michael@0: not a Boolean object) computed by michael@0: Boolean.toBooleanValue( value) michael@0: michael@0: 15.6.1.2 Boolean() returns false michael@0: michael@0: Author: christine@netscape.com michael@0: Date: 27 jun 1997 michael@0: michael@0: michael@0: Data File Fields: michael@0: VALUE Argument passed to the Boolean function michael@0: TYPE typeof VALUE (not used, but helpful in understanding michael@0: the data file) michael@0: E_RETURN Expected return value of Boolean( VALUE ) michael@0: */ michael@0: var SECTION = "15.6.1"; michael@0: var VERSION = "ECMA_1"; michael@0: startTest(); michael@0: var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()"; michael@0: michael@0: writeHeaderToLog( SECTION + " "+ TITLE); michael@0: michael@0: var array = new Array(); michael@0: var item = 0; michael@0: michael@0: new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); michael@0: new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); michael@0: new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); michael@0: new TestCase( SECTION, "Boolean('1')", true, Boolean("1") ); michael@0: new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); michael@0: new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") ); michael@0: new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); michael@0: new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); michael@0: michael@0: new TestCase( SECTION, "Boolean('true')", true, Boolean("true") ); michael@0: new TestCase( SECTION, "Boolean('false')", true, Boolean("false") ); michael@0: new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); michael@0: michael@0: new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); michael@0: new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); michael@0: new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) ); michael@0: new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) ); michael@0: new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) ); michael@0: new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) ); michael@0: new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) ); michael@0: new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) ); michael@0: new TestCase( SECTION, "Boolean()", false, Boolean() ); michael@0: // array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) ); michael@0: michael@0: test();