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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Array/15.4.2.1-2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.4.2.1-2.js
    1.12 +   ECMA Section:       15.4.2.1 new Array( item0, item1, ... )
    1.13 +   Description:        This description only applies of the constructor is
    1.14 +   given two or more arguments.
    1.15 +
    1.16 +   The [[Prototype]] property of the newly constructed
    1.17 +   object is set to the original Array prototype object,
    1.18 +   the one that is the initial value of Array.prototype
    1.19 +   (15.4.3.1).
    1.20 +
    1.21 +   The [[Class]] property of the newly constructed object
    1.22 +   is set to "Array".
    1.23 +
    1.24 +   The length property of the newly constructed object is
    1.25 +   set to the number of arguments.
    1.26 +
    1.27 +   The 0 property of the newly constructed object is set
    1.28 +   to item0... in general, for as many arguments as there
    1.29 +   are, the k property of the newly constructed object is
    1.30 +   set to argument k, where the first argument is
    1.31 +   considered to be argument number 0.
    1.32 +
    1.33 +
    1.34 +   Author:             christine@netscape.com
    1.35 +   Date:               7 october 1997
    1.36 +*/
    1.37 +var SECTION = "15.4.2.1-2";
    1.38 +var VERSION = "ECMA_1";
    1.39 +startTest();
    1.40 +var TITLE   = "The Array Constructor:  new Array( item0, item1, ...)";
    1.41 +
    1.42 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.43 +
    1.44 +
    1.45 +var TEST_STRING = "new Array(";
    1.46 +var ARGUMENTS = ""
    1.47 +  var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
    1.48 +
    1.49 +for ( var index = 0; index < TEST_LENGTH; index++ ) {
    1.50 +  ARGUMENTS += index;
    1.51 +  ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
    1.52 +}
    1.53 +
    1.54 +TEST_STRING += ARGUMENTS + ")";
    1.55 +
    1.56 +TEST_ARRAY = eval( TEST_STRING );
    1.57 +
    1.58 +for ( var item = 0; item < TEST_LENGTH; item++ ) {
    1.59 +  new TestCase( SECTION,
    1.60 +		"["+item+"]",    
    1.61 +		item,   
    1.62 +		TEST_ARRAY[item] );
    1.63 +}
    1.64 +
    1.65 +new TestCase( SECTION,
    1.66 +	      "new Array( ["+TEST_LENGTH+" arguments] ) +''",   
    1.67 +	      ARGUMENTS,
    1.68 +	      TEST_ARRAY +"" );
    1.69 +
    1.70 +test();

mercurial