blob: 944087e0c26f77aa0f22824517101015ef482971 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
description(
'This tests some sparse array operations.'
);
var array = [ ];
array[50000] = 100;
shouldBe('array[0]', 'undefined');
shouldBe('array[49999]', 'undefined');
shouldBe('array[50000]', '100');
shouldBe('array[50001]', 'undefined');
array[0]++;
shouldBe('array[0]', 'NaN');
shouldBe('array[49999]', 'undefined');
shouldBe('array[50000]', '100');
shouldBe('array[50001]', 'undefined');
// This tests oscillation between being sparse and dense.
delete array[50000];
array.length = 5;
array[50000] = 100;
shouldBe('array[0]', 'NaN');
shouldBe('array[49999]', 'undefined');
shouldBe('array[50000]', '100');
shouldBe('array[50001]', 'undefined');
debug('');
|