initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma / Number / 15.7.4.js
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:          15.7.4.js
24     ECMA Section:       15.7.4
25
26     Description:
27
28     The Number prototype object is itself a Number object (its [[Class]] is
29     "Number") whose value is +0.
30
31     The value of the internal [[Prototype]] property of the Number prototype
32     object is the Object prototype object (15.2.3.1).
33
34     In following descriptions of functions that are properties of the Number
35     prototype object, the phrase "this Number object" refers to the object
36     that is the this value for the invocation of the function; it is an error
37     if this does not refer to an object for which the value of the internal
38     [[Class]] property is "Number". Also, the phrase "this number value" refers
39     to the number value represented by this Number object, that is, the value
40     of the internal [[Value]] property of this Number object.
41
42     Author:             christine@netscape.com
43     Date:               12 november 1997
44 */
45     var SECTION = "15.7.4";
46     var VERSION = "ECMA_1";
47     startTest();
48     var TITLE   = "Properties of the Number Prototype Object";
49
50     writeHeaderToLog( SECTION + " "+TITLE);
51
52     var testcases = getTestCases();
53     test( testcases );
54
55 function getTestCases() {
56     var array = new Array();
57     var item = 0;
58     array[item++] = new TestCase( SECTION,
59                                   "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()",
60                                   "[object Number]",
61                                   eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") );
62     array[item++] = new TestCase( SECTION, "typeof Number.prototype",                           "object",    typeof Number.prototype );
63     array[item++] = new TestCase( SECTION, "Number.prototype.valueOf()",                        0,          Number.prototype.valueOf() );
64
65
66 //    The __proto__ property cannot be used in ECMA_1 tests.
67 //    array[item++] = new TestCase( SECTION, "Number.prototype.__proto__",                        Object.prototype,   Number.prototype.__proto__ );
68 //    array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype",    true,       Number.prototype.__proto__ == Object.prototype );
69
70
71     return ( array );
72 }
73 function test( ) {
74         for ( tc=0; tc < testcases.length; tc++ ) {
75             testcases[tc].passed = writeTestCaseResult(
76                             testcases[tc].expect,
77                             testcases[tc].actual,
78                             testcases[tc].description +" = "+ testcases[tc].actual );
79
80             testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
81
82         }
83
84         stopTest();
85         return ( testcases );
86 }