js/src/tests/ecma/Array/15.4-2.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          15.4-2.js
     9    ECMA Section:       15.4 Array Objects
    11    Description:        Whenever a property is added whose name is an array
    12    index, the length property is changed, if necessary,
    13    to be one more than the numeric value of that array
    14    index; and whenever the length property is changed,
    15    every property whose name is an array index whose value
    16    is not smaller  than the new length is automatically
    17    deleted.  This constraint applies only to the Array
    18    object itself, and is unaffected by length or array
    19    index properties that may be inherited from its
    20    prototype.
    22    Author:             christine@netscape.com
    23    Date:               28 october 1997
    25 */
    26 var SECTION = "15.4-2";
    27 var VERSION = "ECMA_1";
    28 startTest();
    29 var TITLE   = "Array Objects";
    31 writeHeaderToLog( SECTION + " "+ TITLE);
    33 new TestCase( SECTION,
    34               "var arr=new Array();  arr[Math.pow(2,16)] = 'hi'; arr.length",     
    35               Math.pow(2,16)+1,  
    36               eval("var arr=new Array();  arr[Math.pow(2,16)] = 'hi'; arr.length") );
    38 new TestCase( SECTION,
    39               "var arr=new Array();  arr[Math.pow(2,30)-2] = 'hi'; arr.length",   
    40               Math.pow(2,30)-1,  
    41               eval("var arr=new Array();  arr[Math.pow(2,30)-2] = 'hi'; arr.length") );
    43 new TestCase( SECTION,
    44               "var arr=new Array();  arr[Math.pow(2,30)-1] = 'hi'; arr.length",   
    45               Math.pow(2,30),    
    46               eval("var arr=new Array();  arr[Math.pow(2,30)-1] = 'hi'; arr.length") );
    48 new TestCase( SECTION,
    49               "var arr=new Array();  arr[Math.pow(2,30)] = 'hi'; arr.length",     
    50               Math.pow(2,30)+1,  
    51               eval("var arr=new Array();  arr[Math.pow(2,30)] = 'hi'; arr.length") );
    54 new TestCase( SECTION,
    55               "var arr=new Array();  arr[Math.pow(2,31)-2] = 'hi'; arr.length",   
    56               Math.pow(2,31)-1,  
    57               eval("var arr=new Array();  arr[Math.pow(2,31)-2] = 'hi'; arr.length") );
    59 new TestCase( SECTION,
    60               "var arr=new Array();  arr[Math.pow(2,31)-1] = 'hi'; arr.length",   
    61               Math.pow(2,31),    
    62               eval("var arr=new Array();  arr[Math.pow(2,31)-1] = 'hi'; arr.length") );
    64 new TestCase( SECTION,
    65               "var arr=new Array();  arr[Math.pow(2,31)] = 'hi'; arr.length",     
    66               Math.pow(2,31)+1,  
    67               eval("var arr=new Array();  arr[Math.pow(2,31)] = 'hi'; arr.length") );
    69 new TestCase( SECTION,
    70               "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)",    
    71               "0,1",             
    72               eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") );
    74 new TestCase( SECTION,
    75               "var arr = new Array(0,1); arr.length = 3; String(arr)",            
    76               "0,1,",            
    77               eval("var arr = new Array(0,1); arr.length = 3; String(arr)") );
    79 test();

mercurial