js/src/tests/ecma/Boolean/15.6.1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 15.6.1.js
michael@0 9 ECMA Section: 15.6.1 The Boolean Function
michael@0 10 15.6.1.1 Boolean( value )
michael@0 11 15.6.1.2 Boolean ()
michael@0 12 Description: Boolean( value ) should return a Boolean value
michael@0 13 not a Boolean object) computed by
michael@0 14 Boolean.toBooleanValue( value)
michael@0 15
michael@0 16 15.6.1.2 Boolean() returns false
michael@0 17
michael@0 18 Author: christine@netscape.com
michael@0 19 Date: 27 jun 1997
michael@0 20
michael@0 21
michael@0 22 Data File Fields:
michael@0 23 VALUE Argument passed to the Boolean function
michael@0 24 TYPE typeof VALUE (not used, but helpful in understanding
michael@0 25 the data file)
michael@0 26 E_RETURN Expected return value of Boolean( VALUE )
michael@0 27 */
michael@0 28 var SECTION = "15.6.1";
michael@0 29 var VERSION = "ECMA_1";
michael@0 30 startTest();
michael@0 31 var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
michael@0 32
michael@0 33 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 34
michael@0 35 var array = new Array();
michael@0 36 var item = 0;
michael@0 37
michael@0 38 new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
michael@0 39 new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
michael@0 40 new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
michael@0 41 new TestCase( SECTION, "Boolean('1')", true, Boolean("1") );
michael@0 42 new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
michael@0 43 new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") );
michael@0 44 new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
michael@0 45 new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
michael@0 46
michael@0 47 new TestCase( SECTION, "Boolean('true')", true, Boolean("true") );
michael@0 48 new TestCase( SECTION, "Boolean('false')", true, Boolean("false") );
michael@0 49 new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
michael@0 50
michael@0 51 new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
michael@0 52 new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
michael@0 53 new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) );
michael@0 54 new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) );
michael@0 55 new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) );
michael@0 56 new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) );
michael@0 57 new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) );
michael@0 58 new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) );
michael@0 59 new TestCase( SECTION, "Boolean()", false, Boolean() );
michael@0 60 // array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) );
michael@0 61
michael@0 62 test();

mercurial