mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 13:04:39 +02:00
avoid unnecessary calls to decimalToHexString() (#3170)
This commit is contained in:
parent
836111dc3c
commit
603b10dbfa
@ -10,14 +10,13 @@ includes: [decimalToHexString.js]
|
||||
|
||||
for (var indexI = 0; indexI <= 65535; indexI++) {
|
||||
if (indexI !== 0x25) {
|
||||
var hex = decimalToHexString(indexI);
|
||||
try {
|
||||
var str = String.fromCharCode(indexI);
|
||||
if (decodeURI(str) !== str) {
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,13 @@ includes: [decimalToHexString.js]
|
||||
|
||||
for (var indexI = 0; indexI <= 65535; indexI++) {
|
||||
if (indexI !== 0x25) {
|
||||
var hex = decimalToHexString(indexI);
|
||||
try {
|
||||
var str = String.fromCharCode(indexI);
|
||||
if (decodeURIComponent(str) !== str) {
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xDC00; index <= 0xDFFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURI(String.fromCharCode(index));
|
||||
} catch (e) {
|
||||
|
@ -15,7 +15,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xDC00; index <= 0xDFFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURI(String.fromCharCode(index, 0x0041));
|
||||
} catch (e) {
|
||||
|
@ -17,7 +17,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURI(String.fromCharCode(index));
|
||||
} catch (e) {
|
||||
|
@ -17,7 +17,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURI(String.fromCharCode(0x0041, index));
|
||||
} catch (e) {
|
||||
|
@ -22,7 +22,6 @@ for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var res = true;
|
||||
for (var indexC = 0; indexC < chars.length; indexC++) {
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURI(String.fromCharCode(index, chars[indexC]));
|
||||
} catch (e) {
|
||||
|
@ -15,7 +15,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xDC00; index <= 0xDFFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURIComponent(String.fromCharCode(index));
|
||||
} catch (e) {
|
||||
|
@ -15,7 +15,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xDC00; index <= 0xDFFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURIComponent(String.fromCharCode(index, 0x0041));
|
||||
} catch (e) {
|
||||
|
@ -17,7 +17,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURIComponent(String.fromCharCode(index));
|
||||
} catch (e) {
|
||||
|
@ -17,7 +17,6 @@ var indexO = 0;
|
||||
|
||||
for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURIComponent(String.fromCharCode(0x0041, index));
|
||||
} catch (e) {
|
||||
|
@ -22,7 +22,6 @@ for (var index = 0xD800; index <= 0xDBFF; index++) {
|
||||
count++;
|
||||
var res = true;
|
||||
for (var indexC = 0; indexC < chars.length; indexC++) {
|
||||
var hex = decimalToHexString(index);
|
||||
try {
|
||||
encodeURIComponent(String.fromCharCode(index, chars[indexC]));
|
||||
} catch (e) {
|
||||
|
@ -19,7 +19,6 @@ var indexP;
|
||||
var indexO = 0;
|
||||
for (var index = 0; index <= 65535; index++) {
|
||||
if ((index < 0x0030) || (index > 0x0039)) {
|
||||
var hex = decimalToHexString(index);
|
||||
if (parseFloat("0.1e1" + String.fromCharCode(index)) !== 1) {
|
||||
if (indexO === 0) {
|
||||
indexO = index;
|
||||
|
@ -21,7 +21,6 @@ for (var index = 0; index <= 65535; index++) {
|
||||
if ((index < 0x0030) || (index > 0x0039) &&
|
||||
(index < 0x0041) || (index > 0x005A) &&
|
||||
(index < 0x0061) || (index > 0x007A)) {
|
||||
var hex = decimalToHexString(index);
|
||||
if (parseInt("1Z" + String.fromCharCode(index), 36) !== 71) {
|
||||
if (indexO === 0) {
|
||||
indexO = index;
|
||||
|
@ -7,41 +7,17 @@ info: |
|
||||
character
|
||||
es5id: 7.4_A6
|
||||
description: "\"var\"+ yy+ \"xx = 1\", insert instead of yy all Unicode characters"
|
||||
includes: [decimalToHexString.js]
|
||||
---*/
|
||||
|
||||
for (var indexI = 0; indexI <= 65535; indexI++) {
|
||||
try {
|
||||
var xx = 0;
|
||||
eval("/*var " + String.fromCharCode(indexI) + "xx = 1*/");
|
||||
var hex = decimalToHexString(indexI);
|
||||
if (xx !== 0) {
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
} catch (e){
|
||||
throw new Test262Error('#' + hex + ' ');
|
||||
throw new Test262Error('#' + decimalToHexString(indexI) + ' ');
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user