diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI')
52 files changed, 3103 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.10_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.10_T1.js new file mode 100644 index 000000000..d800b8b88 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.10_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.10_T1; + * @section: 15.1.3.1; + * @assertion: If B = 110xxxxx (n = 2) and string.charAt(k + 4) and + * string.charAt(k + 5) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%C0%" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 110xxxxx (n = 2) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T1.js new file mode 100644 index 000000000..a70f84b26 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.11_T1; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and + * string.charAt(k + 5)) or (string.charAt(k + 7) and + * string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests, string.charAt(k + 4) and string.charAt(k + 5) + * do not represent hexadecimal digits; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%E0%" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T2.js new file mode 100644 index 000000000..0226c0dd1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.11_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.11_T2; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and (string.charAt(k + 4) and + * string.charAt(k + 5)) or (string.charAt(k + 7) and + * string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests, string.charAt(k + 7) and string.charAt(k + 8) + * do not represent hexadecimal digits; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%E0%" + "%A0" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 1110xxxx (n = 3) and (string.charAt(k + 7) and string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T1.js new file mode 100644 index 000000000..6d42b79e6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.12_T1; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + * string.charAt(k + 5)) or (string.charAt(k + 7) and + * string.charAt(k + 8)) or (string.charAt(k + 10) and + * string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests, string.charAt(k + 4) and string.charAt(k + 5) + * do not represent hexadecimal digits; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0%" + String.fromCharCode(indexJ, indexJ) + "%A0%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 4) and string.charAt(k + 5)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T2.js new file mode 100644 index 000000000..ca20a9ff1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.12_T2; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + * string.charAt(k + 5)) or (string.charAt(k + 7) and + * string.charAt(k + 8)) or (string.charAt(k + 10) and + * string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests, string.charAt(k + 7) and string.charAt(k + 7) + * do not represent hexadecimal digits; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0%" + "%A0" + String.fromCharCode(indexJ, indexJ) + "%A0"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 7) and string.charAt(k + 8)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T3.js new file mode 100644 index 000000000..c5a3bd5f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.12_T3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.12_T3; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and (string.charAt(k + 4) and + * string.charAt(k + 5)) or (string.charAt(k + 7) and + * string.charAt(k + 8)) or (string.charAt(k + 10) and + * string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError; + * @description: Complex tests, string.charAt(k + 10) and string.charAt(k + 11) + * do not represent hexadecimal digits; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%F0%" + "%A0%A0" + String.fromCharCode(indexJ, indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 10) and string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T1.js new file mode 100644 index 000000000..a0ce645a7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.13_T1; + * @section: 15.1.3.1; + * @assertion: If B = 110xxxxx (n = 2) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T2.js new file mode 100644 index 000000000..5a4351f68 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.13_T2.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.13_T2; + * @section: 15.1.3.1; + * @assertion: If B = 110xxxxx (n = 2) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T1.js new file mode 100644 index 000000000..af76abb08 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.14_T1; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T2.js new file mode 100644 index 000000000..cf51bb7d5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T2.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.14_T2; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T3.js new file mode 100644 index 000000000..244c24a01 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T3.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.14_T3; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T4.js new file mode 100644 index 000000000..8055cc9e1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.14_T4.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.14_T4; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T1.js new file mode 100644 index 000000000..372c355a6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T1; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T2.js new file mode 100644 index 000000000..39e01c2d6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T2.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T2; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T3.js new file mode 100644 index 000000000..3981a593b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T3.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T3; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0x00, 0x7F]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0x00; indexC <= 0x7F; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T4.js new file mode 100644 index 000000000..c918c27f9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T4.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T4; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%" + hexC.substring(2) + "%A0%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T5.js new file mode 100644 index 000000000..0ce7006c2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T5.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T5; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0" + "%" + hexC.substring(2) + "%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T6.js new file mode 100644 index 000000000..0cd966c86 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.15_T6.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.15_T6; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and C != 10xxxxxx (C - first of octets after B), throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], C = [0xC0, 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + var hexB = decimalToHexString(indexB); + var result = true; + for (var indexC = 0xC0; indexC <= 0xFF; indexC++) { + var hexC = decimalToHexString(indexC); + try { + decodeURI("%" + hexB.substring(2) + "%A0%A0" + "%" + hexC.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + } + if (result !== true) { + if (indexO === 0) { + indexO = indexB; + } else { + if ((indexB - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = indexB; + } + } + indexP = indexB; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.1_T1.js new file mode 100644 index 000000000..9b37c99de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.1_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.1_T1; + * @section: 15.1.3.1; + * @assertion: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError; + * @description: Complex tests; +*/ + +var result = true; + +//CHECK#1 +try { + decodeURI("%"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#2 +try { + decodeURI("%A"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#3 +try { + decodeURI("%1"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#4 +try { + decodeURI("% "); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError'); +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T1.js new file mode 100644 index 000000000..f39d45137 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.2_T1; + * @section: 15.1.3.1; + * @assertion: If B = string.charAt(k+1) + string.charAt(k+2) do not represent + * hexadecimal digits, throw URIError; + * @description: Complex tests; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%" + String.fromCharCode(indexJ) + "1"); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k+1) does not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T2.js new file mode 100644 index 000000000..67cbe4b3a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.2_T2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.2_T2; + * @section: 15.1.3.1; + * @assertion: If B = string.charAt(k+1) + string.charAt(k+2) do not represent + * hexadecimal digits, throw URIError; + * @description: Complex tests; +*/ + +//CHECK +var result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (var indexI = 0; indexI < interval.length; indexI++) { + for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURI("%" + "1" + String.fromCharCode(indexJ)); + result = false; + } catch (e) { + if ((e instanceof URIError) !== true) { + result = false; + } + } + } +} + +if (result !== true) { + $ERROR('#1: If string.charAt(k+2) does not represent hexadecimal digits, throw URIError'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T1.js new file mode 100644 index 000000000..d5f247bdd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.3_T1; + * @section: 15.1.3.1; + * @assertion: If B = 10xxxxxx or B = 11111xxx, throw URIError; + * @description: Complex tests. B = 10xxxxxx -> B in [0x80 - 0xBF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0x80; index <= 0xBF; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T2.js new file mode 100644 index 000000000..1c44ab422 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.3_T2.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.3_T2; + * @section: 15.1.3.1; + * @assertion: If B = 10xxxxxx or B = 11111xxx, throw URIError; + * @description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF8; index <= 0xFF; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2)); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.4_T1.js new file mode 100644 index 000000000..bb40def18 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.4_T1.js @@ -0,0 +1,86 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.4_T1; + * @section: 15.1.3.1; + * @assertion: If B = 110xxxxx (n = 2) and (k + 2) + 3 >= length, throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xC0; index <= 0xDF; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 3; len++) { + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.5_T1.js new file mode 100644 index 000000000..5b25ea14b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.5_T1.js @@ -0,0 +1,86 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.5_T1; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and (k + 2) + 6 >= length, throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 6; len++) { + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.6_T1.js new file mode 100644 index 000000000..53f4f5221 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.6_T1.js @@ -0,0 +1,86 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.6_T1; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and (k + 2) + 9 >= length, throw URIError; + * @description: Complex tests. B = [0xF0 - 0xF7]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var str = ""; + var result = true; + for (var len = 0; len < 9; len++) { + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + str); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + result = false; + str = str + "1"; + } + if (result !== true) { + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.7_T1.js new file mode 100644 index 000000000..50020d035 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.7_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.7_T1; + * @section: 15.1.3.1; + * @assertion: If B = 110xxxxx (n = 2) and string.charAt(k + 3) not equal "%", throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF]; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xC0; index <= 0xDF; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "111"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T1.js new file mode 100644 index 000000000..32ab3a51d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T1.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.8_T1; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and string.charAt(k + 3), + * string.charAt(k + 6) not equal "%", throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], + * string.charAt(k + 3) not equal "%"; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "111%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T2.js new file mode 100644 index 000000000..a8c7ff558 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.8_T2.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.8_T2; + * @section: 15.1.3.1; + * @assertion: If B = 1110xxxx (n = 3) and string.charAt(k + 3), + * string.charAt(k + 6) not equal "%", throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF], + * string.charAt(k + 6) not equal "%"; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xE0; index <= 0xEF; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "%A0111"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T1.js new file mode 100644 index 000000000..d47bcbbe7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T1.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.9_T1; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and string.charAt(k + 3), + * string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], + * string.charAt(k + 3) not equal "%"; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "111%A0%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T2.js new file mode 100644 index 000000000..b07f5fafb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T2.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.9_T2; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and string.charAt(k + 3), + * string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], + * string.charAt(k + 6) not equal "%"; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "%A0111%A0"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T3.js new file mode 100644 index 000000000..ad264d95b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A1.9_T3.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A1.9_T3; + * @section: 15.1.3.1; + * @assertion: If B = 11110xxx (n = 4) and string.charAt(k + 3), + * string.charAt(k + 6), string.charAt(k + 9) not equal "%", throw URIError; + * @description: Complex tests. B = [0xF0 - 0x0F7], + * string.charAt(k + 9) not equal "%"; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var index = 0xF0; index <= 0xF7; index++) { + count++; + var hex = decimalToHexString(index); + try { + decodeURI("%" + hex.substring(2) + "%A0%A0111"); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.1_T1.js new file mode 100644 index 000000000..f0eec895e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.1_T1.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A2.1_T1; + * @section: 15.1.3.1; + * @assertion: If string.charAt(k) not equal "%", return this char; + * @description: Complex tests; +*/ + +//CHECK +var errorCount = 0; +var count = 0; +for (var indexI = 0; indexI <= 65535; indexI++) { + if (indexI !== 0x25) { + var hex = decimalToHexString(indexI); + try { + var str = String.fromCharCode(indexI); + if (decodeURI(str) !== str) { + $ERROR('#' + hex + ' '); + errorCount++; + } + } catch (e){ + $ERROR('#' + hex + ' '); + errorCount++; + } + count++; + } +} + +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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.2_T1.js new file mode 100644 index 000000000..acfaad1e1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.2_T1.js @@ -0,0 +1,83 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A2.2_T1; + * @section: 15.1.3.1; + * @assertion: If B1 = 0xxxxxxxx ([0x00 - 0x7F]), without [uriReserved, #], return B1; + * @description: Complex tests, use RFC 3629; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +var uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","]; +l: +for (var indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) { + count++; + var hexB1 = decimalToHexString(indexB1); + var index = indexB1; + try { + var hex = String.fromCharCode(index); + for (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 (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.3_T1.js new file mode 100644 index 000000000..16202503c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.3_T1.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A2.3_T1; + * @section: 15.1.3.1; + * @assertion: If B1 = 110xxxxx ([0xC0 - 0xDF]), B2 = 10xxxxxx ([0x80 - 0xBF), without B1 = [0xC0, 0xC1], return UTF8(B1, B2); + * @description: Complex tests, use RFC 3629; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xC2; indexB1 <= 0xDF; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + count++; + var hexB2 = decimalToHexString(indexB2); + var index = (indexB1 & 0x1F) * 0x40 + (indexB2 & 0x3F); + try { + if (decodeURI("%" + hexB1.substring(2) + "%" + hexB2.substring(2)) === String.fromCharCode(index)) continue; + } catch (e) {} + if (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.4_T1.js new file mode 100644 index 000000000..b2d8d9c0a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.4_T1.js @@ -0,0 +1,85 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A2.4_T1; + * @section: 15.1.3.1; + * @assertion: If B1 = 1110xxxx ([0xE0 - 0xEF]), B2, B3 = 10xxxxxxx ([0x80 - 0xBF]), without [B1, B2] = [0xE0, 0x80 - 0x9F], [0xED, 0xA0 - 0xBF] (0xD800 - 0xDFFF), return UTF8(B1, B2, B3); + * @description: Complex tests, use RFC 3629; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xE0; indexB1 <= 0xEF; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xE0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xED) && (0xA0 <= indexB2)) continue; + var hexB2 = decimalToHexString(indexB2); + for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + count++; + var hexB3 = decimalToHexString(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 (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.5_T1.js new file mode 100644 index 000000000..354f46904 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A2.5_T1.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A2.5_T1; + * @section: 15.1.3.1; + * @assertion: If B1 = 11110xxx ([0xF0 - 0x0F4]), B2, B3, B4 = 10xxxxxxx ([0x80 - 0xBF]), without [B1, B2] = [0xF0, 0x80 - 0x9F], [0xF4, 0x90 - 0xBF], return UTF8(B1, B2, B3, B4); + * @description: Complex tests, use RFC 3629; +*/ + +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; + +for (var indexB1 = 0xF0; indexB1 <= 0xF4; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (var indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xF0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xF4) && (indexB2 >= 0x90)) continue; + var hexB2 = decimalToHexString(indexB2); + for (var indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + var hexB3 = decimalToHexString(indexB3); + for (var indexB4 = 0x80; indexB4 <= 0xBF; indexB4++) { + var hexB4 = decimalToHexString(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 (indexO === 0) { + indexO = index; + } else { + if ((index - indexP) !== 1) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } + else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + indexO = index; + } + } + indexP = index; + errorCount++; + } + } + } +} + +if (errorCount > 0) { + if ((indexP - indexO) !== 0) { + var hexP = decimalToHexString(indexP); + var hexO = decimalToHexString(indexO); + $ERROR('#' + hexO + '-' + hexP + ' '); + } else { + var hexP = decimalToHexString(indexP); + $ERROR('#' + hexP + ' '); + } + $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; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T1.js new file mode 100644 index 000000000..93ecb1df2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T1.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A3_T1; + * @section: 15.1.3.1; + * @assertion: Let reservedURISet be a string containing one instance of each character valid + * in uriReserved plus "#"; + * @description: Checking all character in reservedURISet. HexDigit in [0..9, A..F]; +*/ + +//CHECK#1 +if (decodeURI("%3B") !== "%3B") { + $ERROR('#1: decodeURI("%3B") equal "%3B", not ";"'); +} + +//CHECK#2 +if (decodeURI("%2F") !== "%2F") { + $ERROR('#2: decodeURI("%2F") equal "%2F", not "/"'); +} + +//CHECK#3 +if (decodeURI("%3F") !== "%3F") { + $ERROR('#3: decodeURI("%3F") equal "%3F", not "?"'); +} + +//CHECK#4 +if (decodeURI("%3A") !== "%3A") { + $ERROR('#4: decodeURI("%3A") equal "%3A", not ":"'); +} + +//CHECK#5 +if (decodeURI("%40") !== "%40") { + $ERROR('#5: decodeURI("%40") equal "%40", not "@"'); +} + +//CHECK#6 +if (decodeURI("%26") !== "%26") { + $ERROR('#6: decodeURI("%26") equal "%26", not "&"'); +} + +//CHECK#7 +if (decodeURI("%3D") !== "%3D") { + $ERROR('#7.1: decodeURI("%3D") equal "%3D", not "="'); +} + +//CHECK#8 +if (decodeURI("%2B") !== "%2B") { + $ERROR('#8.1: decodeURI("%2B") equal "%2B", not "+"'); +} + +//CHECK#9 +if (decodeURI("%24") !== "%24") { + $ERROR('#9: decodeURI("%24") equal "%24", not "$"'); +} + +//CHECK#10 +if (decodeURI("%2C") !== "%2C") { + $ERROR('#10: decodeURI("%2C") equal "%2C", not ","'); +} + +//CHECK#11 +if (decodeURI("%23") !== "%23") { + $ERROR('#11: decodeURI("%23") equal "%23", not "#"'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T2.js new file mode 100644 index 000000000..e21acacbe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A3_T2; + * @section: 15.1.3.1; + * @assertion: Let reservedURISet be a string containing one instance of each character valid + * in uriReserved plus "#"; + * @description: Checking all character in reservedURISet. HexDigit in [0..9, a..f]; +*/ + +//CHECK#1 +if (decodeURI("%3b") !== "%3b") { + $ERROR('#1: decodeURI("%3b") equal "%3b", not ";" or "%3B"'); +} + +//CHECK#2 +if (decodeURI("%2f") !== "%2f") { + $ERROR('#2: decodeURI("%2f") equal "%2f", not "/" or "%2F"'); +} + +//CHECK#3 +if (decodeURI("%3f") !== "%3f") { + $ERROR('#3: decodeURI("%3f") equal "%3f", not "?" or "%3F"'); +} + +//CHECK#4 +if (decodeURI("%3a") !== "%3a") { + $ERROR('#4: decodeURI("%3a") equal "%3a", not ":" or "%3A"'); +} + +//CHECK#5 +if (decodeURI("%40") !== "%40") { + $ERROR('#5: decodeURI("%40") equal "%40", not "@"'); +} + +//CHECK#6 +if (decodeURI("%26") !== "%26") { + $ERROR('#6: decodeURI("%26") equal "%26", not "&"'); +} + +//CHECK#7 +if (decodeURI("%3d") !== "%3d") { + $ERROR('#7.1: decodeURI("%3d") equal "%3d", not "=" or "%3D"'); +} + +//CHECK#8 +if (decodeURI("%2b") !== "%2b") { + $ERROR('#8.1: decodeURI("%2b") equal "%2b", not "+" or "%2B"'); +} + +//CHECK#9 +if (decodeURI("%24") !== "%24") { + $ERROR('#9: decodeURI("%24") equal "%24", not "$"'); +} + +//CHECK#10 +if (decodeURI("%2c") !== "%2c") { + $ERROR('#10: decodeURI("%2c") equal "%2c", not "," or "%2C"'); +} + +//CHECK#11 +if (decodeURI("%23") !== "%23") { + $ERROR('#11: decodeURI("%23") equal "%23", not "#"'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T3.js new file mode 100644 index 000000000..7c4f4754a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A3_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A3_T3; + * @section: 15.1.3.1; + * @assertion: Let reservedURISet be a string containing one instance of each character valid + * in uriReserved plus "#"; + * @description: Complex test; +*/ + +//CHECK#1 +if (decodeURI("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") !== "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") { + $ERROR('#1: decodeURI("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") equal "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23", not ";/?:@&=+$,#"'); +} + +//CHECK#2 +if (decodeURI("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") !== "%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") { + $ERROR('#2: decodeURI("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") equal "%3b%2f%3f%3a%40%26%3d%2b%24%2c%23", not ";/?:@&=+$,#" or "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23"'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T1.js new file mode 100644 index 000000000..cf4a6edf0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A4_T1; + * @section: 15.1.3.1; + * @assertion: URI tests; + * @description: Checking ENGLISH ALPHABET; +*/ + +//CHECK#1 +if (decodeURI("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") { + $ERROR('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (decodeURI("%41%42%43%44%45%46%47%48%49%4A%4B%4C%4D%4E%4F%50%51%52%53%54%55%56%57%58%59%5A") !== "ABCDEFGHIJKLMNOPQRSTUVWXYZ") { + $ERROR('#2: ABCDEFGHIJKLMNOPQRSTUVWXYZ'); +} + +//CHECK#3 +if (decodeURI("%61%62%63%64%65%66%67%68%69%6A%6B%6C%6D%6E%6F%70%71%72%73%74%75%76%77%78%79%7A") !== "abcdefghijklmnopqrstuvwxyz") { + $ERROR('#3: abcdefghijklmnopqrstuvwxyz'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T2.js new file mode 100644 index 000000000..4e54f818f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A4_T2; + * @section: 15.1.3.1; + * @assertion: URI tests; + * @description: Checking RUSSIAN ALPHABET; +*/ + +//CHECK#1 +if (decodeURI("http://ru.wikipedia.org/wiki/%d0%ae%D0%bd%D0%B8%D0%BA%D0%BE%D0%B4") !== "http://ru.wikipedia.org/wiki/Юникод") { + $ERROR('#1: http://ru.wikipedia.org/wiki/Юникод'); +} + +//CHECK#2 +if (decodeURI("http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8") !== "http://ru.wikipedia.org/wiki/Юникод#Ссылки") { + $ERROR('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки'); +} + +//CHECK#3 +if (decodeURI("http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%23%D0%92%D0%B5%D1%80%D1%81%D0%B8%D0%B8%20%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%D0%B0") !== "http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода") { + $ERROR('#3: http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T3.js new file mode 100644 index 000000000..2019fdbfd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A4_T3; + * @section: 15.1.3.1; + * @assertion: URI tests; + * @description: Checking URL with Line Terminator; +*/ + +//CHECK#1 +if (decodeURI("http://unipro.ru/%0Aabout") !== "http://unipro.ru/\nabout") { + $ERROR('#1: http://unipro.ru/%A0about'); +} + +//CHECK#2 +if (decodeURI("http://unipro.ru/%0Babout") !== "http://unipro.ru/\vabout") { + $ERROR('#2: http://unipro.ru/%0Babout'); +} + +//CHECK#3 +if (decodeURI("http://unipro.ru/%0Cabout") !== "http://unipro.ru/\fabout") { + $ERROR('#3: http://unipro.ru/%0Cabout'); +} + +//CHECK#4 +if (decodeURI("http://unipro.ru/%0Dabout") !== "http://unipro.ru/\rabout") { + $ERROR('#4: http://unipro.ru/%0Dabout'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T4.js new file mode 100644 index 000000000..4ce97f71b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A4_T4.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A4_T4; + * @section: 15.1.3.1; + * @assertion: URI tests; + * @description: Test some url; +*/ + +//CHECK#1 +if (decodeURI("") !== "") { + $ERROR('#1: ""'); +} + +//CHECK#2 +if (decodeURI("http:%2f%2Funipro.ru") !== "http:%2f%2Funipro.ru") { + $ERROR('#2: http:%2f%2Funipro.ru'); +} + +//CHECK#3 +if (decodeURI("http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") !== "http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") { + $ERROR('#3: http://www.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork"'); +} + +//CHECK%234 +if (decodeURI("http://en.wikipedia.org/wiki/UTF-8%23Description") !== "http://en.wikipedia.org/wiki/UTF-8%23Description") { + $ERROR('%234: http://en.wikipedia.org/wiki/UTF-8%23Description'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.1.js new file mode 100644 index 000000000..51c60350d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A5.1; + * @section: 15.1.3.1, 15.2.4.7, 12.6.4; + * @assertion: The length property of decodeURI has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (decodeURI.propertyIsEnumerable('length') !== false) { + $ERROR('#1: decodeURI.propertyIsEnumerable(\'length\') === false. Actual: ' + (decodeURI.propertyIsEnumerable('length'))); +} + +//CHECK#2 +result = true; +for (p in decodeURI){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in decodeURI) { if (p === "length") result = false; } result === true;'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.2.js new file mode 100644 index 000000000..296f3922c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A5.2; + * @section: 15.1.3.1, 15.2.4.5, 11.4.1; + * @assertion: The length property of decodeURI has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; + * @strict_mode_negative +*/ + +//CHECK#1 +if (decodeURI.hasOwnProperty('length') !== true) { + $FAIL('#1: decodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURI.hasOwnProperty('length'))); +} + +delete decodeURI.length; + +//CHECK#2 +if (decodeURI.hasOwnProperty('length') !== true) { + $ERROR('#2: delete decodeURI.length; decodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURI.hasOwnProperty('length'))); +} + +//CHECK#3 +if (decodeURI.length === undefined) { + $ERROR('#3: delete decodeURI.length; decodeURI.length !== undefined'); +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.3.js new file mode 100644 index 000000000..62b0a8915 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A5.3; + * @section: 15.1.3.1; + * @assertion: The length property of decodeURI has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +var x = decodeURI.length; +decodeURI.length = Infinity; +if (decodeURI.length !== x) { + $ERROR('#1: x = decodeURI.length; decodeURI.length = Infinity; decodeURI.length === x. Actual: ' + (decodeURI.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.4.js new file mode 100644 index 000000000..42096a1ac --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A5.4; + * @section: 15.1.3.1; + * @assertion: The length property of decodeURI is 1; + * @description: decodeURI.length === 1; +*/ + +//CHECK#1 +if (decodeURI.length !== 1) { + $ERROR('#1: decodeURI.length === 1. Actual: ' + (decodeURI.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.5.js new file mode 100644 index 000000000..93cdb038e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A5.5; + * @section: 15.1.3.1, 15.2.4.7, 12.6.4; + * @assertion: The decodeURI property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('decodeURI') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'decodeURI\') === false. Actual: ' + (this.propertyIsEnumerable('decodeURI'))); +} + +//CHECK#2 +result = true; +for (p in this){ + if (p === "decodeURI") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "decodeURI") result = false; } result === true;'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.6.js new file mode 100644 index 000000000..627875f77 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.6.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.1.3.1_A5.6; +* @section: 15.1.3.1; +* @assertion: The decodeURI property has not prototype property; +* @description: Checking decodeURI.prototype; +*/ + +//CHECK#1 +if (decodeURI.prototype !== undefined) { + $ERROR('#1: decodeURI.prototype === undefined. Actual: ' + (decodeURI.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.7.js new file mode 100644 index 000000000..8cc75c1fb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A5.7.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.1.3.1_A5.7; +* @section: 15.1.3.1, 11.2.2; +* @assertion: The decodeURI property can't be used as constructor; +* @description: If property does not implement the internal [[Construct]] method, throw a TypeError exception; +*/ + +//CHECK#1 + +try { + new decodeURI(); + $ERROR('#1.1: new decodeURI() throw TypeError. Actual: ' + (new decodeURI())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new decodeURI() throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A6_T1.js new file mode 100644 index 000000000..4c1278677 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.3_URI_Handling_Function_Properties/15.1.3.1_decodeURI/S15.1.3.1_A6_T1.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.3.1_A6_T1; + * @section: 15.1.3.1, 9.8, 8.6.2.6; + * @assertion: Operator use ToString; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, String); +*/ + +//CHECK#1 +var object = {valueOf: function() {return "%5E"}}; +if (decodeURI(object) !== "[object Object]") { + $ERROR('#1: var object = {valueOf: function() {return "%5E"}}; decodeURI(object) === [object Object]. Actual: ' + (decodeURI(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; +if (decodeURI(object) !== "^") { + $ERROR('#2: var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; +if (decodeURI(object) !== "^") { + $ERROR('#3: var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; + if (decodeURI(object) !== "^") { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURI(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return "%5E"}}; +if (decodeURI(object) !== "^") { + $ERROR('#5: var object = {toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}} +if (decodeURI(object) !== "^") { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}}; decodeURI(object) === "^". Actual: ' + (decodeURI(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; + decodeURI(object); + $ERROR('#7.1: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURI(object) throw "error". Actual: ' + (decodeURI(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURI(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + decodeURI(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURI(object) throw TypeError. Actual: ' + (decodeURI(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURI(object) throw TypeError. Actual: ' + (e)); + } +} |