• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
5 *
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
10 *
11 * The Original Code is Mozilla Communicator client code, released March
12 * 31, 1998.
13 *
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 */
22/**
23 *  File Name:          boolean-001.js
24 *  Description:
25 *
26 *  In JavaScript 1.2, new Boolean(false) evaluates to false.
27 *
28 *  Author:             christine@netscape.com
29 *  Date:               11 August 1998
30 */
31    var SECTION = "boolean-001.js";
32    var VERSION = "JS1_2";
33    startTest();
34    var TITLE   = "new Boolean(false) should evaluate to false";
35
36    writeHeaderToLog( SECTION + " "+ TITLE);
37
38    var testcases = new Array();
39
40    BooleanTest( "new Boolean(true)",  new Boolean(true),  true );
41    BooleanTest( "new Boolean(false)", new Boolean(false), false );
42    BooleanTest( "true",               true,               true );
43    BooleanTest( "false",              false,              false );
44
45    test();
46
47function BooleanTest( string, object, expect ) {
48    if ( object ) {
49        result = true;
50    } else {
51        result = false;
52    }
53
54    testcases[tc++] = new TestCase(
55        SECTION,
56        string,
57        expect,
58        result );
59}
60
61function test() {
62    for ( tc=0; tc < testcases.length; tc++ ) {
63        testcases[tc].passed = writeTestCaseResult(
64                            testcases[tc].expect,
65                            testcases[tc].actual,
66                            testcases[tc].description +" = "+
67                            testcases[tc].actual );
68
69        testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
70    }
71    stopTest();
72    return ( testcases );
73}
74