S15.1.3.1_A1.3_T2.js (1503B)
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: If B = 10xxxxxx or B = 11111xxx, throw URIError 6 esid: sec-decodeuri-encodeduri 7 description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF] 8 includes: [decimalToHexString.js] 9 ---*/ 10 11 var errorCount = 0; 12 var count = 0; 13 var indexP; 14 var indexO = 0; 15 16 for (var index = 0xF8; index <= 0xFF; index++) { 17 count++; 18 var hex = decimalToPercentHexString(index); 19 try { 20 decodeURI(hex); 21 } catch (e) { 22 if ((e instanceof URIError) === true) continue; 23 } 24 if (indexO === 0) { 25 indexO = index; 26 } else { 27 if ((index - indexP) !== 1) { 28 if ((indexP - indexO) !== 0) { 29 var hexP = decimalToHexString(indexP); 30 var hexO = decimalToHexString(indexO); 31 throw new Test262Error('#' + hexO + '-' + hexP + ' '); 32 } 33 else { 34 var hexP = decimalToHexString(indexP); 35 throw new Test262Error('#' + hexP + ' '); 36 } 37 indexO = index; 38 } 39 } 40 indexP = index; 41 errorCount++; 42 } 43 44 if (errorCount > 0) { 45 if ((indexP - indexO) !== 0) { 46 var hexP = decimalToHexString(indexP); 47 var hexO = decimalToHexString(indexO); 48 throw new Test262Error('#' + hexO + '-' + hexP + ' '); 49 } else { 50 var hexP = decimalToHexString(indexP); 51 throw new Test262Error('#' + hexP + ' '); 52 } 53 throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); 54 } 55 56 reportCompare(0, 0);