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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Boolean/15.6.1.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:      15.6.1.js
    1.12 +   ECMA Section:   15.6.1 The Boolean Function
    1.13 +   15.6.1.1 Boolean( value )
    1.14 +   15.6.1.2 Boolean ()
    1.15 +   Description:    Boolean( value ) should return a Boolean value
    1.16 +   not a Boolean object) computed by
    1.17 +   Boolean.toBooleanValue( value)
    1.18 +
    1.19 +   15.6.1.2 Boolean() returns false
    1.20 +
    1.21 +   Author:         christine@netscape.com
    1.22 +   Date:           27 jun 1997
    1.23 +
    1.24 +
    1.25 +   Data File Fields:
    1.26 +   VALUE       Argument passed to the Boolean function
    1.27 +   TYPE        typeof VALUE (not used, but helpful in understanding
    1.28 +   the data file)
    1.29 +   E_RETURN    Expected return value of Boolean( VALUE )
    1.30 +*/
    1.31 +var SECTION = "15.6.1";
    1.32 +var VERSION = "ECMA_1";
    1.33 +startTest();
    1.34 +var TITLE   = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
    1.35 +
    1.36 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.37 +
    1.38 +var array = new Array();
    1.39 +var item = 0;
    1.40 +
    1.41 +new TestCase( SECTION,   "Boolean(1)",         true,   Boolean(1) );
    1.42 +new TestCase( SECTION,   "Boolean(0)",         false,  Boolean(0) );
    1.43 +new TestCase( SECTION,   "Boolean(-1)",        true,   Boolean(-1) );
    1.44 +new TestCase( SECTION,   "Boolean('1')",       true,   Boolean("1") );
    1.45 +new TestCase( SECTION,   "Boolean('0')",       true,   Boolean("0") );
    1.46 +new TestCase( SECTION,   "Boolean('-1')",      true,   Boolean("-1") );
    1.47 +new TestCase( SECTION,   "Boolean(true)",      true,   Boolean(true) );
    1.48 +new TestCase( SECTION,   "Boolean(false)",     false,  Boolean(false) );
    1.49 +
    1.50 +new TestCase( SECTION,   "Boolean('true')",    true,   Boolean("true") );
    1.51 +new TestCase( SECTION,   "Boolean('false')",   true,   Boolean("false") );
    1.52 +new TestCase( SECTION,   "Boolean(null)",      false,  Boolean(null) );
    1.53 +
    1.54 +new TestCase( SECTION,   "Boolean(-Infinity)", true,   Boolean(Number.NEGATIVE_INFINITY) );
    1.55 +new TestCase( SECTION,   "Boolean(NaN)",       false,  Boolean(Number.NaN) );
    1.56 +new TestCase( SECTION,   "Boolean(void(0))",   false,  Boolean( void(0) ) );
    1.57 +new TestCase( SECTION,   "Boolean(x=0)",       false,  Boolean( x=0 ) );
    1.58 +new TestCase( SECTION,   "Boolean(x=1)",       true,   Boolean( x=1 ) );
    1.59 +new TestCase( SECTION,   "Boolean(x=false)",   false,  Boolean( x=false ) );
    1.60 +new TestCase( SECTION,   "Boolean(x=true)",    true,   Boolean( x=true ) );
    1.61 +new TestCase( SECTION,   "Boolean(x=null)",    false,  Boolean( x=null ) );
    1.62 +new TestCase( SECTION,   "Boolean()",          false,  Boolean() );
    1.63 +//    array[item++] = new TestCase( SECTION,   "Boolean(var someVar)",     false,  Boolean( someVar ) );
    1.64 +
    1.65 +test();

mercurial