Debian Codegraph @

js/src/tests/test262/built-ins/Array/length/S15.4.2.2_A2.3_T5.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-array-len
6 info: |
7 If the argument len is not a Number, then the length property of
8 the newly constructed object is set to 1 and the 0 property of
9 the newly constructed object is set to len
10 es5id: 15.4.2.2_A2.3_T5
11 description: Checking for Number object
12 ---*/
13
14 var obj = new Number(-1);
15 var x = new Array(obj);
16
17 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
18 assert.sameValue(x[0], obj, 'The value of x[0] is expected to equal the value of obj');
19
20 var obj = new Number(4294967296);
21 var x = new Array(obj);
22
23 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
24 assert.sameValue(x[0], obj, 'The value of x[0] is expected to equal the value of obj');
25
26 var obj = new Number(4294967297);
27 var x = new Array(obj);
28
29 assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
30 assert.sameValue(x[0], obj, 'The value of x[0] is expected to equal the value of obj');
31
32 reportCompare(0, 0);