S15.1.3.2_A2.2_T1.js (1520B)
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 B1 = 0xxxxxxxx ([0x00 - 0x7F]), return B1 6 esid: sec-decodeuricomponent-encodeduricomponent 7 description: Complex tests, use RFC 3629 8 includes: [decimalToHexString.js] 9 ---*/ 10 11 var errorCount = 0; 12 var count = 0; 13 var indexP; 14 var indexO = 0; 15 for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) { 16 count++; 17 var hexB1 = decimalToPercentHexString(indexB1); 18 var index = indexB1; 19 var hex = String.fromCharCode(index); 20 if (decodeURIComponent(hexB1) === hex) continue; 21 22 if (indexO === 0) { 23 indexO = index; 24 } else { 25 if ((index - indexP) !== 1) { 26 if ((indexP - indexO) !== 0) { 27 var hexP = decimalToHexString(indexP); 28 var hexO = decimalToHexString(indexO); 29 throw new Test262Error('#' + hexO + '-' + hexP + ' '); 30 } 31 else { 32 var hexP = decimalToHexString(indexP); 33 throw new Test262Error('#' + hexP + ' '); 34 } 35 indexO = index; 36 } 37 } 38 indexP = index; 39 errorCount++; 40 } 41 42 if (errorCount > 0) { 43 if ((indexP - indexO) !== 0) { 44 var hexP = decimalToHexString(indexP); 45 var hexO = decimalToHexString(indexO); 46 throw new Test262Error('#' + hexO + '-' + hexP + ' '); 47 } else { 48 var hexP = decimalToHexString(indexP); 49 throw new Test262Error('#' + hexP + ' '); 50 } 51 throw new Test262Error('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' '); 52 } 53 54 reportCompare(0, 0);