1 // vim: set ts=4 sw=4 tw=99 et:
3 function testUKeyUObject(a, key1, key2, key3) {
4 a.a = function () { return this.d; }
5 a.b = function () { return this.e; }
6 a.c = function() { return this.f; }
10 assertEq(a[key1](), 20);
11 assertEq(a[key2](), "hi");
12 assertEq(a[key3](), 500);
15 function testVKeyUObject(a, key1, key2, key3) {
16 a.a = function () { return this.d; }
17 a.b = function () { return this.e; }
18 a.c = function() { return this.f; }
22 assertEq(a["" + key1](), 20);
23 assertEq(a["" + key2](), "hi");
24 assertEq(a["" + key3](), 500);
27 function testKKeyUObject(a) {
28 a.a = function () { return this.d; }
29 a.b = function () { return this.e; }
30 a.c = function() { return this.f; }
37 assertEq(a[key1](), 20);
38 assertEq(a[key2](), "hi");
39 assertEq(a[key3](), 500);
42 function testUKeyVObject(key1, key2, key3) {
43 a = { a: function () { return this.d; },
44 b: function () { return this.e; },
45 c: function () { return this.f; },
50 assertEq(a[key1](), 20);
51 assertEq(a[key2](), "hi");
52 assertEq(a[key3](), 500);
55 function testVKeyVObject(key1, key2, key3) {
56 a = { a: function () { return this.d; },
57 b: function () { return this.e; },
58 c: function () { return this.f; },
63 assertEq(a["" + key1](), 20);
64 assertEq(a["" + key2](), "hi");
65 assertEq(a["" + key3](), 500);
68 function testKKeyVObject(a) {
69 a = { a: function () { return this.d; },
70 b: function () { return this.e; },
71 c: function () { return this.f; },
79 assertEq(a[key1](), 20);
80 assertEq(a[key2](), "hi");
81 assertEq(a[key3](), 500);
84 for (var i = 0; i < 5; i++) {
85 testUKeyUObject({}, "a", "b", "c");
86 testVKeyUObject({}, "a", "b", "c");
88 testUKeyVObject("a", "b", "c");
89 testVKeyVObject("a", "b", "c");