Optimize decodeURI/encodeURI tests (#987)

* Move decimalToHexString into harness instead of duplicating it in multiple files

* Optimize decimalToHexString and support numbers greater than 65535

* Replace alternative decimalToHexString function with include for decimalToHexString.js

* Add decimalToHex2String to return the string representation of a two-digit hex-number

* Replace decimalToHex2String with decimalToPercentHexString to return the percent hex-encoded string of a two-digit hex-number

* Replace two String.fromCharCode calls with a single call

* Further reduce string concatentations in decodeURI[Component] tests

* Remove unnecessary Test262Error error handling in catch-clauses

* Remove try/catch wrappings in decodeURI/encodeURI tests
This commit is contained in:
André Bargull 2017-04-18 22:31:31 +02:00 committed by Leo Balter
parent d354788f6f
commit 94f6003d11
81 changed files with 329 additions and 2198 deletions

View File

@ -0,0 +1,21 @@
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function decimalToHexString(n) {
var hex = "0123456789ABCDEF";
n >>>= 0;
var s = "";
while (n) {
s = hex[n & 0xf] + s;
n >>>= 4;
}
while (s.length < 4) {
s = "0" + s;
}
return s;
}
function decimalToPercentHexString(n) {
var hex = "0123456789ABCDEF";
return "%" + hex[(n >> 4) & 0xf] + hex[n & 0xf];
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.13_T1
description: Complex tests. B = [0xC0 - 0xDF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xC0; indexB <= 0xDF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2));
decodeURI(hexB + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.13_T2
description: Complex tests. B = [0xC0 - 0xDF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xC0; indexB <= 0xDF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2));
decodeURI(hexB + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.14_T1
description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0");
decodeURI(hexB + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.14_T2
description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2));
decodeURI(hexB + "%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.14_T3
description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0");
decodeURI(hexB + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.14_T4
description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2));
decodeURI(hexB + "%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T1
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0");
decodeURI(hexB + hexC + "%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T2
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0");
decodeURI(hexB + "%A0" + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T3
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2));
decodeURI(hexB + "%A0%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T4
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0");
decodeURI(hexB + hexC + "%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T5
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0");
decodeURI(hexB + "%A0" + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.1_A1.15_T6
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURI("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2));
decodeURI(hexB + "%A0%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 10xxxxxx or B = 11111xxx, throw URIError
es5id: 15.1.3.1_A1.3_T1
description: Complex tests. B = 10xxxxxx -> B in [0x80 - 0xBF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -14,9 +15,9 @@ var indexO = 0;
for (var index = 0x80; index <= 0xBF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2));
decodeURI(hex);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 10xxxxxx or B = 11111xxx, throw URIError
es5id: 15.1.3.1_A1.3_T2
description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -14,9 +15,9 @@ var indexO = 0;
for (var index = 0xF8; index <= 0xFF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2));
decodeURI(hex);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 110xxxxx (n = 2) and (k + 2) + 3 >= length, throw URIError
es5id: 15.1.3.1_A1.4_T1
description: Complex tests. B = [0xC0 - 0xDF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xC0; index <= 0xDF; index++) {
var str = "";
var result = true;
for (var len = 0; len < 3; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + str);
decodeURI(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 1110xxxx (n = 3) and (k + 2) + 6 >= length, throw URIError
es5id: 15.1.3.1_A1.5_T1
description: Complex tests. B = [0xE0 - 0xEF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xE0; index <= 0xEF; index++) {
var str = "";
var result = true;
for (var len = 0; len < 6; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + str);
decodeURI(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 11110xxx (n = 4) and (k + 2) + 9 >= length, throw URIError
es5id: 15.1.3.1_A1.6_T1
description: Complex tests. B = [0xF0 - 0xF7]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xF0; index <= 0xF7; index++) {
var str = "";
var result = true;
for (var len = 0; len < 9; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + str);
decodeURI(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.1_A1.7_T1
description: Complex tests. B = [0xC0 - 0xDF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,9 +17,9 @@ var indexO = 0;
for (var index = 0xC0; index <= 0xDF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "111");
decodeURI(hex + "111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6) not equal "%", throw URIError
es5id: 15.1.3.1_A1.8_T1
description: >
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 3) not equal
"%"
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 3) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xE0; index <= 0xEF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "111%A0");
decodeURI(hex + "111%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6) not equal "%", throw URIError
es5id: 15.1.3.1_A1.8_T2
description: >
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 6) not equal
"%"
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 6) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xE0; index <= 0xEF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "%A0111");
decodeURI(hex + "%A0111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.1_A1.9_T1
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 3) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 3) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "111%A0%A0");
decodeURI(hex + "111%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.1_A1.9_T2
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 6) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 6) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "%A0111%A0");
decodeURI(hex + "%A0111%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.1_A1.9_T3
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 9) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 9) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURI("%" + hex.substring(2) + "%A0%A0111");
decodeURI(hex + "%A0%A0111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) not equal "%", return this char
es5id: 15.1.3.1_A2.1_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
//CHECK
@ -30,27 +31,3 @@ for (var indexI = 0; indexI <= 65535; indexI++) {
if (errorCount > 0) {
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B1 = 0xxxxxxxx ([0x00 - 0x7F]), without [uriReserved, #], return B1
es5id: 15.1.3.1_A2.2_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,18 +16,15 @@ var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","];
l:
for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) {
count++;
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
var index = indexB1;
try {
var hex = String.fromCharCode(index);
for (var indexC = 0; indexC < uriReserved.length; indexC++) {
if (hex === uriReserved[indexC]) continue l;
}
if (hex === "#") continue l;
if (decodeURI("%" + hexB1.substring(2)) === hex) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
var hex = String.fromCharCode(index);
for (var indexC = 0; indexC < uriReserved.length; indexC++) {
if (hex === uriReserved[indexC]) continue l;
}
if (hex === "#") continue;
if (decodeURI(hexB1) === hex) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -58,27 +56,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
B1 = [0xC0, 0xC1], return UTF8(B1, B2)
es5id: 15.1.3.1_A2.3_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,16 +16,13 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xC2; indexB1 <= 0xDF; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
count++;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
var index = (indexB1 & 0x1F) * 0x40 + (indexB2 & 0x3F);
try {
if (decodeURI("%" + hexB1.substring(2) + "%" + hexB2.substring(2)) === String.fromCharCode(index)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURI(hexB1_B2) === String.fromCharCode(index)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -57,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -8,6 +8,7 @@ info: >
0xDFFF), return UTF8(B1, B2, B3)
es5id: 15.1.3.1_A2.4_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,20 +17,17 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xE0; indexB1 <= 0xEF; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
if ((indexB1 === 0xE0) && (indexB2 <= 0x9F)) continue;
if ((indexB1 === 0xED) && (0xA0 <= indexB2)) continue;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) {
count++;
var hexB3 = decimalToHexString(indexB3);
var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3);
var index = (indexB1 & 0x0F) * 0x1000 + (indexB2 & 0x3F) * 0x40 + (indexB3 & 0x3F);
try {
if (decodeURI("%" + hexB1.substring(2) + "%" + hexB2.substring(2) + "%" + hexB3.substring(2)) === String.fromCharCode(index)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURI(hexB1_B2_B3) === String.fromCharCode(index)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -63,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -8,6 +8,7 @@ info: >
return UTF8(B1, B2, B3, B4)
es5id: 15.1.3.1_A2.5_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,24 +17,21 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xF0; indexB1 <= 0xF4; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
if ((indexB1 === 0xF0) && (indexB2 <= 0x9F)) continue;
if ((indexB1 === 0xF4) && (indexB2 >= 0x90)) continue;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) {
var hexB3 = decimalToHexString(indexB3);
var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3);
for (var indexB4 = 0x80; indexB4 <= 0xBF; indexB4++) {
var hexB4 = decimalToHexString(indexB4);
var hexB1_B2_B3_B4 = hexB1_B2_B3 + decimalToPercentHexString(indexB4);
count++;
var index = (indexB1 & 0x07) * 0x40000 + (indexB2 & 0x3F) * 0x1000 + (indexB3 & 0x3F) * 0x40 + (indexB4 & 0x3F);
var L = ((index - 0x10000) & 0x03FF) + 0xDC00;
var H = (((index - 0x10000) >> 10) & 0x03FF) + 0xD800;
try {
if (decodeURI("%" + hexB1.substring(3) + "%" + hexB2.substring(3) + "%" + hexB3.substring(3) + "%" + hexB4.substring(3)) === String.fromCharCode(H) + String.fromCharCode(L)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURI(hexB1_B2_B3_B4) === String.fromCharCode(H, L)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -68,27 +66,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 4; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.13_T1
description: Complex tests. B = [0xC0 - 0xDF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xC0; indexB <= 0xDF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2));
decodeURIComponent(hexB + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.13_T2
description: Complex tests. B = [0xC0 - 0xDF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xC0; indexB <= 0xDF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2));
decodeURIComponent(hexB + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.14_T1
description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0");
decodeURIComponent(hexB + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.14_T2
description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2));
decodeURIComponent(hexB + "%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.14_T3
description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0");
decodeURIComponent(hexB + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.14_T4
description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xE0; indexB <= 0xEF; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2));
decodeURIComponent(hexB + "%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T1
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0");
decodeURIComponent(hexB + hexC + "%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T2
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0");
decodeURIComponent(hexB + "%A0" + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T3
description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0x00; indexC <= 0x7F; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2));
decodeURIComponent(hexB + "%A0%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T4
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0");
decodeURIComponent(hexB + hexC + "%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T5
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0");
decodeURIComponent(hexB + "%A0" + hexC + "%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
throw URIError
es5id: 15.1.3.2_A1.15_T6
description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,12 @@ var indexO = 0;
for (var indexB = 0xF0; indexB <= 0xF7; indexB++) {
count++;
var hexB = decimalToHexString(indexB);
var hexB = decimalToPercentHexString(indexB);
var result = true;
for (var indexC = 0xC0; indexC <= 0xFF; indexC++) {
var hexC = decimalToHexString(indexC);
var hexC = decimalToPercentHexString(indexC);
try {
decodeURIComponent("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2));
decodeURIComponent(hexB + "%A0%A0" + hexC);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -60,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 10xxxxxx or B = 11111xxx, throw URIError
es5id: 15.1.3.2_A1.3_T1
description: Complex tests. B = 10xxxxxx -> B in [0x80 - 0xBF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -14,9 +15,9 @@ var indexO = 0;
for (var index = 0x80; index <= 0xBF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2));
decodeURIComponent(hex);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 10xxxxxx or B = 11111xxx, throw URIError
es5id: 15.1.3.2_A1.3_T2
description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -14,9 +15,9 @@ var indexO = 0;
for (var index = 0xF8; index <= 0xFF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2));
decodeURIComponent(hex);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 110xxxxx (n = 2) and (k + 2) + 3 >= length, throw URIError
es5id: 15.1.3.2_A1.4_T1
description: Complex tests. B = [0xC0 - 0xDF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xC0; index <= 0xDF; index++) {
var str = "";
var result = true;
for (var len = 0; len < 3; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + str);
decodeURIComponent(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 1110xxxx (n = 3) and (k + 2) + 6 >= length, throw URIError
es5id: 15.1.3.2_A1.5_T1
description: Complex tests. B = [0xE0 - 0xEF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xE0; index <= 0xEF; index++) {
var str = "";
var result = true;
for (var len = 0; len < 6; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + str);
decodeURIComponent(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B = 11110xxx (n = 4) and (k + 2) + 9 >= length, throw URIError
es5id: 15.1.3.2_A1.6_T1
description: Complex tests. B = [0xF0 - 0xF7]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -17,9 +18,9 @@ for (var index = 0xF0; index <= 0xF7; index++) {
var str = "";
var result = true;
for (var len = 0; len < 9; len++) {
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + str);
decodeURIComponent(hex + str);
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -59,27 +60,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.2_A1.7_T1
description: Complex tests. B = [0xC0 - 0xDF]
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,9 +17,9 @@ var indexO = 0;
for (var index = 0xC0; index <= 0xDF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "111");
decodeURIComponent(hex + "111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6) not equal "%", throw URIError
es5id: 15.1.3.2_A1.8_T1
description: >
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 3) not equal
"%"
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 3) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xE0; index <= 0xEF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "111%A0");
decodeURIComponent(hex + "111%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6) not equal "%", throw URIError
es5id: 15.1.3.2_A1.8_T2
description: >
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 6) not equal
"%"
Complex tests. B = [0xE0 - 0xEF], string.charAt(k + 6) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xE0; index <= 0xEF; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "%A0111");
decodeURIComponent(hex + "%A0111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.2_A1.9_T1
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 3) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 3) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "111%A0%A0");
decodeURIComponent(hex + "111%A0%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.2_A1.9_T2
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 6) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 6) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "%A0111%A0");
decodeURIComponent(hex + "%A0111%A0");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,8 +7,8 @@ info: >
string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError
es5id: 15.1.3.2_A1.9_T3
description: >
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 9) not equal
"%"
Complex tests. B = [0xF0 - 0x0F7], string.charAt(k + 9) not equal "%"
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -18,9 +18,9 @@ var indexO = 0;
for (var index = 0xF0; index <= 0xF7; index++) {
count++;
var hex = decimalToHexString(index);
var hex = decimalToPercentHexString(index);
try {
decodeURIComponent("%" + hex.substring(2) + "%A0%A0111");
decodeURIComponent(hex + "%A0%A0111");
} catch (e) {
if ((e instanceof URIError) === true) continue;
}
@ -55,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) not equal "%", return this char
es5id: 15.1.3.2_A2.1_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
//CHECK
@ -30,27 +31,3 @@ for (var indexI = 0; indexI <= 65535; indexI++) {
if (errorCount > 0) {
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count);
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If B1 = 0xxxxxxxx ([0x00 - 0x7F]), return B1
es5id: 15.1.3.2_A2.2_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -13,14 +14,11 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) {
count++;
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
var index = indexB1;
try {
var hex = String.fromCharCode(index);
if (decodeURIComponent("%" + hexB1.substring(2)) === hex) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
var hex = String.fromCharCode(index);
if (decodeURIComponent(hexB1) === hex) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -52,27 +50,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
B1 = [0xC0, 0xC1], return UTF8(B1, B2)
es5id: 15.1.3.2_A2.3_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,16 +16,13 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xC2; indexB1 <= 0xDF; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
count++;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
var index = (indexB1 & 0x1F) * 0x40 + (indexB2 & 0x3F);
try {
if (decodeURIComponent("%" + hexB1.substring(2) + "%" + hexB2.substring(2)) === String.fromCharCode(index)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURIComponent(hexB1_B2) === String.fromCharCode(index)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -57,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -8,6 +8,7 @@ info: >
0xDFFF), return UTF8(B1, B2, B3)
es5id: 15.1.3.2_A2.4_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,20 +17,17 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xE0; indexB1 <= 0xEF; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
if ((indexB1 === 0xE0) && (indexB2 <= 0x9F)) continue;
if ((indexB1 === 0xED) && (0xA0 <= indexB2)) continue;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) {
count++;
var hexB3 = decimalToHexString(indexB3);
var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3);
var index = (indexB1 & 0x0F) * 0x1000 + (indexB2 & 0x3F) * 0x40 + (indexB3 & 0x3F);
try {
if (decodeURIComponent("%" + hexB1.substring(2) + "%" + hexB2.substring(2) + "%" + hexB3.substring(2)) === String.fromCharCode(index)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURIComponent(hexB1_B2_B3) === String.fromCharCode(index)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -63,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -8,6 +8,7 @@ info: >
return UTF8(B1, B2, B3, B4)
es5id: 15.1.3.2_A2.5_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,24 +17,21 @@ var indexP;
var indexO = 0;
for (var indexB1 = 0xF0; indexB1 <= 0xF4; indexB1++) {
var hexB1 = decimalToHexString(indexB1);
var hexB1 = decimalToPercentHexString(indexB1);
for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) {
if ((indexB1 === 0xF0) && (indexB2 <= 0x9F)) continue;
if ((indexB1 === 0xF4) && (indexB2 >= 0x90)) continue;
var hexB2 = decimalToHexString(indexB2);
var hexB1_B2 = hexB1 + decimalToPercentHexString(indexB2);
for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) {
var hexB3 = decimalToHexString(indexB3);
var hexB1_B2_B3 = hexB1_B2 + decimalToPercentHexString(indexB3);
for (var indexB4 = 0x80; indexB4 <= 0xBF; indexB4++) {
var hexB4 = decimalToHexString(indexB4);
var hexB1_B2_B3_B4 = hexB1_B2_B3 + decimalToPercentHexString(indexB4);
count++;
var index = (indexB1 & 0x07) * 0x40000 + (indexB2 & 0x3F) * 0x1000 + (indexB3 & 0x3F) * 0x40 + (indexB4 & 0x3F);
var L = ((index - 0x10000) & 0x03FF) + 0xDC00;
var H = (((index - 0x10000) >> 10) & 0x03FF) + 0xD800;
try {
if (decodeURIComponent("%" + hexB1.substring(3) + "%" + hexB2.substring(3) + "%" + hexB3.substring(3) + "%" + hexB4.substring(3)) === String.fromCharCode(H) + String.fromCharCode(L)) continue;
} catch (e) {
if (e instanceof Test262Error) throw e;
}
if (decodeURIComponent(hexB1_B2_B3_B4) === String.fromCharCode(H, L)) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -68,27 +66,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 4; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
es5id: 15.1.3.3_A1.1_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
es5id: 15.1.3.3_A1.1_T2
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.3_A1.2_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.3_A1.2_T2
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -9,6 +9,7 @@ es5id: 15.1.3.3_A1.3_T1
description: >
Complex tests, string.charAt(k+1) in [0x0000, 0xD7FF, 0xD800,
0xDBFE, 0xDBFF, 0xE000, 0xFFFF]
includes: [decimalToHexString.js]
---*/
var chars = [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF];
@ -62,27 +63,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
return 1 octet (00000000 0zzzzzzz -> 0zzzzzzz)
es5id: 15.1.3.3_A2.1_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","];
@ -27,9 +28,8 @@ for (var index = 0x0000; index <= 0x007F; index++) {
if (uriUnescaped[indexC] === str) continue l;
}
if ("#" === str) continue l;
try {
if (encodeURI(str).toUpperCase() === "%" + decimalToHexString(index).substring(2)) continue l;
} catch(e) {}
if (encodeURI(str).toUpperCase() === decimalToPercentHexString(index)) continue l;
if (indexO === 0) {
indexO = index;
} else {
@ -61,27 +61,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 110yyyyy 10zzzzzz)
es5id: 15.1.3.3_A2.2_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,11 @@ var indexO = 0;
l:
for (var index = 0x0080; index <= 0x07FF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x00C0 + (index & 0x07C0) / 0x0040).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x00C0 + (index & 0x07C0) / 0x0040);
var str = String.fromCharCode(index);
try {
if (encodeURI(str).toUpperCase() === "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURI(str).toUpperCase() === hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
es5id: 15.1.3.3_A2.3_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,13 +16,12 @@ var indexP;
var indexO = 0;
for (var index = 0x0800; index <= 0xD7FF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
var str = String.fromCharCode(index);
try {
if (encodeURI(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURI(str).toUpperCase() === hex3 + hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -10,6 +10,7 @@ es5id: 15.1.3.3_A2.4_T1
description: >
Complex tests, use RFC 3629, string.charAt(k+1) in [0xDC00,
0xDDFF, 0xDFFF]
includes: [decimalToHexString.js]
---*/
var chars = [0xDC00, 0xDDFF, 0xDFFF];
@ -21,16 +22,14 @@ for (var index = 0xD800; index <= 0xDBFF; index++) {
var res = true;
for (var indexC = 0; indexC < chars.length; indexC++) {
var index1 = (index - 0xD800) * 0x400 + (chars[indexC] - 0xDC00) + 0x10000;
var hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2);
var hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
var str = String.fromCharCode(index, chars[indexC]);
try {
if (encodeURI(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) {
res = false;
}
} catch(e) {res = false}
if (encodeURI(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
res = false;
}
if (res !== true) {
if (indexO === 0) {
@ -66,27 +65,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -10,6 +10,7 @@ es5id: 15.1.3.3_A2.4_T2
description: >
Complex tests, use RFC 3629, string.charAt(k) in [0xD800, 0xDBFF,
0xD9FF]
includes: [decimalToHexString.js]
---*/
var chars = [0xD800, 0xDBFF, 0xD9FF];
@ -21,16 +22,14 @@ for (var index = 0xDC00; index <= 0xDFFF; index++) {
var res = true;
for (var indexC = 0; indexC < chars.length; indexC++) {
var index1 = (chars[indexC] - 0xD800) * 0x400 + (index - 0xDC00) + 0x10000;
var hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2);
var hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
var str = String.fromCharCode(chars[indexC], index);
try {
if (encodeURI(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) {
res = false;
}
} catch(e) {res = false}
if (encodeURI(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
res = false;
}
if (res !== true) {
if (indexO === 0) {
@ -66,27 +65,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
es5id: 15.1.3.3_A2.5_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,13 +16,12 @@ var indexP;
var indexO = 0;
for (var index = 0xE000; index <= 0xFFFF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
var str = String.fromCharCode(index);
try {
if (encodeURI(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURI(str).toUpperCase() === hex3 + hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
es5id: 15.1.3.4_A1.1_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -5,6 +5,7 @@
info: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError
es5id: 15.1.3.4_A1.1_T2
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -51,27 +52,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.4_A1.2_T1
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
URIError
es5id: 15.1.3.4_A1.2_T2
description: Complex tests
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -53,27 +54,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -9,6 +9,7 @@ es5id: 15.1.3.4_A1.3_T1
description: >
Complex tests, string.charAt(k+1) in [0x0000, 0xD7FF, 0xD800,
0xDBFE, 0xDBFF, 0xE000, 0xFFFF]
includes: [decimalToHexString.js]
---*/
var chars = [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF];
@ -62,27 +63,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
(00000000 0zzzzzzz -> 0zzzzzzz)
es5id: 15.1.3.4_A2.1_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var uriUnescaped = ["-", "_", ".", "!", "~", "*", "'", "(", ")", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
@ -22,9 +23,8 @@ for (var index = 0x0000; index <= 0x007F; index++) {
for (var indexC = 0; indexC < uriUnescaped.length; indexC++) {
if (uriUnescaped[indexC] === str) continue l;
}
try {
if (encodeURIComponent(str).toUpperCase() === "%" + decimalToHexString(index).substring(2)) continue l;
} catch(e) {}
if (encodeURIComponent(str).toUpperCase() === decimalToPercentHexString(index)) continue l;
if (indexO === 0) {
indexO = index;
} else {
@ -56,27 +56,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 110yyyyy 10zzzzzz)
es5id: 15.1.3.4_A2.2_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -16,12 +17,11 @@ var indexO = 0;
l:
for (var index = 0x0080; index <= 0x07FF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x00C0 + (index & 0x07C0) / 0x0040).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x00C0 + (index & 0x07C0) / 0x0040);
var str = String.fromCharCode(index);
try {
if (encodeURIComponent(str).toUpperCase() === "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURIComponent(str).toUpperCase() === hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
es5id: 15.1.3.4_A2.3_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,13 +16,12 @@ var indexP;
var indexO = 0;
for (var index = 0x0800; index <= 0xD7FF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
var str = String.fromCharCode(index);
try {
if (encodeURIComponent(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURIComponent(str).toUpperCase() === hex3 + hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -10,6 +10,7 @@ es5id: 15.1.3.4_A2.4_T1
description: >
Complex tests, use RFC 3629, string.charAt(k+1) in [0xDC00,
0xDDFF, 0xDFFF]
includes: [decimalToHexString.js]
---*/
var chars = [0xDC00, 0xDDFF, 0xDFFF];
@ -21,16 +22,14 @@ for (var index = 0xD800; index <= 0xDBFF; index++) {
var res = true;
for (var indexC = 0; indexC < chars.length; indexC++) {
var index1 = (index - 0xD800) * 0x400 + (chars[indexC] - 0xDC00) + 0x10000;
var hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2);
var hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
var str = String.fromCharCode(index, chars[indexC]);
try {
if (encodeURIComponent(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) {
res = false;
}
} catch(e) {res = false}
if (encodeURIComponent(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
res = false;
}
if (res !== true) {
if (indexO === 0) {
@ -66,27 +65,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -10,6 +10,7 @@ es5id: 15.1.3.4_A2.4_T2
description: >
Complex tests, use RFC 3629, string.charAt(k) in [0xD800, 0xDBFF,
0xD9FF]
includes: [decimalToHexString.js]
---*/
var chars = [0xD800, 0xDBFF, 0xD9FF];
@ -21,16 +22,14 @@ for (var index = 0xDC00; index <= 0xDFFF; index++) {
var res = true;
for (var indexC = 0; indexC < chars.length; indexC++) {
var index1 = (chars[indexC] - 0xD800) * 0x400 + (index - 0xDC00) + 0x10000;
var hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2);
var hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index1 & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index1 & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x0080 + (index1 & 0x3F000) / 0x1000);
var hex4 = decimalToPercentHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000);
var str = String.fromCharCode(chars[indexC], index);
try {
if (encodeURIComponent(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) {
res = false;
}
} catch(e) {res = false}
if (encodeURIComponent(str).toUpperCase() === hex4 + hex3 + hex2 + hex1) continue;
res = false;
}
if (res !== true) {
if (indexO === 0) {
@ -66,27 +65,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -7,6 +7,7 @@ info: >
yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz)
es5id: 15.1.3.4_A2.5_T1
description: Complex tests, use RFC 3629
includes: [decimalToHexString.js]
---*/
var errorCount = 0;
@ -15,13 +16,12 @@ var indexP;
var indexO = 0;
for (var index = 0xE000; index <= 0xFFFF; index++) {
count++;
var hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2);
var hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2);
var hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2);
var hex1 = decimalToPercentHexString(0x0080 + (index & 0x003F));
var hex2 = decimalToPercentHexString(0x0080 + (index & 0x0FC0) / 0x0040);
var hex3 = decimalToPercentHexString(0x00E0 + (index & 0xF000) / 0x1000);
var str = String.fromCharCode(index);
try {
if (encodeURIComponent(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) continue;
} catch(e) {}
if (encodeURIComponent(str).toUpperCase() === hex3 + hex2 + hex1) continue;
if (indexO === 0) {
indexO = index;
} else {
@ -53,27 +53,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -9,6 +9,7 @@ info: >
characters were ignored.
es5id: 15.1.2.3_A6
description: Complex test without eval
includes: [decimalToHexString.js]
---*/
//CHECK
@ -54,27 +55,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}

View File

@ -9,6 +9,7 @@ info: >
characters were ignored.
es5id: 15.1.2.2_A8
description: Complex test without eval
includes: [decimalToHexString.js]
---*/
//CHECK
@ -56,27 +57,3 @@ if (errorCount > 0) {
}
$ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count + ' ');
}
function decimalToHexString(n) {
n = Number(n);
var h = "";
for (var i = 3; i >= 0; i--) {
if (n >= Math.pow(16, i)) {
var t = Math.floor(n / Math.pow(16, i));
n -= t * Math.pow(16, i);
if ( t >= 10 ) {
if ( t == 10 ) { h += "A"; }
if ( t == 11 ) { h += "B"; }
if ( t == 12 ) { h += "C"; }
if ( t == 13 ) { h += "D"; }
if ( t == 14 ) { h += "E"; }
if ( t == 15 ) { h += "F"; }
} else {
h += String(t);
}
} else {
h += "0";
}
}
return h;
}