1 // vim: set ts=4 sw=4 tw=99 et:
3 function fillDense(a) {
6 function testDenseUKeyUArray(a, key) {
7 a.push(function () { return this[3]; });
8 a.push(function () { return this[4]; });
9 a.push(function() { return this[5]; });
13 assertEq(a[key](), 20);
14 assertEq(a[key + 1](), "hi");
15 assertEq(a[key + 2](), 500);
18 function testDenseVKeyUArray(a) {
19 a.push(function () { return this[3]; });
20 a.push(function () { return this[4]; });
21 a.push(function() { return this[5]; });
25 var key = a.length & 1;
26 assertEq(a[key](), 20);
27 assertEq(a[(key + 1) & 3](), "hi");
28 assertEq(a[(key + 2) & 3](), 500);
31 function testDenseKKeyUArray(a, key) {
32 a.push(function () { return this[3]; });
33 a.push(function () { return this[4]; });
34 a.push(function() { return this[5]; });
39 assertEq(a[1](), "hi");
40 assertEq(a[2](), 500);
43 function testDenseUKeyVArray(key) {
44 var a = [function () { return this[3]; },
45 function () { return this[4]; },
46 function() { return this[5]; },
50 assertEq(a[key](), 20);
51 assertEq(a[key + 1](), "hi");
52 assertEq(a[key + 2](), 500);
55 function testDenseVKeyVArray() {
56 var a = [function () { return this[3]; },
57 function () { return this[4]; },
58 function() { return this[5]; },
62 var key = a.length & 1;
63 assertEq(a[key](), 20);
64 assertEq(a[(key + 1) & 3](), "hi");
65 assertEq(a[(key + 2) & 3](), 500);
68 function testDenseKKeyVArray() {
69 var a = [function () { return this[3]; },
70 function () { return this[4]; },
71 function() { return this[5]; },
76 assertEq(a[1](), "hi");
77 assertEq(a[2](), 500);
80 for (var i = 0; i < 5; i++) {
81 testDenseUKeyUArray([], 0);
82 testDenseVKeyUArray([]);
83 testDenseKKeyUArray([]);
84 testDenseUKeyVArray(0);
85 testDenseVKeyVArray();
86 testDenseKKeyVArray();