michael@0: // Storing a typed value. michael@0: function test1() { michael@0: var a = []; michael@0: for (var i=0; i<130; i++) { michael@0: a[i] = i + 1; michael@0: } michael@0: return a; michael@0: } michael@0: michael@0: var arr = test1(); michael@0: assertEq(arr.length, 130); michael@0: michael@0: for (var i=0; i<130; i++) michael@0: assertEq(arr[i], i + 1); michael@0: michael@0: // Storing a Value. michael@0: function getValue(x) { michael@0: var y = x & 0x3; michael@0: if (y == 0) return null; michael@0: if (y == 1) return true; michael@0: if (y == 2) return 1.23; michael@0: if (y == 3) return Math; michael@0: assertEq(0, 1); michael@0: } michael@0: getValue(0); michael@0: getValue(1); michael@0: michael@0: function test2() { michael@0: var a = []; michael@0: for (var i=0; i<130; i++) { michael@0: a[i] = getValue(i); michael@0: } michael@0: return a; michael@0: } michael@0: michael@0: var arr = test2(); michael@0: assertEq(arr.length, 130); michael@0: michael@0: for (var i=0; i<130; i++) michael@0: assertEq(arr[i], getValue(i)); michael@0: michael@0: // Make sure the length-property is not updated if it's greater than michael@0: // the (new) initialized length. michael@0: function test3(arr, start, end) { michael@0: for (var i=start; i