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