tor-browser

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

S15.1.2.2_A8.js (1838B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    parseInt may interpret only a leading portion of the string as
      7    a number value; it ignores any characters that cannot be interpreted as part
      8    of the notation of an decimal literal, and no indication is given that any such
      9    characters were ignored.
     10 esid: sec-parseint-string-radix
     11 description: Complex test without eval
     12 includes: [decimalToHexString.js]
     13 ---*/
     14 
     15 //CHECK
     16 var errorCount = 0;
     17 var count = 0;
     18 var indexP;
     19 var indexO = 0;
     20 for (var index = 0; index <= 65535; index++) {
     21  if ((index < 0x0030) || (index > 0x0039) &&
     22    (index < 0x0041) || (index > 0x005A) &&
     23    (index < 0x0061) || (index > 0x007A)) {
     24    if (parseInt("1Z" + String.fromCharCode(index), 36) !== 71) {
     25      if (indexO === 0) {
     26        indexO = index;
     27      } else {
     28        if ((index - indexP) !== 1) {
     29          if ((indexP - indexO) !== 0) {
     30            var hexP = decimalToHexString(indexP);
     31            var hexO = decimalToHexString(indexO);
     32            throw new Test262Error('#' + hexO + '-' + hexP + ' ');
     33          }
     34          else {
     35            var hexP = decimalToHexString(indexP);
     36            throw new Test262Error('#' + hexP + ' ');
     37          }
     38          indexO = index;
     39        }
     40      }
     41      indexP = index;
     42      errorCount++;
     43    }
     44    count++;
     45  }
     46 }
     47 
     48 if (errorCount > 0) {
     49  if ((indexP - indexO) !== 0) {
     50    var hexP = decimalToHexString(indexP);
     51    var hexO = decimalToHexString(indexO);
     52    throw new Test262Error('#' + hexO + '-' + hexP + ' ');
     53  } else {
     54    var hexP = decimalToHexString(indexP);
     55    throw new Test262Error('#' + hexP + ' ');
     56  }
     57  throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
     58 }
     59 
     60 reportCompare(0, 0);