Debian Codegraph @

rhino/testsrc/tests/js1_5/Array/regress-107138.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * Date: 29 October 2001
8 *
9 * SUMMARY: Regression test for bug 107138
10 * See http://bugzilla.mozilla.org/show_bug.cgi?id=107138
11 *
12 * The bug: arr['1'] == undefined instead of arr['1'] == 'one'.
13 * The bug was intermittent and did not always occur...
14 *
15 * The cnSTRESS constant defines how many times to repeat this test.
16 */
17 //-----------------------------------------------------------------------------
18 var gTestfile = 'regress-107138.js';
19 var UBound = 0;
20 var cnSTRESS = 10;
21 var cnDASH = '-';
22 var BUGNUMBER = 107138;
23 var summary = 'Regression test for bug 107138';
24 var status = '';
25 var statusitems = [];
26 var actual = '';
27 var actualvalues = [];
28 var expect= '';
29 var expectedvalues = [];
30
31
32 var arr = ['zero', 'one', 'two', 'three', 'four', 'five',
33 'six', 'seven', 'eight', 'nine', 'ten'];
34
35
36 // This bug was intermittent. Stress-test it.
37 for (var j=0; j<cnSTRESS; j++)
38 {
39 status = inSection(j + cnDASH + 1);
40 actual = arr[0];
41 expect = 'zero';
42 addThis();
43
44 status = inSection(j + cnDASH + 2);
45 actual = arr['0'];
46 expect = 'zero';
47 addThis();
48
49 status = inSection(j + cnDASH + 3);
50 actual = arr[1];
51 expect = 'one';
52 addThis();
53
54 status = inSection(j + cnDASH + 4);
55 actual = arr['1'];
56 expect = 'one';
57 addThis();
58
59 status = inSection(j + cnDASH + 5);
60 actual = arr[2];
61 expect = 'two';
62 addThis();
63
64 status = inSection(j + cnDASH + 6);
65 actual = arr['2'];
66 expect = 'two';
67 addThis();
68
69 status = inSection(j + cnDASH + 7);
70 actual = arr[3];
71 expect = 'three';
72 addThis();
73
74 status = inSection(j + cnDASH + 8);
75 actual = arr['3'];
76 expect = 'three';
77 addThis();
78
79 status = inSection(j + cnDASH + 9);
80 actual = arr[4];
81 expect = 'four';
82 addThis();
83
84 status = inSection(j + cnDASH + 10);
85 actual = arr['4'];
86 expect = 'four';
87 addThis();
88
89 status = inSection(j + cnDASH + 11);
90 actual = arr[5];
91 expect = 'five';
92 addThis();
93
94 status = inSection(j + cnDASH + 12);
95 actual = arr['5'];
96 expect = 'five';
97 addThis();
98
99 status = inSection(j + cnDASH + 13);
100 actual = arr[6];
101 expect = 'six';
102 addThis();
103
104 status = inSection(j + cnDASH + 14);
105 actual = arr['6'];
106 expect = 'six';
107 addThis();
108
109 status = inSection(j + cnDASH + 15);
110 actual = arr[7];
111 expect = 'seven';
112 addThis();
113
114 status = inSection(j + cnDASH + 16);
115 actual = arr['7'];
116 expect = 'seven';
117 addThis();
118
119 status = inSection(j + cnDASH + 17);
120 actual = arr[8];
121 expect = 'eight';
122 addThis();
123
124 status = inSection(j + cnDASH + 18);
125 actual = arr['8'];
126 expect = 'eight';
127 addThis();
128
129 status = inSection(j + cnDASH + 19);
130 actual = arr[9];
131 expect = 'nine';
132 addThis();
133
134 status = inSection(j + cnDASH + 20);
135 actual = arr['9'];
136 expect = 'nine';
137 addThis();
138
139 status = inSection(j + cnDASH + 21);
140 actual = arr[10];
141 expect = 'ten';
142 addThis();
143
144 status = inSection(j + cnDASH + 22);
145 actual = arr['10'];
146 expect = 'ten';
147 addThis();
148 }
149
150
151 //-----------------------------------------------------------------------------
152 test();
153 //-----------------------------------------------------------------------------
154
155
156
157 function addThis()
158 {
159 statusitems[UBound] = status;
160 actualvalues[UBound] = actual;
161 expectedvalues[UBound] = expect;
162 UBound++;
163 }
164
165
166 function test()
167 {
168 enterFunc ('test');
169 printBugNumber(BUGNUMBER);
170 printStatus (summary);
171
172 for (var i=0; i<UBound; i++)
173 {
174 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
175 }
176
177 exitFunc ('test');
178 }