tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

regress-107138.js (3622B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 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 UBound = 0;
     19 var cnSTRESS = 10;
     20 var cnDASH = '-';
     21 var BUGNUMBER = 107138;
     22 var summary = 'Regression test for bug 107138';
     23 var status = '';
     24 var statusitems = [];
     25 var actual = '';
     26 var actualvalues = [];
     27 var expect= '';
     28 var expectedvalues = [];
     29 
     30 
     31 var arr = ['zero', 'one', 'two', 'three', 'four', 'five',
     32           'six', 'seven', 'eight', 'nine', 'ten'];
     33 
     34 
     35 // This bug was intermittent. Stress-test it.
     36 for (var j=0; j<cnSTRESS; j++)
     37 {
     38  status = inSection(j + cnDASH + 1);
     39  actual = arr[0];
     40  expect = 'zero';
     41  addThis();
     42 
     43  status = inSection(j + cnDASH + 2);
     44  actual = arr['0'];
     45  expect = 'zero';
     46  addThis();
     47 
     48  status = inSection(j + cnDASH + 3);
     49  actual = arr[1];
     50  expect = 'one';
     51  addThis();
     52 
     53  status = inSection(j + cnDASH + 4);
     54  actual = arr['1'];
     55  expect = 'one';
     56  addThis();
     57 
     58  status = inSection(j + cnDASH + 5);
     59  actual = arr[2];
     60  expect = 'two';
     61  addThis();
     62 
     63  status = inSection(j + cnDASH + 6);
     64  actual = arr['2'];
     65  expect = 'two';
     66  addThis();
     67 
     68  status = inSection(j + cnDASH + 7);
     69  actual = arr[3];
     70  expect = 'three';
     71  addThis();
     72 
     73  status = inSection(j + cnDASH + 8);
     74  actual = arr['3'];
     75  expect = 'three';
     76  addThis();
     77 
     78  status = inSection(j + cnDASH + 9);
     79  actual = arr[4];
     80  expect = 'four';
     81  addThis();
     82 
     83  status = inSection(j + cnDASH + 10);
     84  actual = arr['4'];
     85  expect = 'four';
     86  addThis();
     87 
     88  status = inSection(j + cnDASH + 11);
     89  actual = arr[5];
     90  expect = 'five';
     91  addThis();
     92 
     93  status = inSection(j + cnDASH + 12);
     94  actual = arr['5'];
     95  expect = 'five';
     96  addThis();
     97 
     98  status = inSection(j + cnDASH + 13);
     99  actual = arr[6];
    100  expect = 'six';
    101  addThis();
    102 
    103  status = inSection(j + cnDASH + 14);
    104  actual = arr['6'];
    105  expect = 'six';
    106  addThis();
    107 
    108  status = inSection(j + cnDASH + 15);
    109  actual = arr[7];
    110  expect = 'seven';
    111  addThis();
    112 
    113  status = inSection(j + cnDASH + 16);
    114  actual = arr['7'];
    115  expect = 'seven';
    116  addThis();
    117 
    118  status = inSection(j + cnDASH + 17);
    119  actual = arr[8];
    120  expect = 'eight';
    121  addThis();
    122 
    123  status = inSection(j + cnDASH + 18);
    124  actual = arr['8'];
    125  expect = 'eight';
    126  addThis();
    127 
    128  status = inSection(j + cnDASH + 19);
    129  actual = arr[9];
    130  expect = 'nine';
    131  addThis();
    132 
    133  status = inSection(j + cnDASH + 20);
    134  actual = arr['9'];
    135  expect = 'nine';
    136  addThis();
    137 
    138  status = inSection(j + cnDASH + 21);
    139  actual = arr[10];
    140  expect = 'ten';
    141  addThis();
    142 
    143  status = inSection(j + cnDASH + 22);
    144  actual = arr['10'];
    145  expect = 'ten';
    146  addThis();
    147 }
    148 
    149 
    150 //-----------------------------------------------------------------------------
    151 test();
    152 //-----------------------------------------------------------------------------
    153 
    154 
    155 
    156 function addThis()
    157 {
    158  statusitems[UBound] = status;
    159  actualvalues[UBound] = actual;
    160  expectedvalues[UBound] = expect;
    161  UBound++;
    162 }
    163 
    164 
    165 function test()
    166 {
    167  printBugNumber(BUGNUMBER);
    168  printStatus (summary);
    169 
    170  for (var i=0; i<UBound; i++)
    171  {
    172    reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    173  }
    174 }