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/
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.
11 * The Original Code is Mozilla Communicator client code, released March
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
24 ECMA Section: 15.4 Array Objects
26 Description: Every Array object has a length property whose value
27 is always an integer with positive sign and less than
30 Author: christine@netscape.com
34 var SECTION = "15.4-1";
35 var VERSION = "ECMA_1";
37 var TITLE = "Array Objects";
39 writeHeaderToLog( SECTION + " "+ TITLE);
41 var testcases = getTestCases();
44 function getTestCases() {
45 var array = new Array();
48 array[item++] = new TestCase( SECTION,
49 "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]",
51 eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]")
53 array[item++] = new TestCase( SECTION,
54 "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length",
56 eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length")
58 array[item++] = new TestCase( SECTION,
59 "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]",
61 eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]")
63 array[item++] = new TestCase( SECTION,
64 "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length",
66 eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length")
69 array[item++] = new TestCase( SECTION,
70 "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]",
72 eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]")
74 array[item++] = new TestCase( SECTION,
75 "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length",
77 eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length")
80 array[item++] = new TestCase( SECTION,
81 "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]",
83 eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]")
85 array[item++] = new TestCase( SECTION,
86 "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length",
88 eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length")
92 array[item++] = new TestCase( SECTION,
93 "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]",
95 eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]")
97 array[item++] = new TestCase( SECTION,
98 "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length",
100 eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length")
103 array[item++] = new TestCase( SECTION,
104 "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]",
106 eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]")
108 array[item++] = new TestCase( SECTION,
109 "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length",
111 eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length")
116 for ( tc=0; tc < testcases.length; tc++ ) {
117 testcases[tc].passed = writeTestCaseResult(
118 testcases[tc].expect,
119 testcases[tc].actual,
120 testcases[tc].description +" = "+ testcases[tc].actual );
122 testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
125 return ( testcases );