diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object')
318 files changed, 13936 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A1.js new file mode 100644 index 000000000..adf3c2a7b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.1_A1; + * @section: 15.1.1.1, 11.4.3, 15.1.2.4, 15.1.2.5; + * @assertion: The initial value of NaN is NaN; + * @description: Use typeof, isNaN, isFinite; +*/ + +// CHECK#1 +if (typeof(NaN) !== "number") { + $ERROR('#1: typeof(NaN) === "number". Actual: ' + (typeof(NaN))); +} + +// CHECK#2 +if (isNaN(NaN) !== true) { + $ERROR('#2: NaN === Not-a-Number. Actual: ' + (NaN)); +} + +// CHECK#3 +if (isFinite(NaN) !== false) { + $ERROR('#3: NaN === Not-a-Finite. Actual: ' + (NaN)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T1.js new file mode 100644 index 000000000..b7caaf041 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.1_A2_T1; + * @section: 15.1.1.1, 15.5.1, 15.6.1, 15.7.1; + * @assertion: The NaN is not ReadOnly; + * @description: Checking Boolean, Number, String Functions; + * @strict_mode_negative +*/ + +// CHECK#1 +NaN = 1; +if (Boolean(NaN) !== true) { + $ERROR('#1: NaN = 1; Boolean(NaN) === true. Actual: ' + (Boolean(NaN))); +} + +// CHECK#2 +NaN = true; +if (Number(NaN) !== 1) { + $ERROR('#2: NaN = true; Number(NaN) === 1. Actual: ' + (Number(NaN))); +} + +// CHECK#3 +NaN = 1; +if (String(NaN) !== "1") { + $ERROR('#3: NaN = 1; String(NaN) === "1". Actual: ' + (String(NaN))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T2.js new file mode 100644 index 000000000..098308fca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A2_T2.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.1.1_A2_T2; + * @section: 15.1.1.1, 11.4.3; + * @assertion: The NaN is not ReadOnly; + * @description: Checking typeof Operator; +*/ + +// CHECK#1 +NaN = true; +if (typeof(NaN) !== "boolean") { + $ERROR('#1: NaN = true; typeof(NaN) === "boolean". Actual: ' + (typeof(NaN))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.1.js new file mode 100644 index 000000000..353ca169e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.1_A3.1; + * @section: 15.1.1.1, 11.4.1; + * @assertion: The NaN is DontDelete; + * @description: Use delete; + * @strict_mode_negative + * +*/ + +// CHECK#1 +if (delete NaN !== false) { + $ERROR('#1: delete NaN === false. Actual: ' + (delete NaN)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.2.js new file mode 100644 index 000000000..f8c1547fe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.1_NaN/S15.1.1.1_A3.2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.1_A3.2; + * @section: 15.1.1.1, 12.6.4; + * @assertion: The NaN is DontEnum; + * @description: Use for-in statement; +*/ + +// CHECK#1 +for (var prop in this) { + if (prop === "NaN") { + $ERROR('#1: The NaN is DontEnum'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A1.js new file mode 100644 index 000000000..3d74966c8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A1.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.1.2_A1; + * @section: 15.1.1.2, 11.4.3, 15.1.2.4, 15.1.2.5; + * @assertion: The initial value of Infinity is Number.POSITIVE_INFINITY; + * @description: Use typeof, isNaN, isFinite; +*/ + +// CHECK#1 +if (typeof(Infinity) !== "number") { + $ERROR('#1: typeof(Infinity) === "number". Actual: ' + (typeof(Infinity))); +} + +// CHECK#2 +if (isFinite(Infinity) !== false) { + $ERROR('#2: Infinity === Not-a-Finite. Actual: ' + (Infinity)); +} + +// CHECK#3 +if (isNaN(Infinity) !== false) { + $ERROR('#3: Infinity === Not-a-Number. Actual: ' + (Infinity)); +} + + +// CHECK#4 +if (Infinity !== Number.POSITIVE_INFINITY) { + $ERROR('#4: Infinity === Number.POSITIVE_INFINITY. Actual: ' + (Infinity)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T1.js new file mode 100644 index 000000000..f11b27277 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T1.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.1.2_A2_T1; + * @section: 15.1.1.2, 15.5.1, 15.6.1, 15.7.1; + * @assertion: The Infinity is not ReadOnly; + * @description: Checking Boolean, Number, String Functions; + * @strict_mode_negative +*/ + +// CHECK#1 +Infinity = 0; +if (Boolean(Infinity) !== false) { + $ERROR('#1: Infinity = 0; Boolean(Infinity) === false. Actual: ' + (Boolean(Infinity))); +} + +// CHECK#2 +Infinity = false; +if (Number(Infinity) !== 0) { + $ERROR('#2: Infinity = false; Number(Infinity) === 0. Actual: ' + (Number(Infinity))); +} + +// CHECK#3 +Infinity = 0; +if (String(Infinity) !== "0") { + $ERROR('#3: Infinity = 0; String(Infinity) === "0". Actual: ' + (String(Infinity))); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T2.js new file mode 100644 index 000000000..8a2f32aaa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A2_T2.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.1.2_A2_T2; + * @section: 15.1.1.2, 11.4.3; + * @assertion: The Infinity is not ReadOnly; + * @description: Checking typeof Functions; +*/ + +// CHECK#1 +var Finite = true; +if (typeof(Finite) !== "boolean") { + $ERROR('#1: Finite = true; typeof(NaN) === "boolean". Actual: ' + (typeof(NaN))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.1.js new file mode 100644 index 000000000..995b91294 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.1.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.1.2_A3.1; + * @section: 15.1.1.2, 11.4.1; + * @assertion: The Infinity is DontDelete; + * @description: Use delete; + * @strict_mode_negative +*/ + +// CHECK#1 +if (delete Infinity !== false) { + $ERROR('#1: delete Infinity === false. Actual: ' + (delete Infinity)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.2.js new file mode 100644 index 000000000..bfd920b88 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.2_Infinity/S15.1.1.2_A3.2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.2_A3.2; + * @section: 15.1.1.2, 12.6.4; + * @assertion: The Infinity is DontEnum; + * @description: Use for-in statement; +*/ + +// CHECK#1 +for (var prop in this) { + if (prop === "Infinity") { + $ERROR('#1: The Infinity is DontEnum'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A1.js new file mode 100644 index 000000000..e3dec6a74 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A1.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.1.3_A1; + * @section: 15.1.1.3, 11.4.3, 15.1.2.4, 15.1.2.5; + * @assertion: The initial value of undefined is undefined; + * @description: Use typeof, isNaN, isFinite; +*/ + +// CHECK#1 +if (typeof(undefined) !== "undefined") { + $ERROR('#1: typeof(undefined) === "undefined". Actual: ' + (typeof(undefined))); +} + +// CHECK#2 +if (undefined !== void 0) { + $ERROR('#2: undefined === void 0. Actual: ' + (undefined)); +} + +// CHECK#3 +if (undefined !== eval("var x")) { + $ERROR('#3: undefined === eval("var x"). Actual: ' + (undefined)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T1.js new file mode 100644 index 000000000..4f710448c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.3_A2_T1; + * @section: 15.1.1.3, 15.5.1, 15.6.1, 15.7.1; + * @assertion: The undefined is not ReadOnly; + * @description: Checking Boolean, Number, String Functions; + * @strict_mode_negative +*/ + +// CHECK#1 +undefined = 1; +if (Boolean(undefined) !== true) { + $ERROR('#1: undefined = 1; Boolean(undefined) === true. Actual: ' + (Boolean(undefined))); +} + +// CHECK#2 +undefined = true; +if (Number(undefined) !== 1) { + $ERROR('#2: undefined = true; Number(undefined) === 1. Actual: ' + (Number(undefined))); +} + +// CHECK#3 +undefined = 1; +if (String(undefined) !== "1") { + $ERROR('#3: undefined = 1; String(undefined) === "1". Actual: ' + (String(undefined))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T2.js new file mode 100644 index 000000000..05880d850 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A2_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.3_A2_T2; + * @section: 15.1.1.3, 11.4.3; + * @assertion: The undefined is not ReadOnly; + * @description: Checking typeof Operator; + * @strict_mode_negative +*/ + +// CHECK#1 +undefined = true; +if (typeof(undefined) !== "boolean") { + ERROR('#1: undefined = true; typeof(undefined) === "boolean". Actual: ' + (typeof(undefined))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.1.js new file mode 100644 index 000000000..9a7a3c6cf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.1.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.1.3_A3.1; + * @section: 15.1.1.3, 11.4.1; + * @assertion: The undefined is DontDelete; + * @description: Use delete; + * @strict_mode_negative +*/ + +// CHECK#1 +if (delete undefined !== false) { + $ERROR('#1: delete undefined === false. Actual: ' + (delete undefined)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.2.js new file mode 100644 index 000000000..fcd0d27aa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.1_Value_Properties_of_the_Global_Object/15.1.1.3_undefined/S15.1.1.3_A3.2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.1.3_A3.2; + * @section: 15.1.1.3, 12.6.4; + * @assertion: The undefined is DontEnum; + * @description: Use for-in statement; +*/ + +// CHECK#1 +for (prop in this) { + if (prop === "undefined") { + $ERROR('#1: The undefined is DontEnum'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_T1.js new file mode 100644 index 000000000..35a7870ba --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.1_A1.1_T1; + * @section: 15.1.2.1; + * @assertion: If x is not a string value, return x; + * @description: Checking all primitive; +*/ + +//CHECK#1 +var x = 1; +if (eval(x) !== x) { + $ERROR('#1: x = 1; eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#2 +if (eval(1) !== 1) { + $ERROR('#2: eval(1) === 1. Actual: ' + (eval(1))); +} + +//CHECK#3 +if (eval(true) !== true) { + $ERROR('#3: eval(true) === true. Actual: ' + (eval(true))); +} + +//CHECK#4 +if (eval(null) !== null) { + $ERROR('#4: eval(null) === null. Actual: ' + (eval(null))); +} + +//CHECK#5 +if (eval(undefined) !== undefined) { + $ERROR('#5: eval(undefined) === undefined. Actual: ' + (eval(undefined))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_T2.js new file mode 100644 index 000000000..13c75be57 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.1_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.2.1_A1.1_T2; + * @section: 15.1.2.1; + * @assertion: If x is not a string value, return x; + * @description: Checking all object; +*/ + +//CHECK#1 +var x = {}; +if (eval(x) !== x) { + $ERROR('#1: x = {}; eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#2 +x = new Number(1); +if (eval(x) !== x) { + $ERROR('#2: x = new Number(1); eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#3 +x = new Boolean(true); +if (eval(x) !== x) { + $ERROR('#3: x = new Boolean(true); eval(x) === x. Actual: ' + (eval(x))); +} + +//CHECK#4 +x = new String("1+1"); +if (eval(x) !== x) { + $ERROR('#4: x = new String("1"); eval(x) === x. Actual: ' + (eval(x))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.2_T1.js new file mode 100644 index 000000000..cc30c4b79 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A1.2_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.1_A1.2_T1; + * @section: 15.1.2.1; + * @assertion: If the eval function is called with some argument, then use a first argument; + * @description: eval("x = 1", "x = 2"), x equal 1, not 2; +*/ + +//CHECK#1 +var x; +eval("x = 1", "x = 2"); +if (x !== 1) { + $ERROR('#1: eval("x = 1", "x = 2"); x === 1. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T1.js new file mode 100644 index 000000000..ea6c85e45 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T1.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.2.1_A2_T1; + * @section: 15.1.2.1, 16; + * @assertion: If the parse fails, throw a SyntaxError exception (but see also clause 16); + * @description: Checking if execution of "eval("x = 1; x\u000A++"), catch SyntaxError" passes; +*/ + +//CHECK#1 +var x; +try { + eval("x = 1; x\u000A++"); + $ERROR('#1.1: eval("x = 1; x\\u000A++") must throw a SyntaxError. Actual: ' + (eval("x = 1; x\u000A++"))); +} catch (e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#1.2: eval("x = 1; x\\u000A++") must throw a SyntaxError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T2.js new file mode 100644 index 000000000..839e3b010 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A2_T2.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.2.1_A2_T2; + * @section: 15.1.2.1, 16; + * @assertion: If the parse fails, throw a SyntaxError exception (but see also clause 16); + * @description: Checking if execution of "eval("x = 1; x\u000A++")" fails; + * @negative +*/ + +//CHECK#1 +var x; +eval("x = 1; x\u000A++"); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_T1.js new file mode 100644 index 000000000..33b588ba6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_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.2.1_A3.1_T1; + * @section: 15.1.2.1, 12.4; + * @assertion: If Result(3).type is normal and its completion value is a value V, + * then return the value V; + * @description: Expression statement. Eval return primitive value; +*/ + +var x; +//CHECK#1 +if (eval("x = 1") !== 1) { + $ERROR('#1: eval("x = 1") === 1. Actual: ' + (eval("x = 1"))); +} + +//CHECK#2 +if (eval("1") !== 1) { + $ERROR('#2: eval("1") === 1. Actual: ' + (eval("1"))); +} + +//CHECK#3 +if (eval("'1'") !== '1') { + $ERROR('#3: eval("\'1\'") === \'1\'. Actual: ' + (eval("'1'"))); +} + +//CHECK#4 +x = 1; +if (eval("++x") !== 2) { + $ERROR('#4: x = 1; eval("++x") === 2. Actual: ' + (x)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_T2.js new file mode 100644 index 000000000..d98a0086a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.1_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.2.1_A3.1_T2; + * @section: 15.1.2.1, 12.4; + * @assertion: If Result(3).type is normal and its completion value is a value V, + * then return the value V; + * @description: Expression statement. Eval return object value; +*/ + +//CHECK#1 +var x = {}; +var y; +if (eval("y = x") !== x) { + $ERROR('#1: var x = {}; eval("y = x") === x. Actual: ' + (eval("y = x"))); +} + + +//CHECK#2 +if (eval("x") !== x) { + $ERROR('#2: var x = {}; eval("x") === x. Actual: ' + (eval("x"))); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T1.js new file mode 100644 index 000000000..8bff8c954 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T1.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.2.1_A3.2_T1; + * @section: 15.1.2.1, 12.1; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: Block statement; +*/ + +//CHECK#1 +if (eval("{}") !== undefined) { + $ERROR('#1: eval("{}") === undefined. Actual: ' + (eval("{}"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T2.js new file mode 100644 index 000000000..78af4be93 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T2.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.2.1_A3.2_T2; + * @section: 15.1.2.1, 12.2; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: Var statement; +*/ + +//CHECK#1 +if (eval("var x = 1") !== undefined) { + $ERROR('#1: eval("var x = 1") === undefined. Actual: ' + (eval("var x = 1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T3.js new file mode 100644 index 000000000..2fa8c3f8d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T3.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.2.1_A3.2_T3; + * @section: 15.1.2.1, 12.3; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: Empty statement; +*/ + +//CHECK#1 +if (eval(";") !== undefined) { + $ERROR('#1: eval(";") === undefined. Actual: ' + (eval(";"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T4.js new file mode 100644 index 000000000..46470bb10 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T4.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.2.1_A3.2_T4; + * @section: 15.1.2.1, 12.5; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: If statement; +*/ + +//CHECK#1 +if (eval("if (false) ;") !== undefined) { + $ERROR('#1: eval("if (false) ;") === undefined. Actual: ' + eval("if (false) ;")); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T5.js new file mode 100644 index 000000000..ae9ea4e98 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T5.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.2.1_A3.2_T5; + * @section: 15.1.2.1, 12.11; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: Switch statement; +*/ + +//CHECK#1 +if (eval("switch(1){}") !== undefined) { + $ERROR('#1: eval("switch(1){}") === undefined. Actual: ' + (eval("switch(1){}"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T6.js new file mode 100644 index 000000000..9e52de151 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T6.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.2.1_A3.2_T6; + * @section: 15.1.2.1, 12.6.1; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: do-while statement; +*/ + +//CHECK#1 +if (eval("do ; while(false)") !== undefined) { + $ERROR('#1: eval("do ; while(false)") === undefined. Actual: ' + (eval("do ; while(false)"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T7.js new file mode 100644 index 000000000..421e265fb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T7.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.2.1_A3.2_T7; + * @section: 15.1.2.1, 12.6.2; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: do-while statement; +*/ + +//CHECK#1 +if (eval("while(false);") !== undefined) { + $ERROR('#1: eval("while(false);") === undefined. Actual: ' + (eval("while(false);"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T8.js new file mode 100644 index 000000000..19bdbfe78 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.2_T8.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.2.1_A3.2_T8; + * @section: 15.1.2.1, 12.6.3; + * @assertion: If Result(3).type is normal and its completion value is empty, + * then return the value undefined; + * @description: for statement; +*/ + +//CHECK#1 +if (eval("for(false;false;false);") !== undefined) { + $ERROR('#1: eval("for(false;false;false);") === undefined. Actual: ' + (eval("for(false;false;false);"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T1.js new file mode 100644 index 000000000..f5affb3af --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.1_A3.3_T1; + * @section: 15.1.2.1, 12.7; + * @assertion: If Result(3).type is not normal, then Result(3).type must be throw. + * Throw Result(3).value as an exception; + * @description: Continue statement; +*/ + +//CHECK#1 +try { + eval("continue;"); + $ERROR('#1.1: continue must throw SyntaxError. Actual: ' + (eval("continue;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#1.2: continue must throw SyntaxError. Actual ' + (e)); + } +} + +//CHECK#2 +try { + for (var i = 0; i <= 1; i++) { + for (var j = 0; j <= 1; j++) { + eval("continue;"); + } + } + $ERROR('#2.1: continue must throw SyntaxError. Actual: ' + (eval("continue;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#2.2: continue must throw SyntaxError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T2.js new file mode 100644 index 000000000..f66ea4002 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.1_A3.3_T2; + * @section: 15.1.2.1, 12.8; + * @assertion: If Result(3).type is not normal, then Result(3).type must be throw. + * Throw Result(3).value as an exception; + * @description: Break statement; +*/ + +//CHECK#1 +try { + eval("break;"); + $ERROR('#1.1: break must throw SyntaxError. Actual: ' + (eval("break;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#1.2: break must throw SyntaxError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + for (var i = 0; i <= 1; i++) { + for (var j = 0; j <= 1; j++) { + eval("break;"); + } + } + $ERROR('#2.1: break must throw SyntaxError. Actual: ' + (eval("break;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#2.2: break must throw SyntaxError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T3.js new file mode 100644 index 000000000..5ee0bedd0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_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.2.1_A3.3_T3; + * @section: 15.1.2.1, 12.9; + * @assertion: If Result(3).type is not normal, then Result(3).type must be throw. + * Throw Result(3).value as an exception; + * @description: Return statement; +*/ + +//CHECK#1 +try { + eval("return;"); + $ERROR('#1.1: return must throw SyntaxError. Actual: ' + (eval("return;"))); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#1.2: return must throw SyntaxError. Actual: ' + (e)); + } +} + +//CHECK#2 + +function f() { eval("return;"); }; + +try { + f(); + $ERROR('#2.1: return must throw SyntaxError. Actual: ' + (f())); +} catch(e) { + if ((e instanceof SyntaxError) !== true) { + $ERROR('#2.2: return must throw SyntaxError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T4.js new file mode 100644 index 000000000..e1db69a52 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A3.3_T4.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.2.1_A3.3_T4; + * @section: 15.1.2.1, 12.13; + * @assertion: If Result(3).type is not normal, then Result(3).type must be throw. + * Throw Result(3).value as an exception; + * @description: Throw statement; +*/ + +//CHECK#1 +try { + eval("throw 1;"); + $ERROR('#1.1: throw 1 must throw SyntaxError. Actual: ' + (eval("throw 1;"))); +} catch(e) { + if (e !== 1) { + $ERROR('#1.2: throw 1 must throw SyntaxError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.1.js new file mode 100644 index 000000000..2d5dad470 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.1; + * @section: 15.1.2.1, 15.2.4.7, 12.6.4; + * @assertion: The length property of eval has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (eval.propertyIsEnumerable('length') !== false) { + $ERROR('#1: eval.propertyIsEnumerable(\'length\') === false. Actual: ' + (eval.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (p in eval){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in eval) { 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.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.2.js new file mode 100644 index 000000000..f1782f015 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.2.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.2.1_A4.2; + * @section: 15.1.2.1, 15.2.4.5, 11.4.1; + * @assertion: The length property of eval has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; +*/ + +//CHECK#1 +if (eval.hasOwnProperty('length') !== true) { + $FAIL('#1: eval.hasOwnProperty(\'length\') === true. Actual: ' + (eval.hasOwnProperty('length'))); +} + +delete eval.length; + +//CHECK#2 +if (eval.hasOwnProperty('length') !== true) { + $ERROR('#2: delete eval.length; eval.hasOwnProperty(\'length\') === true. Actual: ' + (eval.hasOwnProperty('length'))); +} + +//CHECK#3 +if (eval.length === undefined) { + $ERROR('#3: delete eval.length; eval.length !== undefined'); +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.3.js new file mode 100644 index 000000000..1668ed29c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.3; + * @section: 15.1.2.1; + * @assertion: The length property of eval has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +var x = eval.length; +eval.length = Infinity; +if (eval.length !== x) { + $ERROR('#1: x = eval.length; eval.length = Infinity; eval.length === x. Actual: ' + (eval.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.4.js new file mode 100644 index 000000000..74c6ac526 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.4; + * @section: 15.1.2.1; + * @assertion: The length property of eval is 1; + * @description: eval.length === 1; +*/ + +//CHECK#1 +if (eval.length !== 1) { + $ERROR('#1: eval.length === 1. Actual: ' + (eval.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.5.js new file mode 100644 index 000000000..fd55a100c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.5; + * @section: 15.1.2.1, 15.2.4.7, 12.6.4; + * @assertion: The eval property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('eval') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'eval\') === false. Actual: ' + (this.propertyIsEnumerable('eval'))); +} + +//CHECK#2 +var result = true; +for (var p in this){ + if (p === "eval") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "eval") 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.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.6.js new file mode 100644 index 000000000..6ba1e2a5c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.6; +* @section: 15.1.2.1; +* @assertion: The eval property has not prototype property; +* @description: Checking eval.prototype; +*/ + +//CHECK#1 +if (eval.prototype !== undefined) { + $ERROR('#1: eval.prototype === undefined. Actual: ' + (eval.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.7.js new file mode 100644 index 000000000..c82ebd710 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.1_eval/S15.1.2.1_A4.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.2.1_A4.7; +* @section: 15.1.2.1, 11.2.2; +* @assertion: The eval 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 eval(); + $ERROR('#1.1: new eval() throw TypeError. Actual: ' + (new eval())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new eval() 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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T1.js new file mode 100644 index 000000000..6f07f553d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A1_T1; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for boolean primitive; +*/ + +//CHECK#1 +if (!(isNaN(parseInt(true)) && isNaN(parseInt("NaN")))) { + $ERROR('#1: parseInt(true) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); +} + +//CHECK#2 +if (String(parseInt(false)) !== "NaN") { + $ERROR('#2: String(parseInt(false)) === "NaN". Actual: ' + (String(parseInt(false)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T2.js new file mode 100644 index 000000000..781d3b055 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_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.2.2_A1_T2; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for number primitive; +*/ + +//CHECK#1 +if (parseInt(-1) !== parseInt("-1")) { + $ERROR('#1: parseInt(-1) === parseInt("-1"). Actual: ' + (parseInt(-1))); +} + +//CHECK#2 +if (String(parseInt(Infinity)) !== "NaN") { + $ERROR('#2: String(parseInt(Infinity)) === "NaN". Actual: ' + (String(parseInt(Infinity)))); +} + +//CHECK#3 +if (String(parseInt(NaN)) !== "NaN") { + $ERROR('#3: String(parseInt(NaN)) === "NaN". Actual: ' + (String(parseInt(NaN)))); +} + +//CHECK#4 +if (parseInt(-0) !== 0) { + $ERROR('#4: parseInt(-0) === 0. Actual: ' + (parseInt(-0))); +} else { + if (1 / parseInt(-0) !== Number.POSITIVE_INFINITY) { + $ERROR('#4: parseInt(-0) === +0. Actual: ' + (parseInt(-0))); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T3.js new file mode 100644 index 000000000..25a3334dd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_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.2.2_A1_T3; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for undefined and null; +*/ + +//CHECK#1 +if (!(isNaN(parseInt(undefined)) && isNaN(parseInt("NaN")))) { + $ERROR('#1: parseInt(undefined) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); +} + +//CHECK#2 +if (!(isNaN(parseInt(null)) && isNaN(parseInt("NaN")))) { + $ERROR('#2: parseInt(null) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); +} + +//CHECK#3 +if (String(parseInt(undefined)) !== "NaN") { + $ERROR('#3: String(parseInt(undefined)) === "NaN". Actual: ' + (String(parseInt(undefined)))); +} + +//CHECK#4 +if (String(parseInt(null)) !== "NaN") { + $ERROR('#4: String(parseInt(null)) === "NaN". Actual: ' + (String(parseInt(null)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T4.js new file mode 100644 index 000000000..eb95903f2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A1_T4; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for Boolean object; +*/ + +//CHECK#1 +if (!(isNaN(parseInt(new Boolean(true))) && isNaN(parseInt("NaN")))) { + $ERROR('#1: parseInt(new Boolean(true)) === Not-a-Number; parseInt("NaN") === Not-a-Number. Actual: ' + (parseInt("NaN"))); +} + +//CHECK#2 +if (String(parseInt(new Boolean(false))) !== "NaN") { + $ERROR('#2: String(parseInt(new Boolean(false))) === "NaN". Actual: ' + (String(parseInt(new Boolean(false))))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T5.js new file mode 100644 index 000000000..42d3c4349 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T5.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.2.2_A1_T5; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for Number object; +*/ + +//CHECK#1 +if (parseInt(new Number(-1)) !== parseInt("-1")) { + $ERROR('#1: parseInt(new Number(-1)) === parseInt("-1"). Actual: ' + (parseInt(new Number(-1)))); +} + +//CHECK#2 +if (String(parseInt(new Number(Infinity))) !== "NaN") { + $ERROR('#2: String(parseInt(new Number(Infinity))) === "NaN". Actual: ' + (String(parseInt(new Number(Infinity))))); +} + +//CHECK#3 +if (String(parseInt(new Number(NaN))) !== "NaN") { + $ERROR('#3: String(parseInt(new Number(NaN))) === "NaN". Actual: ' + (String(parseInt(new Number(NaN))))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T6.js new file mode 100644 index 000000000..733dd48dd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T6.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.2.2_A1_T6; + * @section: 15.1.2.2, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for String object; +*/ + +//CHECK#1 +if (parseInt(new String("-1")) !== parseInt("-1")) { + $ERROR('#1: parseInt(new String("-1")) === parseInt("-1"). Actual: ' + (parseInt(new String("-1")))); +} + +//CHECK#2 +if (String(parseInt(new String("Infinity"))) !== "NaN") { + $ERROR('#2: String(parseInt(new String("Infinity"))) === "NaN". Actual: ' + (String(parseInt(new String("Infinity"))))); +} + +//CHECK#3 +if (String(parseInt(new String("NaN"))) !== "NaN") { + $ERROR('#3: String(parseInt(new String("NaN"))) === "NaN". Actual: ' + (String(parseInt(new String("NaN"))))); +} + +//CHECK#4 +if (String(parseInt(new String("false"))) !== "NaN") { + $ERROR('#4: String(parseInt(new String("false"))) === "NaN". Actual: ' + (String(parseInt(new String("false"))))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T7.js new file mode 100644 index 000000000..f57b22ee1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A1_T7.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.2.2_A1_T7; + * @section: 15.1.2.2, 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 1}}; +if (isNaN(parseInt(object)) !== true) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; parseInt(object) === Not-a-Number. Actual: ' + (parseInt(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (parseInt(object) !== 0) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; parseInt(object) === 0. Actual: ' + (parseInt(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (parseInt(object) !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; parseInt(object) === 1. Actual: ' + (parseInt(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + if (parseInt(object) !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseInt(object) === 1. Actual: ' + (parseInt(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseInt(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseInt(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (parseInt(object) !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; parseInt(object) === 1. Actual: ' + (parseInt(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (parseInt(object) !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; parseInt(object) === 1. Actual: ' + (parseInt(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + parseInt(object); + $ERROR('#7.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseInt(object) throw "error". Actual: ' + (parseInt(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseInt(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + parseInt(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseInt(object) throw TypeError. Actual: ' + (parseInt(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseInt(object) 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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T1.js new file mode 100644 index 000000000..3ca83f46a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A2_T1; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: TAB (U+0009); +*/ + +//CHECK#1 +if (parseInt("\u00091") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u00091") === parseInt("1"). Actual: ' + (parseInt("\u00091"))); +} + +//CHECK#2 +if (parseInt("\u0009\u0009-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u0009\\u0009-1") === parseInt("-1"). Actual: ' + (parseInt("\u0009\u0009-1"))); +} + +//CHECK#3 +if (parseInt(" 1") !== parseInt("1")) { + $ERROR('#3: parseInt(" 1") === parseInt("1"). Actual: ' + (parseInt(" 1"))); +} + +//CHECK#4 +if (parseInt(" 1") !== parseInt("1")) { + $ERROR('#4: parseInt(" 1") === parseInt("1"). Actual: ' + (parseInt(" 1"))); +} + +//CHECK#5 +if (parseInt(" \u0009 \u0009-1") !== parseInt("-1")) { + $ERROR('#5: parseInt(" \\u0009 \\u0009-1") === parseInt("-1"). Actual: ' + (parseInt(" \u0009 \u0009-1"))); +} + +//CHECK#6 +if (isNaN(parseInt("\u0009")) !== true) { + $ERROR('#6: parseInt("\\u0009") === Not-a-Number. Actual: ' + (parseInt("\u0009"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T10.js new file mode 100644 index 000000000..e87c6d8d8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T10.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A2_T10; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: USP; +*/ + +//CHECK# +var count = 0; +var errorCount = 0; +var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"]; +var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"]; + +for (var index = 0; index < uspU.length; index++) { + var result = true; + if (parseInt(uspU[index] + "1") !== parseInt("1")) { + $ERROR('#1.' + uspS[index] + ' '); + result = false; + } + if (parseInt(uspU[index] + uspU[index] + uspU[index] + "1") !== parseInt("1")) { + $ERROR('#2.' + uspS[index] + ' '); + result = false; + } + if (isNaN(parseInt(uspU[index])) !== true) { + $ERROR('#3.' + uspS[index] + ' '); + result = false; + } + if (result !== true) { + errorCount++; + } + count++; +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T2.js new file mode 100644 index 000000000..eed95977b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A2_T2; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: SP (U+0020); +*/ + +//CHECK#1 +if (parseInt("\u00201") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u00201") === parseInt("1"). Actual: ' + (parseInt("\u00201"))); +} + +//CHECK#2 +if (parseInt("\u0020\u0020-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u0020\\u0020-1") === parseInt("-1"). Actual: ' + (parseInt("\u0020\u0020-1"))); +} + +//CHECK#3 +if (parseInt(" 1") !== parseInt("1")) { + $ERROR('#3: parseInt(" 1") === parseInt("1"). Actual: ' + (parseInt(" 1"))); +} + +//CHECK#4 +if (parseInt(" 1") !== parseInt("1")) { + $ERROR('#4: parseInt(" 1") === parseInt("1"). Actual: ' + (parseInt(" 1"))); +} + +//CHECK#5 +if (parseInt(" \u0020 \u0020-1") !== parseInt("-1")) { + $ERROR('#5: parseInt(" \\u0020 \\u0020-1") === parseInt("-1"). Actual: ' + (parseInt(" \u0020 \u0020-1"))); +} + +//CHECK#6 +if (isNaN(parseInt("\u0020")) !== true) { + $ERROR('#6: parseInt("\\u0020") === Not-a-Number. Actual: ' + (parseInt("\u0020"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T3.js new file mode 100644 index 000000000..7d454d0b5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T3.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.2.2_A2_T3; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: NBSB (U+00A0); +*/ + +//CHECK#1 +if (parseInt("\u00A01") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u00A01") === parseInt("1"). Actual: ' + (parseInt("\u00A01"))); +} + +//CHECK#2 +if (parseInt("\u00A0\u00A0-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u00A0\\u00A0-1") === parseInt("-1"). Actual: ' + (parseInt("\u00A0\u00A0-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u00A0")) !== true) { + $ERROR('#3: parseInt("\\u00A0") === Not-a-Number. Actual: ' + (parseInt("\u00A0"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T4.js new file mode 100644 index 000000000..eee47779d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T4.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.2.2_A2_T4; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: FF (U+000C); +*/ + +//CHECK#1 +if (parseInt("\u000C1") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u000C1") === parseInt("1"). Actual: ' + (parseInt("\u000C1"))); +} + +//CHECK#2 +if (parseInt("\u000C\u000C-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u000C\\u000C-1") === parseInt("-1"). Actual: ' + (parseInt("\u000C\u000C-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u000C")) !== true) { + $ERROR('#3: parseInt("\\u000C") === Not-a-Number. Actual: ' + (parseInt("\u000C"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T5.js new file mode 100644 index 000000000..0c91ec8d8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T5.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.2.2_A2_T5; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: VT (U+000B); +*/ + +//CHECK#1 +if (parseInt("\u000B1") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u000B1") === parseInt("1"). Actual: ' + (parseInt("\u000B1"))); +} + +//CHECK#2 +if (parseInt("\u000B\u000B-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u000B\\u000B-1") === parseInt("-1"). Actual: ' + (parseInt("\u000B\u000B-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u000B")) !== true) { + $ERROR('#3: parseInt("\\u000B") === Not-a-Number. Actual: ' + (parseInt("\u000B"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T6.js new file mode 100644 index 000000000..c5b51a76d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T6.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.2.2_A2_T6; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: CR (U+000D); +*/ + +//CHECK#1 +if (parseInt("\u000D1") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u000D1") === parseInt("1"). Actual: ' + (parseInt("\u000D1"))); +} + +//CHECK#2 +if (parseInt("\u000D\u000D-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u000D\\u000D-1") === parseInt("-1"). Actual: ' + (parseInt("\u000D\u000D-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u000D")) !== true) { + $ERROR('#3: parseInt("\\u000D") === Not-a-Number. Actual: ' + (parseInt("\u000D"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T7.js new file mode 100644 index 000000000..bdc17a25a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T7.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.2.2_A2_T7; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: LF (U+000A); +*/ + +//CHECK#1 +if (parseInt("\u000A1") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u000A1") === parseInt("1"). Actual: ' + (parseInt("\u000A1"))); +} + +//CHECK#2 +if (parseInt("\u000A\u000A-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u000A\\u000A-1") === parseInt("-1"). Actual: ' + (parseInt("\u000A\u000A-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u000A")) !== true) { + $ERROR('#3: parseInt("\\u000A") === Not-a-Number. Actual: ' + (parseInt("\u000A"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T8.js new file mode 100644 index 000000000..670b39a5f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T8.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.2.2_A2_T8; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: LS (U+2028); +*/ + +//CHECK#1 +if (parseInt("\u20281") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u20281") === parseInt("1"). Actual: ' + (parseInt("\u20281"))); +} + +//CHECK#2 +if (parseInt("\u2028\u2028-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u2028\\u2028-1") === parseInt("-1"). Actual: ' + (parseInt("\u2028\u2028-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u2028")) !== true) { + $ERROR('#3: parseInt("\\u2028") === Not-a-Number. Actual: ' + (parseInt("\u2028"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T9.js new file mode 100644 index 000000000..fa285aabe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A2_T9.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.2.2_A2_T9; + * @section: 15.1.2.2; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: PS (U+2029); +*/ + +//CHECK#1 +if (parseInt("\u20291") !== parseInt("1")) { + $ERROR('#1: parseInt("\\u20291") === parseInt("1"). Actual: ' + (parseInt("\u20291"))); +} + +//CHECK#2 +if (parseInt("\u2029\u2029-1") !== parseInt("-1")) { + $ERROR('#2: parseInt("\\u2029\\u2029-1") === parseInt("-1"). Actual: ' + (parseInt("\u2029\u2029-1"))); +} + +//CHECK#3 +if (isNaN(parseInt("\u2029")) !== true) { + $ERROR('#3: parseInt("\\u2029") === Not-a-Number. Actual: ' + (parseInt("\u2029"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T1.js new file mode 100644 index 000000000..58450dd5b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T1; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for boolean primitive; +*/ + +//CHECK#1 +if (parseInt("11", false) !== parseInt("11", 10)) { + $ERROR('#1: parseInt("11", false) === parseInt("11", 10). Actual: ' + (parseInt("11", false))); +} + +//CHECK#2 +if (isNaN(parseInt("11", true)) !== true) { + $ERROR('#2: parseInt("11", true) === Not-a-Number. Actual: ' + (parseInt("11", true))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T2.js new file mode 100644 index 000000000..4364a12ca --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T2; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for string primitive; +*/ + +//CHECK#1 +if (parseInt("11", "2") !== parseInt("11", 2)) { + $ERROR('#1: parseInt("11", "2") === parseInt("11", 2). Actual: ' + (parseInt("11", "2"))); +} + +//CHECK#2 +if (parseInt("11", "0") !== parseInt("11", 10)) { + $ERROR('#2: parseInt("11", "0") === parseInt("11", 10). Actual: ' + (parseInt("11", "0"))); +} + +//CHECK#3 +if (parseInt("11", "") !== parseInt("11", 10)) { + $ERROR('#3: parseInt("11", "") === parseInt("11", 10). Actual: ' + (parseInt("11", ""))); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T3.js new file mode 100644 index 000000000..7c6e15af2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T3; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for undefined and null; +*/ + +//CHECK#1 +if (parseInt("11", undefined) !== parseInt("11", 10)) { + $ERROR('#1: parseInt("11", undefined) === parseInt("11", 10). Actual: ' + (parseInt("11", undefined))); +} + +//CHECK#2 +if (parseInt("11", null) !== parseInt("11", 10)) { + $ERROR('#2: parseInt("11", null) === parseInt("11", 10). Actual: ' + (parseInt("11", null))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T4.js new file mode 100644 index 000000000..be3801661 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T4; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for Boolean object; +*/ + +//CHECK#1 +if (parseInt("11", new Boolean(false)) !== parseInt("11", false)) { + $ERROR('#1: parseInt("11", new Boolean(false)) === parseInt("11", false). Actual: ' + (parseInt("11", new Boolean(false)))); +} + +//CHECK#2 +if (isNaN(parseInt("11", new Boolean(true))) !== true) { + $ERROR('#2: parseInt("11", new Boolean(true)) === Not-a-Number. Actual: ' + (parseInt("11", new Boolean(true)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T5.js new file mode 100644 index 000000000..818eecc1a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T5; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for Number object; +*/ + +//CHECK#1 +if (parseInt("11", new Number(2)) !== parseInt("11", 2)) { + $ERROR('#1: parseInt("11", new Number(2)) === parseInt("11", 2). Actual: ' + (parseInt("11", new Number(2)))); +} + +//CHECK#2 +if (parseInt("11", new Number(Infinity)) !== parseInt("11", Infinity)) { + $ERROR('#2: parseInt("11", new Number(Infinity)) === parseInt("11", Infinity). Actual: ' + (parseInt("11", new Number(Infinity)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T6.js new file mode 100644 index 000000000..4886116f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T6.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.1_T6; + * @section: 15.1.2.2, 9.3; + * @assertion: Operator use ToNumber; + * @description: Checking for String object; +*/ + +//CHECK#1 +if (parseInt("11", new String("2")) !== parseInt("11", 2)) { + $ERROR('#1: parseInt("11", new String("2")) === parseInt("11", 2). Actual: ' + (parseInt("11", new String("2")))); +} + +//CHECK#2 +if (parseInt("11", new String("Infinity")) !== parseInt("11", Infinity)) { + $ERROR('#2: parseInt("11", new String("Infinity")) === parseInt("11", Infinity). Actual: ' + (parseInt("11", new String("Infinity")))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T7.js new file mode 100644 index 000000000..1fe067f49 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.1_T7.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.2.2_A3.1_T7; + * @section: 15.1.2.2, 9.3, 8.6.2.6; + * @assertion: Operator use ToNumber; + * @description: If Type(value) is Object, evaluate ToPrimitive(value, Number); +*/ + +//CHECK#1 +var object = {valueOf: function() {return 2}}; +if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#1: var object = {valueOf: function() {return 2}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); +} + +//CHECK#2 +var object = {valueOf: function() {return 2}, toString: function() {return 1}}; +if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#2: var object = {valueOf: function() {return 2}, toString: function() {return 1}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); +} + +//CHECK#3 +var object = {valueOf: function() {return 2}, toString: function() {return {}}}; +if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#3: var object = {valueOf: function() {return 2}, toString: function() {return {}}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 2}, toString: function() {throw "error"}}; + if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#4.1: var object = {valueOf: function() {return 2}, toString: function() {throw "error"}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 2}, toString: function() {throw "error"}}; parseInt("11", object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 2}, toString: function() {throw "error"}}; parseInt("11", object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 2}}; +if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#5: var object = {toString: function() {return 2}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 2}} +if (parseInt("11", object) !== parseInt("11", 2)) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 2}}; parseInt("11", object) === parseInt("11", 2). Actual: ' + (parseInt("11", object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 2}}; + parseInt("11", object); + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 2}}; parseInt("11", object) throw "error". Actual: ' + (parseInt("11", object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 2}}; parseInt("11", object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + parseInt("11", object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseInt("11", object) throw TypeError. Actual: ' + (parseInt("11", object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseInt("11", object) 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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T1.js new file mode 100644 index 000000000..34fab3c5a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.2_T1; + * @section: 15.1.2.2; + * @assertion: Operator use ToInt32; + * @description: If radix is NaN, +0, -0, +Infinity, -Infinity, return radix = +0; +*/ + +//CHECK#1 +if (parseInt("11", NaN) !== parseInt("11", 10)) { + $ERROR('#1: parseInt("11", NaN) === parseInt("11", 10). Actual: ' + (parseInt("11", NaN))); +} + +//CHECK#2 +if (parseInt("11", +0) !== parseInt("11", 10)) { + $ERROR('#2: parseInt("11", +0) === parseInt("11", 10). Actual: ' + (parseInt("11", +0))); +} + +//CHECK#3 +if (parseInt("11", -0) !== parseInt("11", 10)) { + $ERROR('#3: parseInt("11", -0) === parseInt("11", 10). Actual: ' + (parseInt("11", -0))); +} + +//CHECK#4 +if (parseInt("11", Number.POSITIVE_INFINITY) !== parseInt("11", 10)) { + $ERROR('#4: parseInt("11", Number.POSITIVE_INFINITY) === parseInt("11", 10). Actual: ' + (parseInt("11", Number.POSITIVE_INFINITY))); +} + +//CHECK#5 +if (parseInt("11", Number.NEGATIVE_INFINITY) !== parseInt("11", 10)) { + $ERROR('#5: parseInt("11", Number.NEGATIVE_INFINITY) === parseInt("11", 10). Actual: ' + (parseInt("11", Number.NEGATIVE_INFINITY))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T2.js new file mode 100644 index 000000000..c3e33816d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A3.2_T2; + * @section: 15.1.2.2; + * @assertion: Operator use ToInt32; + * @description: ToInt32 use floor; +*/ + +//CHECK#1 +if (parseInt("11", 2.1) !== parseInt("11", 2)) { + $ERROR('#1: parseInt("11", 2.1) === parseInt("11", 2). Actual: ' + (parseInt("11", 2.1))); +} + +//CHECK#2 +if (parseInt("11", 2.5) !== parseInt("11", 2)) { + $ERROR('#2: parseInt("11", 2.5) === parseInt("11", 2). Actual: ' + (parseInt("11", 2.5))); +} + +//CHECK#3 +if (parseInt("11", 2.9) !== parseInt("11", 2)) { + $ERROR('#3: parseInt("11", 2.9) === parseInt("11", 2). Actual: ' + (parseInt("11", 2.9))); +} + +//CHECK#4 +if (parseInt("11", 2.000000000001) !== parseInt("11", 2)) { + $ERROR('#4: parseInt("11", 2.000000000001) === parseInt("11", 2). Actual: ' + (parseInt("11", 2.000000000001))); +} + +//CHECK#5 +if (parseInt("11", 2.999999999999) !== parseInt("11", 2)) { + $ERROR('#5: parseInt("11", 2.999999999999) === parseInt("11", 2). Actual: ' + (parseInt("11", 2.999999999999))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_T3.js new file mode 100644 index 000000000..59ddad564 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A3.2_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.2.2_A3.2_T3; + * @section: 15.1.2.2; + * @assertion: Operator use ToInt32; + * @description: ToInt32 use modulo; +*/ + +//CHECK#1 +if (parseInt("11", 4294967298) !== parseInt("11", 2)) { + $ERROR('#1: parseInt("11", 4294967298) === parseInt("11", 2). Actual: ' + (parseInt("11", 4294967298))); +} + +//CHECK#2 +if (parseInt("11", 4294967296) !== parseInt("11", 10)) { + $ERROR('#2: parseInt("11", 4294967296) === parseInt("11", 10). Actual: ' + (parseInt("11", 4294967296))); +} + +//CHECK#3 +if (isNaN(parseInt("11", -2147483650)) !== true) { + $ERROR('#3: parseInt("11", 2147483650) === Not-a-Number. Actual: ' + (parseInt("11", 2147483650))); +} + +//CHECK#4 +if (parseInt("11", -4294967294) !== parseInt("11", 2)) { + $ERROR('#4: parseInt("11", -4294967294) === parseInt("11", 2). Actual: ' + (parseInt("11", -4294967294))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T1.js new file mode 100644 index 000000000..cc43895d3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T1.js @@ -0,0 +1,74 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A4.1_T1; + * @section: 15.1.2.2; + * @assertion: If R = 0 or R = undefined, then R = 10; + * @description: R = 0; +*/ + +//CHECK#0 +if (parseInt("0", 0) !== parseInt("0", 10)) { + $ERROR('#0: parseInt("0", 0) === parseInt("0", 10). Actual: ' + (parseInt("0", 0))); +} + +//CHECK#1 +if (parseInt("1", 0) !== parseInt("1", 10)) { + $ERROR('#1: parseInt("1", 0) === parseInt("01", 10). Actual: ' + (parseInt("1", 0))); +} + +//CHECK#2 +if (parseInt("2", 0) !== parseInt("2", 10)) { + $ERROR('#2: parseInt("2", 0) === parseInt("2", 10). Actual: ' + (parseInt("2", 0))); +} + +//CHECK#3 +if (parseInt("3", 0) !== parseInt("3", 10)) { + $ERROR('#3: parseInt("3", 0) === parseInt("3", 10). Actual: ' + (parseInt("3", 0))); +} + +//CHECK#4 +if (parseInt("4", 0) !== parseInt("4", 10)) { + $ERROR('#4: parseInt("4", 0) === parseInt(4", 10). Actual: ' + (parseInt("4", 0))); +} + +//CHECK#5 +if (parseInt("5", 0) !== parseInt("5", 10)) { + $ERROR('#5: parseInt("5", 0) === parseInt("5", 10). Actual: ' + (parseInt("5", 0))); +} + +//CHECK#6 +if (parseInt("6", 0) !== parseInt("6", 10)) { + $ERROR('#6: parseInt("6", 0) === parseInt("6", 10). Actual: ' + (parseInt("6", 0))); +} + +//CHECK#7 +if (parseInt("7", 0) !== parseInt("7", 10)) { + $ERROR('#7: parseInt("7", 0) === parseInt("7", 10). Actual: ' + (parseInt("7", 0))); +} + +//CHECK#8 +if (parseInt("8", 0) !== parseInt("8", 10)) { + $ERROR('#8: parseInt("8", 0) === parseInt("8", 10). Actual: ' + (parseInt("8", 0))); +} + +//CHECK#9 +if (parseInt("9", 0) !== parseInt("9", 10)) { + $ERROR('#9: parseInt("9", 0) === parseInt("9", 10). Actual: ' + (parseInt("9", 0))); +} + +//CHECK#10 +if (parseInt("10", 0) !== parseInt("10", 10)) { + $ERROR('#10: parseInt("10", 0) === parseInt("10", 10). Actual: ' + (parseInt("10", 0))); +} + +//CHECK#11 +if (parseInt("11", 0) !== parseInt("11", 10)) { + $ERROR('#11: parseInt("11", 0) === parseInt("11", 10). Actual: ' + (parseInt("11", 0))); +} + +//CHECK#12 +if (parseInt("9999", 0) !== parseInt("9999", 10)) { + $ERROR('#12: parseInt("9999", 0) === parseInt("9999", 10). Actual: ' + (parseInt("9999", 0))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T2.js new file mode 100644 index 000000000..230989c7d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.1_T2.js @@ -0,0 +1,74 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A4.1_T2; + * @section: 15.1.2.2; + * @assertion: If R = 0 or R = undefined, then R = 10; + * @description: R = undefined; +*/ + +//CHECK#0 +if (parseInt("0") !== parseInt("0", 10)) { + $ERROR('#0: parseInt("0") === parseInt("0", 10). Actual: ' + (parseInt("0"))); +} + +//CHECK#1 +if (parseInt("1") !== parseInt("1", 10)) { + $ERROR('#1: parseInt("1") === parseInt("01", 10). Actual: ' + (parseInt("1"))); +} + +//CHECK#2 +if (parseInt("2") !== parseInt("2", 10)) { + $ERROR('#2: parseInt("2") === parseInt("2", 10). Actual: ' + (parseInt("2"))); +} + +//CHECK#3 +if (parseInt("3") !== parseInt("3", 10)) { + $ERROR('#3: parseInt("3") === parseInt("3", 10). Actual: ' + (parseInt("3"))); +} + +//CHECK#4 +if (parseInt("4") !== parseInt("4", 10)) { + $ERROR('#4: parseInt("4") === parseInt(4", 10). Actual: ' + (parseInt("4"))); +} + +//CHECK#5 +if (parseInt("5") !== parseInt("5", 10)) { + $ERROR('#5: parseInt("5") === parseInt("5", 10). Actual: ' + (parseInt("5"))); +} + +//CHECK#6 +if (parseInt("6") !== parseInt("6", 10)) { + $ERROR('#6: parseInt("6") === parseInt("6", 10). Actual: ' + (parseInt("6"))); +} + +//CHECK#7 +if (parseInt("7") !== parseInt("7", 10)) { + $ERROR('#7: parseInt("7") === parseInt("7", 10). Actual: ' + (parseInt("7"))); +} + +//CHECK#8 +if (parseInt("8") !== parseInt("8", 10)) { + $ERROR('#8: parseInt("8") === parseInt("8", 10). Actual: ' + (parseInt("8"))); +} + +//CHECK#9 +if (parseInt("9") !== parseInt("9", 10)) { + $ERROR('#9: parseInt("9") === parseInt("9", 10). Actual: ' + (parseInt("9"))); +} + +//CHECK#10 +if (parseInt("10") !== parseInt("10", 10)) { + $ERROR('#10: parseInt("10") === parseInt("10", 10). Actual: ' + (parseInt("10"))); +} + +//CHECK#11 +if (parseInt("11") !== parseInt("11", 10)) { + $ERROR('#11: parseInt("11") === parseInt("11", 10). Actual: ' + (parseInt("11"))); +} + +//CHECK#12 +if (parseInt("9999") !== parseInt("9999", 10)) { + $ERROR('#12: parseInt("9999") === parseInt("9999", 10). Actual: ' + (parseInt("9999"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T1.js new file mode 100644 index 000000000..9e0c8fb23 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T1.js @@ -0,0 +1,69 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A4.2_T1; + * @section: 15.1.2.2; + * @assertion: If R < 2 or R > 36, then return NaN; + * @description: R = 1; +*/ + +//CHECK#0 +if (isNaN(parseInt("0", 1)) !== true) { + $ERROR('#0: parseInt("0", 1) === Not-a-Number. Actual: ' + (parseInt("0", 1))); +} + +//CHECK#1 +if (isNaN(parseInt("1", 1)) !== true) { + $ERROR('#1: parseInt("1", 1) === Not-a-Number. Actual: ' + (parseInt("1", 1))); +} + +//CHECK#2 +if (isNaN(parseInt("2", 1)) !== true) { + $ERROR('#2: parseInt("2", 1) === Not-a-Number. Actual: ' + (parseInt("2", 1))); +} + +//CHECK#3 +if (isNaN(parseInt("3", 1)) !== true) { + $ERROR('#3: parseInt("3", 1) === Not-a-Number. Actual: ' + (parseInt("3", 1))); +} + +//CHECK#4 +if (isNaN(parseInt("4", 1)) !== true) { + $ERROR('#4: parseInt("4", 1) === Not-a-Number. Actual: ' + (parseInt("4", 1))); +} + +//CHECK#5 +if (isNaN(parseInt("5", 1)) !== true) { + $ERROR('#5: parseInt("5", 1) === Not-a-Number. Actual: ' + (parseInt("5", 1))); +} + +//CHECK#6 +if (isNaN(parseInt("6", 1)) !== true) { + $ERROR('#6: parseInt("6", 1) === Not-a-Number. Actual: ' + (parseInt("6", 1))); +} + +//CHECK#7 +if (isNaN(parseInt("7", 1)) !== true) { + $ERROR('#7: parseInt("7", 1) === Not-a-Number. Actual: ' + (parseInt("7", 1))); +} + +//CHECK#8 +if (isNaN(parseInt("8", 1)) !== true) { + $ERROR('#8: parseInt("8", 1) === Not-a-Number. Actual: ' + (parseInt("8", 1))); +} + +//CHECK#9 +if (isNaN(parseInt("9", 1)) !== true) { + $ERROR('#9: parseInt("9", 1) === Not-a-Number. Actual: ' + (parseInt("9", 1))); +} + +//CHECK#10 +if (isNaN(parseInt("10", 1)) !== true) { + $ERROR('#10: parseInt("10", 1) === Not-a-Number. Actual: ' + (parseInt("10", 1))); +} + +//CHECK#11 +if (isNaN(parseInt("11", 1)) !== true) { + $ERROR('#11: parseInt("11", 1) === Not-a-Number. Actual: ' + (parseInt("11", 1))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T2.js new file mode 100644 index 000000000..571c58cfa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T2.js @@ -0,0 +1,69 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A4.2_T2; + * @section: 15.1.2.2; + * @assertion: If R < 2 or R > 36, then return NaN; + * @description: R = 37; +*/ + +//CHECK#0 +if (isNaN(parseInt("0", 37)) !== true) { + $ERROR('#0: parseInt("0", 37) === Not-a-Number. Actual: ' + (parseInt("0", 37))); +} + +//CHECK#1 +if (isNaN(parseInt("1", 37)) !== true) { + $ERROR('#1: parseInt("1", 37) === Not-a-Number. Actual: ' + (parseInt("1", 37))); +} + +//CHECK#2 +if (isNaN(parseInt("2", 37)) !== true) { + $ERROR('#2: parseInt("2", 37) === Not-a-Number. Actual: ' + (parseInt("2", 37))); +} + +//CHECK#3 +if (isNaN(parseInt("3", 37)) !== true) { + $ERROR('#3: parseInt("3", 37) === Not-a-Number. Actual: ' + (parseInt("3", 37))); +} + +//CHECK#4 +if (isNaN(parseInt("4", 37)) !== true) { + $ERROR('#4: parseInt("4", 37) === Not-a-Number. Actual: ' + (parseInt("4", 37))); +} + +//CHECK#5 +if (isNaN(parseInt("5", 37)) !== true) { + $ERROR('#5: parseInt("5", 37) === Not-a-Number. Actual: ' + (parseInt("5", 37))); +} + +//CHECK#6 +if (isNaN(parseInt("6", 37)) !== true) { + $ERROR('#6: parseInt("6", 37) === Not-a-Number. Actual: ' + (parseInt("6", 37))); +} + +//CHECK#7 +if (isNaN(parseInt("7", 37)) !== true) { + $ERROR('#7: parseInt("7", 37) === Not-a-Number. Actual: ' + (parseInt("7", 37))); +} + +//CHECK#8 +if (isNaN(parseInt("8", 37)) !== true) { + $ERROR('#8: parseInt("8", 37) === Not-a-Number. Actual: ' + (parseInt("8", 37))); +} + +//CHECK#9 +if (isNaN(parseInt("9", 37)) !== true) { + $ERROR('#9: parseInt("9", 37) === Not-a-Number. Actual: ' + (parseInt("9", 37))); +} + +//CHECK#10 +if (isNaN(parseInt("10", 37)) !== true) { + $ERROR('#10: parseInt("10", 37) === Not-a-Number. Actual: ' + (parseInt("10", 37))); +} + +//CHECK#11 +if (isNaN(parseInt("11", 37)) !== true) { + $ERROR('#11: parseInt("11", 37) === Not-a-Number. Actual: ' + (parseInt("11", 37))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T3.js new file mode 100644 index 000000000..414f29322 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A4.2_T3.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.2.2_A4.2_T3; + * @section: 15.1.2.2; + * @assertion: If R < 2 or R > 36, then return NaN; + * @description: Complex test; +*/ + +//CHECK# +var pow = 2; +for (var i = 1; i < 32; i++) { + if (pow > 36) { + var res = true; + if (isNaN(parseInt(1, pow)) !== true) { + $ERROR('#1.' + i + ': If R < 2 or R > 36, then return NaN'); + } + if (isNaN(parseInt(1, -pow)) !== true) { + $ERROR('#2.' + i + ': If R < 2 or R > 36, then return NaN'); + } + } + pow = pow * 2; +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js new file mode 100644 index 000000000..f0038dc61 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A5.1_T1; + * @section: 15.1.2.2; + * @assertion: If the length of S is at least 1 and the first character of S is 0, + * then at the implementation's discretion either let R = 8 or R = 10; + * @description: Either R = 8, or R = 10; +*/ + +//CHECK# +var res8 = 1; +var res10 = 1; +if (parseInt("08") !== parseInt("08", 8)) { + res8 = 0; +} +if (parseInt("08") !== parseInt("08", 10)) { + res10 = 0; +} +if (parseInt("09") !== parseInt("09", 8)) { + res8 = 0; +} +if (parseInt("09") !== parseInt("09", 10)) { + res10 = 0; +} +if (parseInt("010") !== parseInt("010", 8)) { + res8 = 0; +} +if (parseInt("010") !== parseInt("010", 10)) { + res10 = 0; +} +if (res8 + res10 !== 1) { + $ERROR('#1: If the length of S is at least 1 and the first character of S is 0, then at the implementation\'s discretion either let R = 8 or R = 10'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T1.js new file mode 100644 index 000000000..d26b2ae82 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T1.js @@ -0,0 +1,100 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A5.2_T1; + * @section: 15.1.2.2; + * @assertion: If the length of S is at least 2 and the first two characters of S + * are either 0x or 0X, then remove the first two characters from S and let R = 16; + * @description: : 0x; +*/ + +//CHECK#0 +if (parseInt("0x0", 0) !== parseInt("0", 16)) { + $ERROR('#0: parseInt("0x0", 0) === parseInt("0", 16). Actual: ' + (parseInt("0x0", 0))); +} + +//CHECK#1 +if (parseInt("0x1", 0) !== parseInt("1", 16)) { + $ERROR('#1: parseInt("0x1", 0) === parseInt("1", 16). Actual: ' + (parseInt("0x1", 0))); +} + +//CHECK#2 +if (parseInt("0x2", 0) !== parseInt("2", 16)) { + $ERROR('#2: parseInt("0x2", 0) === parseInt("2", 16). Actual: ' + (parseInt("0x2", 0))); +} + +//CHECK#3 +if (parseInt("0x3", 0) !== parseInt("3", 16)) { + $ERROR('#3: parseInt("0x3", 0) === parseInt("3", 16). Actual: ' + (parseInt("0x3", 0))); +} + +//CHECK#4 +if (parseInt("0x4", 0) !== parseInt("4", 16)) { + $ERROR('#4: parseInt("0x4", 0) === parseInt("4", 16). Actual: ' + (parseInt("0x4", 0))); +} + +//CHECK#5 +if (parseInt("0x5", 0) !== parseInt("5", 16)) { + $ERROR('#5: parseInt("0x5", 0) === parseInt("5", 16). Actual: ' + (parseInt("0x5", 0))); +} + +//CHECK#6 +if (parseInt("0x6", 0) !== parseInt("6", 16)) { + $ERROR('#6: parseInt("0x6", 0) === parseInt("6", 16). Actual: ' + (parseInt("0x6", 0))); +} + +//CHECK#7 +if (parseInt("0x7", 0) !== parseInt("7", 16)) { + $ERROR('#7: parseInt("0x7", 0) === parseInt("7", 16). Actual: ' + (parseInt("0x7", 0))); +} + +//CHECK#8 +if (parseInt("0x8", 0) !== parseInt("8", 16)) { + $ERROR('#8: parseInt("0x8", 0) === parseInt("8", 16). Actual: ' + (parseInt("0x8", 0))); +} + +//CHECK#9 +if (parseInt("0x9", 0) !== parseInt("9", 16)) { + $ERROR('#9: parseInt("0x9", 0) === parseInt("9", 16). Actual: ' + (parseInt("0x9", 0))); +} + +//CHECK#A +if (parseInt("0xA", 0) !== parseInt("A", 16)) { + $ERROR('#A: parseInt("0xA", 0) === parseInt("A", 16). Actual: ' + (parseInt("0xA", 0))); +} + +//CHECK#B +if (parseInt("0xB", 0) !== parseInt("B", 16)) { + $ERROR('#B: parseInt("0xB", 0) === parseInt("B", 16). Actual: ' + (parseInt("0xB", 0))); +} + +//CHECK#C +if (parseInt("0xC", 0) !== parseInt("C", 16)) { + $ERROR('#C: parseInt("0xC", 0) === parseInt("C", 16). Actual: ' + (parseInt("0xC", 0))); +} + +//CHECK#D +if (parseInt("0xD", 0) !== parseInt("D", 16)) { + $ERROR('#D: parseInt("0xD", 0) === parseInt("D", 16). Actual: ' + (parseInt("0xD", 0))); +} + +//CHECK#E +if (parseInt("0xE", 0) !== parseInt("E", 16)) { + $ERROR('#E: parseInt("0xE", 0) === parseInt("E", 16). Actual: ' + (parseInt("0xE", 0))); +} + +//CHECK#F +if (parseInt("0xF", 0) !== parseInt("F", 16)) { + $ERROR('#F: parseInt("0xF", 0) === parseInt("F", 16). Actual: ' + (parseInt("0xF", 0))); +} + +//CHECK#E +if (parseInt("0xE", 0) !== parseInt("E", 16)) { + $ERROR('#E: parseInt("0xE", 0) === parseInt("E", 16). Actual: ' + (parseInt("0xE", 0))); +} + +//CHECK#ABCDEF +if (parseInt("0xABCDEF", 0) !== parseInt("ABCDEF", 16)) { + $ERROR('#ABCDEF: parseInt("0xABCDEF", 0) === parseInt("ABCDEF", 16). Actual: ' + (parseInt("0xABCDEF", 0))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T2.js new file mode 100644 index 000000000..bcf86389d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.2_T2.js @@ -0,0 +1,100 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A5.2_T2; + * @section: 15.1.2.2; + * @assertion: If the length of S is at least 2 and the first two characters of S + * are either 0x or 0X, then remove the first two characters from S and let R = 16; + * @description: : 0X; +*/ + +//CHECK#0 +if (parseInt("0X0", 0) !== parseInt("0", 16)) { + $ERROR('#0: parseInt("0X0", 0) === parseInt("0", 16). Actual: ' + (parseInt("0X0", 0))); +} + +//CHECK#1 +if (parseInt("0X1") !== parseInt("1", 16)) { + $ERROR('#1: parseInt("0X1") === parseInt("1", 16). Actual: ' + (parseInt("0X1"))); +} + +//CHECK#2 +if (parseInt("0X2") !== parseInt("2", 16)) { + $ERROR('#2: parseInt("0X2") === parseInt("2", 16). Actual: ' + (parseInt("0X2"))); +} + +//CHECK#3 +if (parseInt("0X3") !== parseInt("3", 16)) { + $ERROR('#3: parseInt("0X3") === parseInt("3", 16). Actual: ' + (parseInt("0X3"))); +} + +//CHECK#4 +if (parseInt("0X4") !== parseInt("4", 16)) { + $ERROR('#4: parseInt("0X4") === parseInt("4", 16). Actual: ' + (parseInt("0X4"))); +} + +//CHECK#5 +if (parseInt("0X5") !== parseInt("5", 16)) { + $ERROR('#5: parseInt("0X5") === parseInt("5", 16). Actual: ' + (parseInt("0X5"))); +} + +//CHECK#6 +if (parseInt("0X6") !== parseInt("6", 16)) { + $ERROR('#6: parseInt("0X6") === parseInt("6", 16). Actual: ' + (parseInt("0X6"))); +} + +//CHECK#7 +if (parseInt("0X7") !== parseInt("7", 16)) { + $ERROR('#7: parseInt("0X7") === parseInt("7", 16). Actual: ' + (parseInt("0X7"))); +} + +//CHECK#8 +if (parseInt("0X8") !== parseInt("8", 16)) { + $ERROR('#8: parseInt("0X8") === parseInt("8", 16). Actual: ' + (parseInt("0X8"))); +} + +//CHECK#9 +if (parseInt("0X9") !== parseInt("9", 16)) { + $ERROR('#9: parseInt("0X9") === parseInt("9", 16). Actual: ' + (parseInt("0X9"))); +} + +//CHECK#A +if (parseInt("0XA") !== parseInt("A", 16)) { + $ERROR('#A: parseInt("0XA") === parseInt("A", 16). Actual: ' + (parseInt("0XA"))); +} + +//CHECK#B +if (parseInt("0XB") !== parseInt("B", 16)) { + $ERROR('#B: parseInt("0XB") === parseInt("B", 16). Actual: ' + (parseInt("0XB"))); +} + +//CHECK#C +if (parseInt("0XC") !== parseInt("C", 16)) { + $ERROR('#C: parseInt("0XC") === parseInt("C", 16). Actual: ' + (parseInt("0XC"))); +} + +//CHECK#D +if (parseInt("0XD") !== parseInt("D", 16)) { + $ERROR('#D: parseInt("0XD") === parseInt("D", 16). Actual: ' + (parseInt("0XD"))); +} + +//CHECK#E +if (parseInt("0XE") !== parseInt("E", 16)) { + $ERROR('#E: parseInt("0XE") === parseInt("E", 16). Actual: ' + (parseInt("0XE"))); +} + +//CHECK#F +if (parseInt("0XF") !== parseInt("F", 16)) { + $ERROR('#F: parseInt("0XF") === parseInt("F", 16). Actual: ' + (parseInt("0XF"))); +} + +//CHECK#E +if (parseInt("0XE") !== parseInt("E", 16)) { + $ERROR('#E: parseInt("0XE") === parseInt("E", 16). Actual: ' + (parseInt("0XE"))); +} + +//CHECK#ABCDEF +if (parseInt("0XABCDEF") !== parseInt("ABCDEF", 16)) { + $ERROR('#ABCDEF: parseInt("0XABCDEF") === parseInt("ABCDEF", 16). Actual: ' + (parseInt("0XABCDEF"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T1.js new file mode 100644 index 000000000..32a873c7f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T1.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.2.2_A6.1_T1; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. R in [2, 36]; +*/ + +//CHECK# +for (var i = 2; i <= 36; i++) { + if (parseInt("10$1", i) !== i) { + $ERROR('#' + i +': i = ' + i + 'parseInt("10$1", i) === i. Actual: ' + (parseInt("10$1", i))); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T2.js new file mode 100644 index 000000000..51469579c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A6.1_T2; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. Radix-R notation in [0..9, A-Z]; +*/ + +//CHECK# +var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var i = 2; i <= 36; i++) { + if (parseInt(R_digit[i - 2] + "$", i) !== i - 1) { + $ERROR('#' + i + ': '); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T3.js new file mode 100644 index 000000000..9eca01526 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A6.1_T3; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. Radix-R notation in [0..9, a-z]; +*/ + +//CHECK# +var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var i = 2; i <= 36; i++) { + if (parseInt(R_digit[i - 2] + "$", i) !== i - 1) { + $ERROR('#' + i + ': '); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T4.js new file mode 100644 index 000000000..899ed126d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A6.1_T4; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. Radix-R notation in [0..9, A-Z]; +*/ + +//CHECK# +var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +for (var i = 2; i <= 35; i++) { + if (parseInt(R_digit[i - 2] + R_digit[i - 1], i) !== i - 1) { + $ERROR('#' + i + ': '); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T5.js new file mode 100644 index 000000000..1b3f9dd39 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A6.1_T5; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. Radix-R notation in [0..9, a-z]; +*/ + +//CHECK# +var R_digit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var i = 2; i <= 35; i++) { + if (parseInt(R_digit[i - 2] + R_digit[i - 1], i) !== i - 1) { + $ERROR('#' + i + ': '); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T6.js new file mode 100644 index 000000000..1c7a9da44 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A6.1_T6.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A6.1_T6; + * @section: 15.1.2.2; + * @assertion: If S contains any character that is not a radix-R digit, + * then let Z be the substring of S consisting of all characters before + * the first such character; otherwise, let Z be S; + * @description: Complex test. Radix-R notation in [0..9]; +*/ + +//CHECK#2 +if (parseInt("0123456789", 2) !== 1) { + $ERROR('#2: parseInt("0123456789", 2) === 1. Actual: ' + (parseInt("0123456789", 2))); +} + +//CHECK#3 +if (parseInt("01234567890", 3) !== 5) { + $ERROR('#3: parseInt("01234567890", 3) === 5. Actual: ' + (parseInt("01234567890", 3))); +} + +//CHECK#4 +if (parseInt("01234567890", 4) !== 27) { + $ERROR('#4: parseInt("01234567890", 4) === 27. Actual: ' + (parseInt("01234567890", 4))); +} + +//CHECK#5 +if (parseInt("01234567890", 5) !== 194) { + $ERROR('#5: parseInt("01234567890", 5) === 194. Actual: ' + (parseInt("01234567890", 5))); +} + +//CHECK#6 +if (parseInt("01234567890", 6) !== 1865) { + $ERROR('#6: parseInt("01234567890", 6) === 1865. Actual: ' + (parseInt("01234567890", 6))); +} + +//CHECK#7 +if (parseInt("01234567890", 7) !== 22875) { + $ERROR('#7: parseInt("01234567890", 7) === 22875. Actual: ' + (parseInt("01234567890", 7))); +} + +//CHECK#8 +if (parseInt("01234567890", 8) !== 342391) { + $ERROR('#8: parseInt("01234567890", 8) === 342391. Actual: ' + (parseInt("01234567890", 8))); +} + +//CHECK#9 +if (parseInt("01234567890", 9) !== 6053444) { + $ERROR('#9: parseInt("01234567890", 9) === 6053444. Actual: ' + (parseInt("01234567890", 9))); +} + +//CHECK#10 +if (parseInt("01234567890", 10) !== Number(1234567890)) { + $ERROR('#10: parseInt("01234567890", 10) === Number(1234567890). Actual: ' + (parseInt("01234567890", 10))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T1.js new file mode 100644 index 000000000..82de152e3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.1_T1; + * @section: 15.1.2.2; + * @assertion: If Z is empty, return NaN; + * @description: Complex test. R in [2, 36]; +*/ + +//CHECK# +for (var i = 2; i <= 36; i++) { + if (isNaN(parseInt("$string", i)) !== true) { + $ERROR('#' + i + ': parseInt("$string", i) === Not-a-Number. Actual: ' + (parseInt("$string", i))); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T2.js new file mode 100644 index 000000000..7d4a82162 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.1_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.1_T2; + * @section: 15.1.2.2; + * @assertion: If Z is empty, return NaN; + * @description: x is not a radix-R digit; +*/ + +//CHECK#1 +if (isNaN(parseInt("$0x")) !== true) { + $ERROR('#1: parseInt("$0x") === Not-a-Number. Actual: ' + (parseInt("$0x"))); +} + +//CHECK#2 +if (isNaN(parseInt("$0X")) !== true) { + $ERROR('#2: parseInt("$0X") === Not-a-Number. Actual: ' + (parseInt("$0X"))); +} + +//CHECK#3 +if (isNaN(parseInt("$$$")) !== true) { + $ERROR('#3: parseInt("$$$") === Not-a-Number. Actual: ' + (parseInt("$$$"))); +} + +//CHECK#4 +if (isNaN(parseInt("")) !== true) { + $ERROR('#4: parseInt("") === Not-a-Number. Actual: ' + (parseInt(""))); +} + +//CHECK#5 +if (isNaN(parseInt(" ")) !== true) { + $ERROR('#5: parseInt(" ") === Not-a-Number. Actual: ' + (parseInt(" "))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T1.js new file mode 100644 index 000000000..a7e2feac7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.2_T1; + * @section: 15.1.2.2; + * @assertion: Compute the mathematical integer value + * that is represented by Z in radix-R notation, using the + * letters A-Z and a-z for digits with values 10 through 35. + * Compute the number value for Result(16); + * @description: Complex test. Check algorithm; +*/ + +//CHECK# +var R_digit1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +var R_digit2 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var i = 2; i <= 36; i++) { + for (var j = 0; j < 10; j++) { + var str = ""; + var num = 0; + var pow = 1; + var k0 = Math.max(2, i - j); + for (var k = k0; k <= i; k++) { + if (k % 2 === 0) { + str = str + R_digit1[k - 2]; + } else { + str = str + R_digit2[k - 2]; + } + num = num + (i + (k0 - k) - 1) * pow; + pow = pow * i; + } + if (parseInt(str, i) !== num) { + $ERROR('#' + i + '.' + j + ' : '); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T2.js new file mode 100644 index 000000000..86af2de0f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T2.js @@ -0,0 +1,112 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.2_T2; + * @section: 15.1.2.2; + * @assertion: Compute the mathematical integer value + * that is represented by Z in radix-R notation, using the + * letters A-Z and a-z for digits with values 10 through 35. + * Compute the number value for Result(16); + * @description: Checking algorithm for R = 2; +*/ + +//CHECK#1 +if (parseInt("1", 2) !== 1) { + $ERROR('#1: parseInt("1", 2) === 1. Actual: ' + (parseInt("1", 2))); +} + +//CHECK#2 +if (parseInt("11", 2) !== 3) { + $ERROR('#2: parseInt("11", 2) === 3. Actual: ' + (parseInt("11", 2))); +} + +//CHECK#3 +if (parseInt("111", 2) !== 7) { + $ERROR('#3: parseInt("111", 2) === 7. Actual: ' + (parseInt("111", 2))); +} + +//CHECK#4 +if (parseInt("1111", 2) !== 15) { + $ERROR('#4: parseInt("1111", 2) === 15. Actual: ' + (parseInt("1111", 2))); +} + +//CHECK#5 +if (parseInt("11111", 2) !== 31) { + $ERROR('#5: parseInt("11111", 2) === 31. Actual: ' + (parseInt("11111", 2))); +} + +//CHECK#6 +if (parseInt("111111", 2) !== 63) { + $ERROR('#6: parseInt("111111", 2) === 63. Actual: ' + (parseInt("111111", 2))); +} + +//CHECK#7 +if (parseInt("1111111", 2) !== 127) { + $ERROR('#7: parseInt("1111111", 2) === 127. Actual: ' + (parseInt("1111111", 2))); +} + +//CHECK#8 +if (parseInt("11111111", 2) !== 255) { + $ERROR('#8: parseInt("11111111", 2) === 255. Actual: ' + (parseInt("11111111", 2))); +} + +//CHECK#9 +if (parseInt("111111111", 2) !== 511) { + $ERROR('#9: parseInt("111111111", 2) === 511. Actual: ' + (parseInt("111111111", 2))); +} + +//CHECK#10 +if (parseInt("1111111111", 2) !== 1023) { + $ERROR('#10: parseInt("1111111111", 2) === 1023. Actual: ' + (parseInt("1111111111", 2))); +} + +//CHECK#11 +if (parseInt("11111111111", 2) !== 2047) { + $ERROR('#11: parseInt("11111111111", 2) === 2047. Actual: ' + (parseInt("11111111111", 2))); +} + +//CHECK#12 +if (parseInt("111111111111", 2) !== 4095) { + $ERROR('#12: parseInt("111111111111", 2) === 4095. Actual: ' + (parseInt("111111111111", 2))); +} + +//CHECK#13 +if (parseInt("1111111111111", 2) !== 8191) { + $ERROR('#13: parseInt("1111111111111", 2) === 8191. Actual: ' + (parseInt("1111111111111", 2))); +} + +//CHECK#14 +if (parseInt("11111111111111", 2) !== 16383) { + $ERROR('#14: parseInt("11111111111111", 2) === 16383. Actual: ' + (parseInt("11111111111111", 2))); +} + +//CHECK#15 +if (parseInt("111111111111111", 2) !== 32767) { + $ERROR('#15: parseInt("111111111111111", 2) === 32767. Actual: ' + (parseInt("111111111111111", 2))); +} + +//CHECK#16 +if (parseInt("1111111111111111", 2) !== 65535) { + $ERROR('#16: parseInt("1111111111111111", 2) === 65535. Actual: ' + (parseInt("1111111111111111", 2))); +} + +//CHECK#17 +if (parseInt("11111111111111111", 2) !== 131071) { + $ERROR('#17: parseInt("11111111111111111", 2) === 131071. Actual: ' + (parseInt("11111111111111111", 2))); +} + +//CHECK#18 +if (parseInt("111111111111111111", 2) !== 262143) { + $ERROR('#18: parseInt("111111111111111111", 2) === 262143. Actual: ' + (parseInt("111111111111111111", 2))); +} + +//CHECK#19 +if (parseInt("1111111111111111111", 2) !== 524287) { + $ERROR('#19: parseInt("1111111111111111111", 2) === 524287. Actual: ' + (parseInt("1111111111111111111", 2))); +} + +//CHECK#20 +if (parseInt("11111111111111111111", 2) !== 1048575) { + $ERROR('#20: parseInt("11111111111111111111", 2) === 1048575. Actual: ' + (parseInt("11111111111111111111", 2))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T3.js new file mode 100644 index 000000000..90b855ef0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.2_T3.js @@ -0,0 +1,112 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.2_T3; + * @section: 15.1.2.2; + * @assertion: Compute the mathematical integer value + * that is represented by Z in radix-R notation, using the + * letters A-Z and a-z for digits with values 10 through 35. + * Compute the number value for Result(16); + * @description: Checking algorithm for R = 16; +*/ + +//CHECK#1 +if (parseInt("0x1", 16) !== 1) { + $ERROR('#1: parseInt("0x1", 16) === 1. Actual: ' + (parseInt("0x1", 16))); +} + +//CHECK#2 +if (parseInt("0X10", 16) !== 16) { + $ERROR('#2: parseInt("0X10", 16) === 16. Actual: ' + (parseInt("0X10", 16))); +} + +//CHECK#3 +if (parseInt("0x100", 16) !== 256) { + $ERROR('#3: parseInt("0x100", 16) === 256. Actual: ' + (parseInt("0x100", 16))); +} + +//CHECK#4 +if (parseInt("0X1000", 16) !== 4096) { + $ERROR('#4: parseInt("0X1000", 16) === 4096. Actual: ' + (parseInt("0X1000", 16))); +} + +//CHECK#5 +if (parseInt("0x10000", 16) !== 65536) { + $ERROR('#5: parseInt("0x10000", 16) === 65536. Actual: ' + (parseInt("0x10000", 16))); +} + +//CHECK#6 +if (parseInt("0X100000", 16) !== 1048576) { + $ERROR('#6: parseInt("x100000", 16) === 1048576. Actual: ' + (parseInt("x100000", 16))); +} + +//CHECK#7 +if (parseInt("0x1000000", 16) !== 16777216) { + $ERROR('#7: parseInt("0x1000000", 16) === 16777216. Actual: ' + (parseInt("0x1000000", 16))); +} + +//CHECK#8 +if (parseInt("0x10000000", 16) !== 268435456) { + $ERROR('#8: parseInt("0x10000000", 16) === 268435456. Actual: ' + (parseInt("0x10000000", 16))); +} + +//CHECK#9 +if (parseInt("0x100000000", 16) !== 4294967296) { + $ERROR('#9: parseInt("0x100000000", 16) === 4294967296. Actual: ' + (parseInt("0x100000000", 16))); +} + +//CHECK#10 +if (parseInt("0x1000000000", 16) !== 68719476736) { + $ERROR('#10: parseInt("0x1000000000", 16) === 68719476736. Actual: ' + (parseInt("0x1000000000", 16))); +} + +//CHECK#10 +if (parseInt("0x10000000000", 16) !== 1099511627776) { + $ERROR('#10: parseInt("0x10000000000", 16) === 1099511627776. Actual: ' + (parseInt("0x10000000000", 16))); +} + +//CHECK#12 +if (parseInt("0x100000000000", 16) !== 17592186044416) { + $ERROR('#12: parseInt("0x100000000000", 16) === 17592186044416. Actual: ' + (parseInt("0x100000000000", 16))); +} + +//CHECK#13 +if (parseInt("0x1000000000000", 16) !== 281474976710656) { + $ERROR('#13: parseInt("0x1000000000000", 16) === 281474976710656. Actual: ' + (parseInt("0x1000000000000", 16))); +} + +//CHECK#14 +if (parseInt("0x10000000000000", 16) !== 4503599627370496) { + $ERROR('#14: parseInt("0x10000000000000", 16) === 4503599627370496. Actual: ' + (parseInt("0x10000000000000", 16))); +} + +//CHECK#15 +if (parseInt("0x100000000000000", 16) !== 72057594037927936) { + $ERROR('#15: parseInt("0x100000000000000", 16) === 72057594037927936. Actual: ' + (parseInt("0x100000000000000", 16))); +} + +//CHECK#16 +if (parseInt("0x1000000000000000", 16) !== 1152921504606846976) { + $ERROR('#16: parseInt("0x1000000000000000", 16) === 1152921504606846976. Actual: ' + (parseInt("0x1000000000000000", 16))); +} + +//CHECK#17 +if (parseInt("0x10000000000000000", 16) !== 18446744073709551616) { + $ERROR('#17: parseInt("0x10000000000000000", 16) === 18446744073709551616. Actual: ' + (parseInt("0x10000000000000000", 16))); +} + +//CHECK#18 +if (parseInt("0x100000000000000000", 16) !== 295147905179352825856) { + $ERROR('#18: parseInt("0x100000000000000000", 16) === 295147905179352825856. Actual: ' + (parseInt("0x100000000000000000", 16))); +} + +//CHECK#19 +if (parseInt("0x1000000000000000000", 16) !== 4722366482869645213696) { + $ERROR('#19: parseInt("0x1000000000000000000", 16) === 4722366482869645213696. Actual: ' + (parseInt("0x1000000000000000000", 16))); +} + +//CHECK#20 +if (parseInt("0x10000000000000000000", 16) !== 75557863725914323419136) { + $ERROR('#20: parseInt("0x10000000000000000000", 16) === 75557863725914323419136. Actual: ' + (parseInt("0x10000000000000000000", 16))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T1.js new file mode 100644 index 000000000..9fa19756e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.3_T1; + * @section: 15.1.2.2; + * @assertion: Return sign * Result(17); + * @description: Complex test. Check algorithm; +*/ + +//CHECK# +var R_digit1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; +var R_digit2 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (var i = 2; i <= 36; i++) { + for (var j = 0; j < 10; j++) { + var str = "+"; + var sign = 1; + if (j % 2 !== 0) { + str = "-"; + sign= -1; + } + var num = 0; + var pow = 1; + var k0 = Math.max(2, i - j); + for (var k = k0; k <= i; k++) { + if (k % 2 === 0) { + str = str + R_digit1[k - 2]; + } else { + str = str + R_digit2[k - 2]; + } + num = num + (i + (k0 - k) - 1) * pow; + pow = pow * i; + } + if (parseInt(str, i) !== num * sign) { + $ERROR('#' + i + '.' + j + ' : '); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T2.js new file mode 100644 index 000000000..8ca4598c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T2.js @@ -0,0 +1,109 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.3_T2; + * @section: 15.1.2.2; + * @assertion: Return sign * Result(17); + * @description: Checking algorithm for R = 2; +*/ + +//CHECK#1 +if (parseInt("-1", 2) !== -1) { + $ERROR('#1: parseInt("-1", 2) === -1. Actual: ' + (parseInt("-1", 2))); +} + +//CHECK#2 +if (parseInt("-11", 2) !== -3) { + $ERROR('#2: parseInt("-11", 2) === -3. Actual: ' + (parseInt("-11", 2))); +} + +//CHECK#3 +if (parseInt("-111", 2) !== -7) { + $ERROR('#3: parseInt("-111", 2) === -7. Actual: ' + (parseInt("-111", 2))); +} + +//CHECK#4 +if (parseInt("-1111", 2) !== -15) { + $ERROR('#4: parseInt("-1111", 2) === -15. Actual: ' + (parseInt("-1111", 2))); +} + +//CHECK#5 +if (parseInt("-11111", 2) !== -31) { + $ERROR('#5: parseInt("-11111", 2) === -31. Actual: ' + (parseInt("-11111", 2))); +} + +//CHECK#6 +if (parseInt("-111111", 2) !== -63) { + $ERROR('#6: parseInt("-111111", 2) === -63. Actual: ' + (parseInt("-111111", 2))); +} + +//CHECK#7 +if (parseInt("-1111111", 2) !== -127) { + $ERROR('#7: parseInt("-1111111", 2) === -127. Actual: ' + (parseInt("-1111111", 2))); +} + +//CHECK#8 +if (parseInt("-11111111", 2) !== -255) { + $ERROR('#8: parseInt("-11111111", 2) === -255. Actual: ' + (parseInt("-11111111", 2))); +} + +//CHECK#9 +if (parseInt("-111111111", 2) !== -511) { + $ERROR('#9: parseInt("-111111111", 2) === -511. Actual: ' + (parseInt("-111111111", 2))); +} + +//CHECK#10 +if (parseInt("-1111111111", 2) !== -1023) { + $ERROR('#10: parseInt("-1111111111", 2) === -1023. Actual: ' + (parseInt("-1111111111", 2))); +} + +//CHECK#11 +if (parseInt("-11111111111", 2) !== -2047) { + $ERROR('#11: parseInt("-11111111111", 2) === -2047. Actual: ' + (parseInt("-11111111111", 2))); +} + +//CHECK#12 +if (parseInt("-111111111111", 2) !== -4095) { + $ERROR('#12: parseInt("-111111111111", 2) === -4095. Actual: ' + (parseInt("-111111111111", 2))); +} + +//CHECK#13 +if (parseInt("-1111111111111", 2) !== -8191) { + $ERROR('#13: parseInt("-1111111111111", 2) === -8191. Actual: ' + (parseInt("-1111111111111", 2))); +} + +//CHECK#14 +if (parseInt("-11111111111111", 2) !== -16383) { + $ERROR('#14: parseInt("-11111111111111", 2) === -16383. Actual: ' + (parseInt("-11111111111111", 2))); +} + +//CHECK#15 +if (parseInt("-111111111111111", 2) !== -32767) { + $ERROR('#15: parseInt("-111111111111111", 2) === -32767. Actual: ' + (parseInt("-111111111111111", 2))); +} + +//CHECK#16 +if (parseInt("-1111111111111111", 2) !== -65535) { + $ERROR('#16: parseInt("-1111111111111111", 2) === -65535. Actual: ' + (parseInt("-1111111111111111", 2))); +} + +//CHECK#17 +if (parseInt("-11111111111111111", 2) !== -131071) { + $ERROR('#17: parseInt("-11111111111111111", 2) === -131071. Actual: ' + (parseInt("-11111111111111111", 2))); +} + +//CHECK#18 +if (parseInt("-111111111111111111", 2) !== -262143) { + $ERROR('#18: parseInt("-111111111111111111", 2) === -262143. Actual: ' + (parseInt("-111111111111111111", 2))); +} + +//CHECK#19 +if (parseInt("-1111111111111111111", 2) !== -524287) { + $ERROR('#19: parseInt("-1111111111111111111", 2) === -524287. Actual: ' + (parseInt("-1111111111111111111", 2))); +} + +//CHECK#20 +if (parseInt("-11111111111111111111", 2) !== -1048575) { + $ERROR('#20: parseInt("-11111111111111111111", 2) === -1048575. Actual: ' + (parseInt("-11111111111111111111", 2))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T3.js new file mode 100644 index 000000000..7bad7645e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A7.3_T3.js @@ -0,0 +1,109 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A7.3_T3; + * @section: 15.1.2.2; + * @assertion: Return sign * Result(17); + * @description: Checking algorithm for R = 10; +*/ + +//CHECK#1 +if (parseInt("-1", 10) !== -1) { + $ERROR('#1: parseInt("-1", 10) === -1. Actual: ' + (parseInt("-1", 10))); +} + +//CHECK#2 +if (parseInt("-10", 10) !== -10) { + $ERROR('#2: parseInt("-10", 10) === -10. Actual: ' + (parseInt("-10", 10))); +} + +//CHECK#3 +if (parseInt("-100", 10) !== -100) { + $ERROR('#3: parseInt("-100", 10) === -100. Actual: ' + (parseInt("-100", 10))); +} + +//CHECK#4 +if (parseInt("-1000", 10) !== -1000) { + $ERROR('#4: parseInt("-1000", 10) === -1000. Actual: ' + (parseInt("-1000", 10))); +} + +//CHECK#5 +if (parseInt("-10000", 10) !== -10000) { + $ERROR('#5: parseInt("-10000", 10) === -10000. Actual: ' + (parseInt("-10000", 10))); +} + +//CHECK#6 +if (parseInt("-100000", 10) !== -100000) { + $ERROR('#6: parseInt("-100000", 10) === -100000. Actual: ' + (parseInt("-100000", 10))); +} + +//CHECK#7 +if (parseInt("-1000000", 10) !== -1000000) { + $ERROR('#7: parseInt("-1000000", 10) === -1000000. Actual: ' + (parseInt("-1000000", 10))); +} + +//CHECK#8 +if (parseInt("-10000000", 10) !== -10000000) { + $ERROR('#8: parseInt("-10000000", 10) === -10000000. Actual: ' + (parseInt("-10000000", 10))); +} + +//CHECK#9 +if (parseInt("-100000000", 10) !== -100000000) { + $ERROR('#9: parseInt("-100000000", 10) === -100000000. Actual: ' + (parseInt("-100000000", 10))); +} + +//CHECK#10 +if (parseInt("-1000000000", 10) !== -1000000000) { + $ERROR('#10: parseInt("-1000000000", 10) === -1000000000. Actual: ' + (parseInt("-1000000000", 10))); +} + +//CHECK#10 +if (parseInt("-10000000000", 10) !== -10000000000) { + $ERROR('#10: parseInt("-10000000000", 10) === -10000000000. Actual: ' + (parseInt("-10000000000", 10))); +} + +//CHECK#12 +if (parseInt("-100000000000", 10) !== -100000000000) { + $ERROR('#12: parseInt("-100000000000", 10) === -100000000000. Actual: ' + (parseInt("-100000000000", 10))); +} + +//CHECK#13 +if (parseInt("-1000000000000", 10) !== -1000000000000) { + $ERROR('#13: parseInt("-1000000000000", 10) === -1000000000000. Actual: ' + (parseInt("-1000000000000", 10))); +} + +//CHECK#14 +if (parseInt("-10000000000000", 10) !== -10000000000000) { + $ERROR('#14: parseInt("-10000000000000", 10) === -10000000000000. Actual: ' + (parseInt("-10000000000000", 10))); +} + +//CHECK#15 +if (parseInt("-100000000000000", 10) !== -100000000000000) { + $ERROR('#15: parseInt("-100000000000000", 10) === -100000000000000. Actual: ' + (parseInt("-100000000000000", 10))); +} + +//CHECK#10 +if (parseInt("-1000000000000000", 10) !== -1000000000000000) { + $ERROR('#10: parseInt("-1000000000000000", 10) === -1000000000000000. Actual: ' + (parseInt("-1000000000000000", 10))); +} + +//CHECK#17 +if (parseInt("-10000000000000000", 10) !== -10000000000000000) { + $ERROR('#17: parseInt("-10000000000000000", 10) === -10000000000000000. Actual: ' + (parseInt("-10000000000000000", 10))); +} + +//CHECK#18 +if (parseInt("-100000000000000000", 10) !== -100000000000000000) { + $ERROR('#18: parseInt("-100000000000000000", 10) === -100000000000000000. Actual: ' + (parseInt("-100000000000000000", 10))); +} + +//CHECK#19 +if (parseInt("-1000000000000000000", 10) !== -1000000000000000000) { + $ERROR('#19: parseInt("-1000000000000000000", 10) === -1000000000000000000. Actual: ' + (parseInt("-1000000000000000000", 10))); +} + +//CHECK#20 +if (parseInt("-10000000000000000000", 10) !== -10000000000000000000) { + $ERROR('#20: parseInt("-10000000000000000000", 10) === -10000000000000000000. Actual: ' + (parseInt("-10000000000000000000", 10))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A8.js new file mode 100644 index 000000000..f668ccd62 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A8.js @@ -0,0 +1,82 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.2_A8; + * @section: 15.1.2.2, 9.3.1; + * @assertion: parseInt may interpret only a leading portion of the string as + * a number value; it ignores any characters that cannot be interpreted as part + * of the notation of an decimal literal, and no indication is given that any such + * characters were ignored. + * @description: Complex test without eval; +*/ + +//CHECK +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +for (var index = 0; index <= 65535; index++) { + if ((index < 0x0030) || (index > 0x0039) && + (index < 0x0041) || (index > 0x005A) && + (index < 0x0061) || (index > 0x007A)) { + var hex = decimalToHexString(index); + if (parseInt("1Z" + String.fromCharCode(index), 36) !== 71) { + if (indexO === 0) { + indexO = index; + } 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++; + } + count++; + } +} + +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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.1.js new file mode 100644 index 000000000..493dbb706 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.1; + * @section: 15.1.2.2, 15.2.4.7, 12.6.4; + * @assertion: The length property of parseInt has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (parseInt.propertyIsEnumerable('length') !== false) { + $ERROR('#1: parseInt.propertyIsEnumerable(\'length\') === false. Actual: ' + (parseInt.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (var p in parseInt){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in parseInt) { 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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.2.js new file mode 100644 index 000000000..84c1112bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.2.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.2.2_A9.2; + * @section: 15.1.2.2, 15.2.4.5, 11.4.1; + * @assertion: The length property of parseInt has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; + * @strict_mode_negative +*/ + +//CHECK#1 +if (parseInt.hasOwnProperty('length') !== true) { + $FAIL('#1: parseInt.hasOwnProperty(\'length\') === true. Actual: ' + (parseInt.hasOwnProperty('length'))); +} + +delete parseInt.length; + +//CHECK#2 +if (parseInt.hasOwnProperty('length') !== true) { + $ERROR('#2: delete parseInt.length; parseInt.hasOwnProperty(\'length\') === true. Actual: ' + (parseInt.hasOwnProperty('length'))); +} + +//CHECK#3 +if (parseInt.length === undefined) { + $ERROR('#3: delete parseInt.length; parseInt.length !== undefined'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.3.js new file mode 100644 index 000000000..b56c90fad --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.3; + * @section: 15.1.2.2; + * @assertion: The length property of parseInt has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +x = parseInt.length; +parseInt.length = Infinity; +if (parseInt.length !== x) { + $ERROR('#1: x = parseInt.length; parseInt.length = Infinity; parseInt.length === x. Actual: ' + (parseInt.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.4.js new file mode 100644 index 000000000..2b81bc082 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.4; + * @section: 15.1.2.2; + * @assertion: The length property of parseInt is 2; + * @description: parseInt.length === 2; +*/ + +//CHECK#1 +if (parseInt.length !== 2) { + $ERROR('#1: parseInt.length === 2. Actual: ' + (parseInt.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.5.js new file mode 100644 index 000000000..e5ca5558e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.5; + * @section: 15.1.2.2, 15.2.4.7, 12.6.4; + * @assertion: The parseInt property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('parseInt') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'parseInt\') === false. Actual: ' + (this.propertyIsEnumerable('parseInt'))); +} + +//CHECK#2 +var result = true; +for (var p in this){ + if (p === "parseInt") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "parseInt") 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.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.6.js new file mode 100644 index 000000000..66af13b8d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.6; +* @section: 15.1.2.2; +* @assertion: The parseInt property has not prototype property; +* @description: Checking parseInt.prototype; +*/ + +//CHECK#1 +if (parseInt.prototype !== undefined) { + $ERROR('#1: parseInt.prototype === undefined. Actual: ' + (parseInt.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.7.js new file mode 100644 index 000000000..123be57fe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A9.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.2.2_A9.7; +* @section: 15.1.2.2, 11.2.2; +* @assertion: The parseInt 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 parseInt(); + $ERROR('#1.1: new parseInt() throw TypeError. Actual: ' + (new parseInt())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new parseInt() 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.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T1.js new file mode 100644 index 000000000..25e593b6e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A1_T1; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for boolean primitive; +*/ + +//CHECK#1 +if (!(isNaN(parseFloat(true)) && isNaN(parseFloat("NaN")))) { + $ERROR('#1: parseFloat(true) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); +} + +//CHECK#2 +if (String(parseFloat(false)) !== "NaN") { + $ERROR('#2: String(parseFloat(false)) === "NaN". Actual: ' + (String(parseFloat(false)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T2.js new file mode 100644 index 000000000..a0f81e2f7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A1_T2; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for number primitive; +*/ + +//CHECK#1 +if (parseFloat(-1.1) !== parseFloat("-1.1")) { + $ERROR('#1: parseFloat(-1.1) === parseFloat("-1.1"). Actual: ' + (parseFloat(-1.1))); +} + +//CHECK#2 +if (parseFloat(Infinity) !== parseFloat("Infinity")) { + $ERROR('#2: parseFloat(Infinity) === parseFloat("Infinity"). Actual: ' + (parseFloat(Infinity))); +} + +//CHECK#3 +if (String(parseFloat(NaN)) !== "NaN") { + $ERROR('#3: String(parseFloat(NaN)) === "NaN". Actual: ' + (String(parseFloat(NaN)))); +} + +//CHECK#4 +if (parseFloat(.01e+2) !== parseFloat(".01e+2")) { + $ERROR('#4: parseFloat(.01e+2) === parseFloat(".01e+2"). Actual: ' + (parseFloat(.01e+2))); +} + +//CHECK#5 +if (parseFloat(-0) !== 0) { + $ERROR('#5: parseFloat(-0) === 0. Actual: ' + (parseFloat(-0))); +} else { + if (1 / parseFloat(-0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5: parseFloat(-0) === +0. Actual: ' + (parseFloat(-0))); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T3.js new file mode 100644 index 000000000..ea793257f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T3.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.2.3_A1_T3; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for undefined and null; +*/ + +//CHECK#1 +if (!(isNaN(parseFloat(undefined)) && isNaN(parseFloat("NaN")))) { + $ERROR('#1: parseFloat(undefined) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); +} + +//CHECK#2 +if (!(isNaN(parseFloat(null)) && isNaN(parseFloat("NaN")))) { + $ERROR('#2: parseFloat(null) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); +} + + +//CHECK#3 +if (String(parseFloat(undefined)) !== "NaN") { + $ERROR('#3: String(parseFloat(undefined)) === "NaN". Actual: ' + (String(parseFloat(undefined)))); +} + +//CHECK#4 +if (String(parseFloat(null)) !== "NaN") { + $ERROR('#4: String(parseFloat(null)) === "NaN". Actual: ' + (String(parseFloat(null)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T4.js new file mode 100644 index 000000000..033b76ad8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A1_T4; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for Boolean object; +*/ + +//CHECK#1 +if (!(isNaN(parseFloat(new Boolean(true))) && isNaN(parseFloat("NaN")))) { + $ERROR('#1: parseFloat(new Boolean(true)) === Not-a-Number; parseFloat("NaN") === Not-a-Number. Actual: ' + (parseFloat("NaN"))); +} + +//CHECK#2 +if (String(parseFloat(new Boolean(false))) !== "NaN") { + $ERROR('#2: String(parseFloat(new Boolean(false))) === "NaN". Actual: ' + (String(parseFloat(new Boolean(false))))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T5.js new file mode 100644 index 000000000..8604f1a43 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T5.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.2.3_A1_T5; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for Number object; +*/ + +//CHECK#1 +if (parseFloat(new Number(-1.1)) !== parseFloat("-1.1")) { + $ERROR('#1: parseFloat(new Number(-1.1)) === parseFloat("-1.1"). Actual: ' + (parseFloat(new Number(-1.1)))); +} + +//CHECK#2 +if (parseFloat(new Number(Infinity)) !== parseFloat("Infinity")) { + $ERROR('#2: parseFloat(new Number(Infinity)) === parseFloat("Infinity"). Actual: ' + (parseFloat(new Number(Infinity)))); +} + +//CHECK#3 +if (String(parseFloat(new Number(NaN))) !== "NaN") { + $ERROR('#3: String(parseFloat(new Number(NaN))) === "NaN". Actual: ' + (String(parseFloat(new Number(NaN))))); +} + +//CHECK#4 +if (parseFloat(new Number(.01e+2)) !== parseFloat(".01e+2")) { + $ERROR('#4: parseFloat(new Number(.01e+2)) === parseFloat(".01e+2"). Actual: ' + (parseFloat(new Number(.01e+2)))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T6.js new file mode 100644 index 000000000..dfc73b198 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A1_T6; + * @section: 15.1.2.3, 9.8; + * @assertion: Operator use ToString; + * @description: Checking for String object; +*/ + +//CHECK#1 +if (parseFloat(new String("-1.1")) !== parseFloat("-1.1")) { + $ERROR('#1: parseFloat(new String("-1.1")) === parseFloat("-1.1"). Actual: ' + (parseFloat(new String("-1.1")))); +} + +//CHECK#2 +if (parseFloat(new String("Infinity")) !== parseFloat("Infinity")) { + $ERROR('#2: parseFloat(new String("Infinity")) === parseFloat("Infinity"). Actual: ' + (parseFloat(new String("Infinity")))); +} + +//CHECK#3 +if (String(parseFloat(new String("NaN"))) !== "NaN") { + $ERROR('#3: String(parseFloat(new String("NaN"))) === "NaN". Actual: ' + (String(parseFloat(new String("NaN"))))); +} + +//CHECK#4 +if (parseFloat(new String(".01e+2")) !== parseFloat(".01e+2")) { + $ERROR('#4: parseFloat(new String(".01e+2")) === parseFloat(".01e+2"). Actual: ' + (parseFloat(new String(".01e+2")))); +} + +//CHECK#5 +if (String(parseFloat(new String("false"))) !== "NaN") { + $ERROR('#5: String(parseFloat(new String("false"))) === "NaN". Actual: ' + (String(parseFloat(new String("false"))))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T7.js new file mode 100644 index 000000000..2eab8eccb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A1_T7.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.2.3_A1_T7; + * @section: 15.1.2.3, 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 1}}; +if (isNaN(parseFloat(object)) !== true) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; parseFloat(object) === Not-a-Number. Actual: ' + (parseFloat(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (parseFloat(object) !== 0) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; parseFloat(object) === 0. Actual: ' + (parseFloat(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (parseFloat(object) !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + if (parseFloat(object) !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; parseFloat(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (parseFloat(object) !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (parseFloat(object) !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; parseFloat(object) === 1. Actual: ' + (parseFloat(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + parseFloat(object); + $ERROR('#7.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseFloat(object) throw "error". Actual: ' + (parseFloat(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; parseFloat(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + parseFloat(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseFloat(object) throw TypeError. Actual: ' + (parseFloat(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; parseFloat(object) 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.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T1.js new file mode 100644 index 000000000..a259bdd33 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A2_T1; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: TAB (U+0009); +*/ + +//CHECK#1 +if (parseFloat("\u00091.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u00091.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00091.1"))); +} + +//CHECK#2 +if (parseFloat("\u0009\u0009-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u0009\\u0009-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u0009\u0009-1.1"))); +} + +//CHECK#3 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + $ERROR('#3: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#4 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + $ERROR('#4: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#5 +if (parseFloat(" \u0009 \u0009-1.1") !== parseFloat("-1.1")) { + $ERROR('#5: parseFloat(" \\u0009 \\u0009-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat(" \u0009 \u0009-1.1"))); +} + +//CHECK#6 +if (isNaN(parseFloat("\u0009")) !== true) { + $ERROR('#6: parseFloat("\\u0009") === Not-a-Number. Actual: ' + (parseFloat("\u0009"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T10.js new file mode 100644 index 000000000..9fa2cb5c6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T10.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A2_T10; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: USP; +*/ + +//CHECK# +var count = 0; +var errorCount = 0; +var uspU = ["\u1680", "\u180E", "\u2000", "\u2001", "\u2002", "\u2003", "\u2004", "\u2005", "\u2006", "\u2007", "\u2008", "\u2009", "\u200A", "\u202F", "\u205F", "\u3000"]; +var uspS = ["1680", "180E", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "200A", "202F", "205F", "3000"]; +for (var index = 0; index < uspU.length; index++) { + var result = true; + if (parseFloat(uspU[index] + "1.1") !== parseFloat("1.1")) { + $ERROR('#1.' + uspS[index] + ' '); + result = false; + } + if (parseFloat(uspU[index] + uspU[index] + uspU[index] + "1.1") !== parseFloat("1.1")) { + $ERROR('#2.' + uspS[index] + ' '); + result = false; + } + if (isNaN(parseFloat(uspU[index])) !== true) { + $ERROR('#3.' + uspS[index] + ' '); + result = false; + } + if (result !== true) { + errorCount++; + } + count++; +} + +if (errorCount > 0) { + $ERROR('Total error: ' + errorCount + ' bad Unicode character in ' + count); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T2.js new file mode 100644 index 000000000..4c942ea1f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A2_T2; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: SP (U+0020); +*/ + +//CHECK#1 +if (parseFloat("\u00201.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u00201.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00201.1"))); +} + +//CHECK#2 +if (parseFloat("\u0020\u0020-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u0020\\u0020-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u0020\u0020-1.1"))); +} + +//CHECK#3 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + $ERROR('#3: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#4 +if (parseFloat(" 1.1") !== parseFloat("1.1")) { + $ERROR('#4: parseFloat(" 1.1") === parseFloat("1.1"). Actual: ' + (parseFloat(" 1.1"))); +} + +//CHECK#5 +if (parseFloat(" \u0020 \u0020-1.1") !== parseFloat("-1.1")) { + $ERROR('#5: parseFloat(" \\u0020 \\u0020-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat(" \u0020 \u0020-1.1"))); +} + +//CHECK#6 +if (isNaN(parseFloat("\u0020")) !== true) { + $ERROR('#6: parseFloat("\\u0020") === Not-a-Number. Actual: ' + (parseFloat("\u0020"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T3.js new file mode 100644 index 000000000..13d1eb022 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T3.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.2.3_A2_T3; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: NBSB (U+00A0); +*/ + +//CHECK#1 +if (parseFloat("\u00A01.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u00A01.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u00A01.1"))); +} + +//CHECK#2 +if (parseFloat("\u00A0\u00A0-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u00A0\\u00A0-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u00A0\u00A0-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u00A0")) !== true) { + $ERROR('#3: parseFloat("\\u00A0") === Not-a-Number. Actual: ' + (parseFloat("\u00A0"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T4.js new file mode 100644 index 000000000..494a1947e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T4.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.2.3_A2_T4; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: FF (U+000C); +*/ + +//CHECK#1 +if (parseFloat("\u000C1.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u000C1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000C1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000C\u000C-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u000C\\u000C-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000C\u000C-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u000C")) !== true) { + $ERROR('#3: parseFloat("\\u000C") === Not-a-Number. Actual: ' + (parseFloat("\u000C"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T5.js new file mode 100644 index 000000000..6b28ea1d1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T5.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.2.3_A2_T5; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: VT (U+000B); +*/ + +//CHECK#1 +if (parseFloat("\u000B1.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u000B1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000B1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000B\u000B-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u000B\\u000B-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000B\u000B-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u000B")) !== true) { + $ERROR('#3: parseFloat("\\u000B") === Not-a-Number. Actual: ' + (parseFloat("\u000B"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T6.js new file mode 100644 index 000000000..6c0aee42f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T6.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.2.3_A2_T6; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: CR (U+000D); +*/ + +//CHECK#1 +if (parseFloat("\u000D1.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u000D1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000D1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000D\u000D-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u000D\\u000D-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000D\u000D-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u000D")) !== true) { + $ERROR('#3: parseFloat("\\u000D") === Not-a-Number. Actual: ' + (parseFloat("\u000D"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T7.js new file mode 100644 index 000000000..30e3dcb24 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T7.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.2.3_A2_T7; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: LF (U+000A); +*/ + +//CHECK#1 +if (parseFloat("\u000A1.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u000A1.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u000A1.1"))); +} + +//CHECK#2 +if (parseFloat("\u000A\u000A-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u000A\\u000A-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u000A\u000A-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u000A")) !== true) { + $ERROR('#3: parseFloat("\\u000A") === Not-a-Number. Actual: ' + (parseFloat("\u000A"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T8.js new file mode 100644 index 000000000..648e19e2a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T8.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.2.3_A2_T8; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: LS (U+2028); +*/ + +//CHECK#1 +if (parseFloat("\u20281.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u20281.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u20281.1"))); +} + +//CHECK#2 +if (parseFloat("\u2028\u2028-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u2028\\u2028-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u2028\u2028-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u2028")) !== true) { + $ERROR('#3: parseFloat("\\u2028") === Not-a-Number. Actual: ' + (parseFloat("\u2028"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T9.js new file mode 100644 index 000000000..4802ad16b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A2_T9.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.2.3_A2_T9; + * @section: 15.1.2.3; + * @assertion: Operator remove leading StrWhiteSpaceChar; + * @description: StrWhiteSpaceChar :: PS (U+2029); +*/ + +//CHECK#1 +if (parseFloat("\u20291.1") !== parseFloat("1.1")) { + $ERROR('#1: parseFloat("\\u20291.1") === parseFloat("1.1"). Actual: ' + (parseFloat("\u20291.1"))); +} + +//CHECK#2 +if (parseFloat("\u2029\u2029-1.1") !== parseFloat("-1.1")) { + $ERROR('#2: parseFloat("\\u2029\\u2029-1.1") === parseFloat("-1.1"). Actual: ' + (parseFloat("\u2029\u2029-1.1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("\u2029")) !== true) { + $ERROR('#3: parseFloat("\\u2029") === Not-a-Number. Actual: ' + (parseFloat("\u2029"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T1.js new file mode 100644 index 000000000..5e7bcb81e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A3_T1; + * @section: 15.1.2.3, 9.3.1; + * @assertion: If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + * StrDecimalLiteral (see 9.3.1), return NaN; + * @description: parseFloat("some string") return NaN; +*/ + +//CHECK#1 +if (isNaN(parseFloat("str")) !== true) { + $ERROR('#1: parseFloat("str") === Not-a-Number. Actual: ' + (parseFloat("str"))); +} + +//CHECK#2 +if (isNaN(parseFloat("s1")) !== true) { + $ERROR('#2: parseFloat("s1") === Not-a-Number. Actual: ' + (parseFloat("s1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("")) !== true) { + $ERROR('#3: parseFloat("") === Not-a-Number. Actual: ' + (parseFloat(""))); +} + +//CHECK#4 +if (String(parseFloat("str")) !== "NaN") { + $ERROR('#4: String(parseFloat("str")) === "NaN". Actual: ' + (String(parseFloat("str")))); +} + +//CHECK#5 +if (String(parseFloat("s1")) !== "NaN") { + $ERROR('#5: String(parseFloat("s1")) === "NaN". Actual: ' + (String(parseFloat("s1")))); +} + +//CHECK#6 +if (String(parseFloat("")) !== "NaN") { + $ERROR('#6: String(parseFloat("")) === "NaN". Actual: ' + (String(parseFloat("")))); +} + +//CHECK#7 +if (String(parseFloat("+")) !== "NaN") { + $ERROR('#7: String(parseFloat("+")) === "NaN". Actual: ' + (String(parseFloat("+")))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T2.js new file mode 100644 index 000000000..8e3c91b23 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T2.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A3_T2; + * @section: 15.1.2.3, 9.3.1; + * @assertion: If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + * StrDecimalLiteral (see 9.3.1), return NaN; + * @description: parseFloat("wrong number format with ExponentIndicator") return NaN; +*/ + +//CHECK#1 +if (isNaN(parseFloat("e1")) !== true) { + $ERROR('#1: parseFloat("e1") === Not-a-Number. Actual: ' + (parseFloat("e1"))); +} + +//CHECK#2 +if (isNaN(parseFloat("e-1")) !== true) { + $ERROR('#2: parseFloat("e-1") === Not-a-Number. Actual: ' + (parseFloat("e-1"))); +} + +//CHECK#3 +if (isNaN(parseFloat("E+1")) !== true) { + $ERROR('#3: parseFloat("E+1") === Not-a-Number. Actual: ' + (parseFloat("E+1"))); +} + +//CHECK#4 +if (isNaN(parseFloat("E0")) !== true) { + $ERROR('#4: parseFloat("E0") === Not-a-Number. Actual: ' + (parseFloat("E0"))); +} + +//CHECK#5 +if (String(parseFloat("e1")) !== "NaN") { + $ERROR('#5: String(parseFloat("e1")) === "NaN". Actual: ' + (String(parseFloat("e1")))); +} + +//CHECK#6 +if (String(parseFloat("e-1")) !== "NaN") { + $ERROR('#6: String(parseFloat("e-1")) === "NaN". Actual: ' + (String(parseFloat("e-1")))); +} + +//CHECK#7 +if (String(parseFloat("E+1")) !== "NaN") { + $ERROR('#73: String(parseFloat("E+1")) === "NaN". Actual: ' + (String(parseFloat("E+1")))); +} + +//CHECK#8 +if (String(parseFloat("E0")) !== "NaN") { + $ERROR('#8: String(parseFloat("E0")) === "NaN". Actual: ' + (String(parseFloat("E0")))); +} + +//CHECK#9 +if (isNaN(parseFloat("-.e-1")) !== true) { + $ERROR('#9: parseFloat("-.e-1") === Not-a-Number. Actual: ' + (parseFloat("-.e-1"))); +} + +//CHECK#10 +if (isNaN(parseFloat(".e1")) !== true) { + $ERROR('#10: parseFloat(".e1") === Not-a-Number. Actual: ' + (parseFloat(".e1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T3.js new file mode 100644 index 000000000..cfa374acf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A3_T3.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A3_T3; + * @section: 15.1.2.3, 9.3.1; + * @assertion: If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a + * StrDecimalLiteral (see 9.3.1), return NaN; + * @description: parseFloat("wrong numbr format") return NaN; +*/ + +//CHECK#1 +if (isNaN(parseFloat(".x")) !== true) { + $ERROR('#1: parseFloat(".x") === Not-a-Number. Actual: ' + (parseFloat(".x"))); +} + +//CHECK#2 +if (isNaN(parseFloat("+x")) !== true) { + $ERROR('#2: parseFloat("+x") === Not-a-Number. Actual: ' + (parseFloat("+x"))); +} + +//CHECK#3 +if (isNaN(parseFloat("infinity")) !== true) { + $ERROR('#3: parseFloat("infinity") === Not-a-Number. Actual: ' + (parseFloat("infinity"))); +} + +//CHECK#4 +if (isNaN(parseFloat("A")) !== true) { + $ERROR('#4: parseFloat("A") === Not-a-Number. Actual: ' + (parseFloat("A"))); +} + +//CHECK#5 +if (String(parseFloat(".s")) !== "NaN") { + $ERROR('#5: String(parseFloat(".s")) === "NaN". Actual: ' + (String(parseFloat(".s")))); +} + +//CHECK#6 +if (String(parseFloat("+x")) !== "NaN") { + $ERROR('#6: String(parseFloat("+x")) === "NaN". Actual: ' + (String(parseFloat("+x")))); +} + +//CHECK#7 +if (String(parseFloat("infinity")) !== "NaN") { + $ERROR('#73: String(parseFloat("infinity")) === "NaN". Actual: ' + (String(parseFloat("infinity")))); +} + +//CHECK#8 +if (String(parseFloat("A")) !== "NaN") { + $ERROR('#8: String(parseFloat("A")) === "NaN". Actual: ' + (String(parseFloat("A")))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T1.js new file mode 100644 index 000000000..70b3f930c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T1; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: Some wrong number; +*/ + +//CHECK#1 +if (parseFloat("0x") !== 0) { + $ERROR('#1: parseFloat("0x") === 0. Actual: ' + (parseFloat("0x"))); +} + +//CHECK#2 +if (parseFloat("11x") !== 11) { + $ERROR('#2: parseFloat("11x") === 11. Actual: ' + (parseFloat("11x"))); +} + +//CHECK#3 +if (parseFloat("11s1") !== 11) { + $ERROR('#3: parseFloat("11s1") === 11. Actual: ' + (parseFloat("11s1"))); +} + +//CHECK#4 +if (parseFloat("11.s1") !== 11) { + $ERROR('#4: parseFloat("11.s1") === 11. Actual: ' + (parseFloat("11.s1"))); +} + +//CHECK#5 +if (parseFloat(".0s1") !== 0) { + $ERROR('#5: parseFloat(".0s1") === 0. Actual: ' + (parseFloat(".0s1"))); +} + +//CHECK#6 +if (parseFloat("1.s1") !== 1) { + $ERROR('#6: parseFloat("1.s1") === 1. Actual: ' + (parseFloat("1.s1"))); +} + +//CHECK#7 +if (parseFloat("1..1") !== 1) { + $ERROR('#7: parseFloat("1..1") === 1. Actual: ' + (parseFloat("1..1"))); +} + +//CHECK#8 +if (parseFloat("0.1.1") !== 0.1) { + $ERROR('#8: parseFloat("0.1.1") === 0.1. Actual: ' + (parseFloat("0.1.1"))); +} + +//CHECK#9 +if (parseFloat("0. 1") !== 0) { + $ERROR('#9: parseFloat("0. 1") === 0. Actual: ' + (parseFloat("0. 1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T2.js new file mode 100644 index 000000000..612c8197c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T2; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: With ExponentIndicator; +*/ + +//CHECK#1 +if (parseFloat("1ex") !== 1) { + $ERROR('#1: parseFloat("1ex") === 1. Actual: ' + (parseFloat("1ex"))); +} + +//CHECK#2 +if (parseFloat("1e-x") !== 1) { + $ERROR('#2: parseFloat("1e-x") === 1. Actual: ' + (parseFloat("1e-x"))); +} + +//CHECK#3 +if (parseFloat("1e1x") !== 10) { + $ERROR('#3: parseFloat("1e1x") === 10. Actual: ' + (parseFloat("1e1x"))); +} + +//CHECK#4 +if (parseFloat("1e-1x") !== 0.1) { + $ERROR('#4: parseFloat("1e-1x") === 0.1. Actual: ' + (parseFloat("1e-1x"))); +} + +//CHECK#5 +if (parseFloat("0.1e-1x") !== 0.01) { + $ERROR('#5: parseFloat("0.1e-1x") === 0.01. Actual: ' + (parseFloat("0.1e-1x"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T3.js new file mode 100644 index 000000000..d24c6e6ad --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T3.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.2.3_A4_T3; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: StrDecimalLiteral not contain HexIntegerLiteral; +*/ + +//CHECK#0 +if (parseFloat("0x0") !== 0) { + $ERROR('#0: parseFloat("0x0") === 0. Actual: ' + (parseFloat("0x0"))); +} + +//CHECK#1 +if (parseFloat("0x1") !== 0) { + $ERROR('#1: parseFloat("0x1") === 0. Actual: ' + (parseFloat("0x1"))); +} + +//CHECK#2 +if (parseFloat("0x2") !== 0) { + $ERROR('#2: parseFloat("0x2") === 0. Actual: ' + (parseFloat("0x2"))); +} + +//CHECK#3 +if (parseFloat("0x3") !== 0) { + $ERROR('#3: parseFloat("0x3") === 0. Actual: ' + (parseFloat("0x3"))); +} + +//CHECK#4 +if (parseFloat("0x4") !== 0) { + $ERROR('#4: parseFloat("0x4") === 0. Actual: ' + (parseFloat("0x4"))); +} + +//CHECK#5 +if (parseFloat("0x5") !== 0) { + $ERROR('#5: parseFloat("0x5") === 0. Actual: ' + (parseFloat("0x5"))); +} + +//CHECK#6 +if (parseFloat("0x6") !== 0) { + $ERROR('#6: parseFloat("0x6") === 0. Actual: ' + (parseFloat("0x6"))); +} + +//CHECK#7 +if (parseFloat("0x7") !== 0) { + $ERROR('#7: parseFloat("0x7") === 0. Actual: ' + (parseFloat("0x7"))); +} + +//CHECK#8 +if (parseFloat("0x8") !== 0) { + $ERROR('#8: parseFloat("0x8") === 0. Actual: ' + (parseFloat("0x8"))); +} + +//CHECK#9 +if (parseFloat("0x9") !== 0) { + $ERROR('#9: parseFloat("0x9") === 0. Actual: ' + (parseFloat("0x9"))); +} + +//CHECK#A +if (parseFloat("0xA") !== 0) { + $ERROR('#A: parseFloat("0xA") === 0. Actual: ' + (parseFloat("0xA"))); +} + +//CHECK#B +if (parseFloat("0xB") !== 0) { + $ERROR('#B: parseFloat("0xB") === 0. Actual: ' + (parseFloat("0xB"))); +} + +//CHECK#C +if (parseFloat("0xC") !== 0) { + $ERROR('#C: parseFloat("0xC") === 0. Actual: ' + (parseFloat("0xC"))); +} + +//CHECK#D +if (parseFloat("0xD") !== 0) { + $ERROR('#D: parseFloat("0xD") === 0. Actual: ' + (parseFloat("0xD"))); +} + +//CHECK#E +if (parseFloat("0xE") !== 0) { + $ERROR('#E: parseFloat("0xE") === 0. Actual: ' + (parseFloat("0xE"))); +} + +//CHECK#F +if (parseFloat("0xF") !== 0) { + $ERROR('#F: parseFloat("0xF") === 0. Actual: ' + (parseFloat("0xF"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T4.js new file mode 100644 index 000000000..19b434f51 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T4.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T4; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: "Infinity"+"some string"; +*/ + +//CHECK#1 +if (parseFloat("Infinity1") !== Number.POSITIVE_INFINITY) { + $ERROR('#1: parseFloat("Infinity1") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity1"))); +} + +//CHECK#2 +if (parseFloat("Infinityx") !== Number.POSITIVE_INFINITY) { + $ERROR('#2: parseFloat("Infinityx") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinityx"))); +} + +//CHECK#3 +if (parseFloat("Infinity+1") !== Number.POSITIVE_INFINITY) { + $ERROR('#3: parseFloat("Infinity+1") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity+1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T5.js new file mode 100644 index 000000000..510df03a4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T5.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T5; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: Checking DecimalDigits . DecimalDigits_opt ExponentPart_opt; +*/ + +//CHECK#1 +if (parseFloat("-11.string") !== -11) { + $ERROR('#1: parseFloat("-11.string") === -11. Actual: ' + (parseFloat("-11.string"))); +} + +//CHECK#2 +if (parseFloat("01.string") !== 1) { + $ERROR('#2: parseFloat("01.string") === 1. Actual: ' + (parseFloat("01.string"))); +} + +//CHECK#3 +if (parseFloat("+11.1string") !== 11.1) { + $ERROR('#3: parseFloat("+11.1string") === 11.1. Actual: ' + (parseFloat("+11.1string"))); +} + +//CHECK#4 +if (parseFloat("01.1string") !== 1.1) { + $ERROR('#4: parseFloat("01.1string") === 1.1. Actual: ' + (parseFloat("01.1string"))); +} + +//CHECK#5 +if (parseFloat("-11.e-1string") !== -1.1) { + $ERROR('#5: parseFloat("-11.e-1string") === -1.1. Actual: ' + (parseFloat("-11.e-1string"))); +} + +//CHECK#6 +if (parseFloat("01.e1string") !== 10) { + $ERROR('#6: parseFloat("01.e1string") === 10. Actual: ' + (parseFloat("01.e1string"))); +} + +//CHECK#7 +if (parseFloat("+11.22e-1string") !== 1.122) { + $ERROR('#7: parseFloat("+11.22e-1string") === 1.122. Actual: ' + (parseFloat("+11.22e-1string"))); +} + +//CHECK#8 +if (parseFloat("01.01e1string") !== 10.1) { + $ERROR('#8: parseFloat("01.01e1string") === 10.1. Actual: ' + (parseFloat("01.01e1string"))); +} + +//CHECK#9 +if (parseFloat("001.string") !== 1) { + $ERROR('#9: parseFloat("001.string") === 1. Actual: ' + (parseFloat("001.string"))); +} + +//CHECK#10 +if (parseFloat("010.string") !== 10) { + $ERROR('#10: parseFloat("010.string") === 10. Actual: ' + (parseFloat("010.string"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T6.js new file mode 100644 index 000000000..d707c8e0a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T6.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T6; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: Checking . DecimalDigits ExponentPart_opt; +*/ + + +//CHECK#1 +if (parseFloat("+.1string") !== 0.1) { + $ERROR('#1: parseFloat("+.1string") === 0.1. Actual: ' + (parseFloat("+.1string"))); +} + +//CHECK#2 +if (parseFloat(".01string") !== 0.01) { + $ERROR('#2: parseFloat(".01string") === 0.01. Actual: ' + (parseFloat(".01string"))); +} + +//CHECK#3 +if (parseFloat("+.22e-1string") !== 0.022) { + $ERROR('#3: parseFloat("+.22e-1string") === 0.022. Actual: ' + (parseFloat("+.22e-1string"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T7.js new file mode 100644 index 000000000..bd2e9a62b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A4_T7.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A4_T7; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Compute the longest prefix of Result(2), which might be Result(2) itself, + * which satisfies the syntax of a StrDecimalLiteral; + * @description: Checking DecimalDigits ExponentPart_opt; +*/ + +//CHECK#1 +if (parseFloat("-11string") !== -11) { + $ERROR('#1: parseFloat("-11string") === -11. Actual: ' + (parseFloat("-11string"))); +} + +//CHECK#2 +if (parseFloat("01string") !== 1) { + $ERROR('#2: parseFloat("01string") === 1. Actual: ' + (parseFloat("01string"))); +} + +//CHECK#3 +if (parseFloat("-11e-1string") !== -1.1) { + $ERROR('#3: parseFloat("-11e-1string") === -1.1. Actual: ' + (parseFloat("-11e-1string"))); +} + +//CHECK#4 +if (parseFloat("01e1string") !== 10) { + $ERROR('#4: parseFloat("01e1string") === 10. Actual: ' + (parseFloat("01e1string"))); +} + +//CHECK#5 +if (parseFloat("001string") !== 1) { + $ERROR('#5: parseFloat("001string") === 1. Actual: ' + (parseFloat("001string"))); +} + +//CHECK#6 +if (parseFloat("1e001string") !== 10) { + $ERROR('#6: parseFloat("1e001string") === 10. Actual: ' + (parseFloat("1e001string"))); +} + +//CHECK#7 +if (parseFloat("010string") !== 10) { + $ERROR('#7: parseFloat("010string") === 10. Actual: ' + (parseFloat("010string"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T1.js new file mode 100644 index 000000000..3e526bbf3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_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.2.3_A5_T1; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Return the number value for the MV of Result(4); + * @description: Checking Infinity; +*/ + +//CHECK#1 +if (parseFloat("Infinity") !== Number.POSITIVE_INFINITY) { + $ERROR('#1: parseFloat("Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity"))); +} + +//CHECK#2 +if (parseFloat("+Infinity") !== Number.POSITIVE_INFINITY) { + $ERROR('#2: parseFloat("+Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("+Infinity"))); +} + +//CHECK#3 +if (parseFloat("-Infinity") !== Number.NEGATIVE_INFINITY) { + $ERROR('#3: parseFloat("-Infinity") === Number.NEGATIVE_INFINITY. Actual: ' + (parseFloat("-Infinity"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T2.js new file mode 100644 index 000000000..d7b94c3c8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T2.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A5_T2; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Return the number value for the MV of Result(4); + * @description: Checking DecimalDigits . DecimalDigits_opt ExponentPart_opt; +*/ + +//CHECK#1 +if (parseFloat("-11.") !== -11) { + $ERROR('#1: parseFloat("-11.") === -11. Actual: ' + (parseFloat("-11."))); +} + +//CHECK#2 +if (parseFloat("01.") !== 1) { + $ERROR('#2: parseFloat("01.") === 1. Actual: ' + (parseFloat("01."))); +} + +//CHECK#3 +if (parseFloat("+11.1") !== 11.1) { + $ERROR('#3: parseFloat("+11.1") === 11.1. Actual: ' + (parseFloat("+11.1"))); +} + +//CHECK#4 +if (parseFloat("01.1") !== 1.1) { + $ERROR('#4: parseFloat("01.1") === 1.1. Actual: ' + (parseFloat("01.1"))); +} + +//CHECK#5 +if (parseFloat("-11.e-1") !== -1.1) { + $ERROR('#5: parseFloat("-11.e-1") === -1.1. Actual: ' + (parseFloat("-11.e-1"))); +} + +//CHECK#6 +if (parseFloat("01.e1") !== 10) { + $ERROR('#6: parseFloat("01.e1") === 10. Actual: ' + (parseFloat("01.e1"))); +} + +//CHECK#7 +if (parseFloat("+11.22e-1") !== 1.122) { + $ERROR('#7: parseFloat("+11.22e-1") === 1.122. Actual: ' + (parseFloat("+11.22e-1"))); +} + +//CHECK#8 +if (parseFloat("01.01e1") !== 10.1) { + $ERROR('#8: parseFloat("01.01e1") === 10.1. Actual: ' + (parseFloat("01.01e1"))); +} + +//CHECK#9 +if (parseFloat("001.") !== 1) { + $ERROR('#9: parseFloat("001.") === 1. Actual: ' + (parseFloat("001."))); +} + +//CHECK#10 +if (parseFloat("010.") !== 10) { + $ERROR('#10: parseFloat("010.") === 10. Actual: ' + (parseFloat("010."))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T3.js new file mode 100644 index 000000000..a6629049a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A5_T3; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Return the number value for the MV of Result(4); + * @description: Checking . DecimalDigits ExponentPart_opt; +*/ + + +//CHECK#1 +if (parseFloat("+.1") !== 0.1) { + $ERROR('#1: parseFloat("+.1") === 0.1. Actual: ' + (parseFloat("+.1"))); +} + +//CHECK#2 +if (parseFloat(".01") !== 0.01) { + $ERROR('#2: parseFloat(".01") === 0.01. Actual: ' + (parseFloat(".01"))); +} + +//CHECK#3 +if (parseFloat("+.22e-1") !== 0.022) { + $ERROR('#3: parseFloat("+.22e-1") === 0.022. Actual: ' + (parseFloat("+.22e-1"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T4.js new file mode 100644 index 000000000..b0fef7c1c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A5_T4.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.3_A5_T4; + * @section: 15.1.2.3, 9.3.1; + * @assertion: Return the number value for the MV of Result(4); + * @description: Checking DecimalDigits ExponentPart_opt; +*/ + +//CHECK#1 +if (parseFloat("-11") !== -11) { + $ERROR('#1: parseFloat("-11") === -11. Actual: ' + (parseFloat("-11"))); +} + +//CHECK#2 +if (parseFloat("01") !== 1) { + $ERROR('#2: parseFloat("01") === 1. Actual: ' + (parseFloat("01"))); +} + +//CHECK#3 +if (parseFloat("-11e-1") !== -1.1) { + $ERROR('#3: parseFloat("-11e-1") === -1.1. Actual: ' + (parseFloat("-11e-1"))); +} + +//CHECK#4 +if (parseFloat("01e1") !== 10) { + $ERROR('#4: parseFloat("01e1") === 10. Actual: ' + (parseFloat("01e1"))); +} + +//CHECK#5 +if (parseFloat("001") !== 1) { + $ERROR('#5: parseFloat("001") === 1. Actual: ' + (parseFloat("001"))); +} + +//CHECK#6 +if (parseFloat("1e001") !== 10) { + $ERROR('#6: parseFloat("1e001") === 10. Actual: ' + (parseFloat("1e001"))); +} + +//CHECK#7 +if (parseFloat("010") !== 10) { + $ERROR('#7: parseFloat("010") === 10. Actual: ' + (parseFloat("010"))); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A6.js new file mode 100644 index 000000000..361060a9c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A6.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.2.3_A6; + * @section: 15.1.2.3, 9.3.1; + * @assertion: parseFloat may interpret only a leading portion of the string as + * a number value; it ignores any characters that cannot be interpreted as part + * of the notation of an decimal literal, and no indication is given that any such + * characters were ignored. + * @description: Complex test without eval; +*/ + +//CHECK +var errorCount = 0; +var count = 0; +var indexP; +var indexO = 0; +for (var index = 0; index <= 65535; index++) { + if ((index < 0x0030) || (index > 0x0039)) { + var hex = decimalToHexString(index); + if (parseFloat("0.1e1" + String.fromCharCode(index)) !== 1) { + if (indexO === 0) { + indexO = index; + } 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++; + } + count++; + } +} + +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.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.1.js new file mode 100644 index 000000000..4e896241f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.1; + * @section: 15.1.2.3, 15.2.4.7, 12.6.4; + * @assertion: The length property of parseFloat has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (parseFloat.propertyIsEnumerable('length') !== false) { + $ERROR('#1: parseFloat.propertyIsEnumerable(\'length\') === false. Actual: ' + (parseFloat.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (var p in parseFloat){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in parseFloat) { 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.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.2.js new file mode 100644 index 000000000..93482ebf5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.2.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.2.3_A7.2; + * @section: 15.1.2.3, 15.2.4.5, 11.4.1; + * @assertion: The length property of parseFloat has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; + * @strict_mode_negative +*/ + +//CHECK#1 +if (parseFloat.hasOwnProperty('length') !== true) { + $FAIL('#1: parseFloat.hasOwnProperty(\'length\') === true. Actual: ' + (parseFloat.hasOwnProperty('length'))); +} + +delete parseFloat.length; + +//CHECK#2 +if (parseFloat.hasOwnProperty('length') !== true) { + $ERROR('#2: delete parseFloat.length; parseFloat.hasOwnProperty(\'length\') === true. Actual: ' + (parseFloat.hasOwnProperty('length'))); +} + +//CHECK#3 +if (parseFloat.length === undefined) { + $ERROR('#3: delete parseFloat.length; parseFloat.length !== undefined'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.3.js new file mode 100644 index 000000000..b08cc1ca1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.3; + * @section: 15.1.2.3; + * @assertion: The length property of parseFloat has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +var x = parseFloat.length; +parseFloat.length = Infinity; +if (parseFloat.length !== x) { + $ERROR('#1: x = parseFloat.length; parseFloat.length = Infinity; parseFloat.length === x. Actual: ' + (parseFloat.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.4.js new file mode 100644 index 000000000..b955f7127 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.4; + * @section: 15.1.2.3; + * @assertion: The length property of parseFloat is 1; + * @description: parseFloat.length === 1; +*/ + +//CHECK#1 +if (parseFloat.length !== 1) { + $ERROR('#1: parseFloat.length === 1. Actual: ' + (parseFloat.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.5.js new file mode 100644 index 000000000..d2f4fe176 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.5; + * @section: 15.1.2.3, 15.2.4.7, 12.6.4; + * @assertion: The parseFloat property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('parseFloat') !== false) { + $ERROR('#1:this.propertyIsEnumerable(\'parseFloat\') === false. Actual: ' + (this.propertyIsEnumerable('parseFloat'))); +} + +//CHECK#2 +var result = true; +for (var p in this){ + if (p === "parseFloat") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "parseFloat") 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.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.6.js new file mode 100644 index 000000000..192650f8b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.6; +* @section: 15.1.2.3; +* @assertion: The parseFloat property has not prototype property; +* @description: Checking parseFloat.prototype; +*/ + +//CHECK#1 +if (parseFloat.prototype !== undefined) { + $ERROR('#1: parseFloat.prototype === undefined. Actual: ' + (parseFloat.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.7.js new file mode 100644 index 000000000..e3d902adc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.3_parseFloat/S15.1.2.3_A7.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.2.3_A7.7; +* @section: 15.1.2.3, 11.2.2; +* @assertion: The parseFloat 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 parseFloat(); + $ERROR('#1.1: new parseFloat() throw TypeError. Actual: ' + (new parseFloat())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new parseFloat() 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.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T1.js new file mode 100644 index 000000000..b426c645e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T1.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.4_A1_T1; + * @section: 15.1.2.4; + * @assertion: isNaN applies ToNumber to its argument, then return true if the result is NaN, and otherwise return false; + * @description: Checking all primitive; +*/ + +// CHECK#1 +if (!(isNaN(NaN) === true)) { + $ERROR('#1: NaN === Not-a-Number. Actual: ' + (NaN)); +} + +// CHECK#2 +if (!(isNaN(Number.NaN) === true)) { + $ERROR('#2: Number.NaN === Not-a-Number. Actual: ' + (Number.NaN)); +} + +// CHECK#3 +if (!(isNaN(Number(void 0)) === true)) { + $ERROR('#3: Number(void 0) === Not-a-Number. Actual: ' + (Number(void 0))); +} + +// CHECK#4 +if (!(isNaN(void 0) === true)) { + $ERROR('#4: void 0 === Not-a-Number. Actual: ' + (void 0)); +} + +// CHECK#5 +if (!(isNaN("string") === true)) { + $ERROR('#5: "string" === Not-a-Number. Actual: ' + ("string")); +} + +// CHECK#6 +if (isNaN(Number.POSITIVE_INFINITY) === true) { + $ERROR('#6: Number.POSITIVE_INFINITY !== Not-a-Number'); +} + +// CHECK#7 +if (isNaN(Number.NEGATIVE_INFINITY) === true) { + $ERROR('#7: Number.NEGATIVE_INFINITY !== Not-a-Number'); +} + +// CHECK#8 +if (isNaN(Number.MAX_VALUE) === true) { + $ERROR('#8: Number.MAX_VALUE !== Not-a-Number'); +} + +// CHECK#9 +if (isNaN(Number.MIN_VALUE) === true) { + $ERROR('#9: Number.MIN_VALUE !== Not-a-Number'); +} + +// CHECK#10 +if (isNaN(-0) === true) { + $ERROR('#10: -0 !== Not-a-Number'); +} + +// CHECK#11 +if (isNaN(true) === true) { + $ERROR('#11: true !== Not-a-Number'); +} + +// CHECK#12 +if (isNaN("1") === true) { + $ERROR('#12: "1" !== Not-a-Number'); +} + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T2.js new file mode 100644 index 000000000..6be2762bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A1_T2.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.4_A1_T2; + * @section: 15.1.2.4; + * @assertion: isNaN applies ToNumber to its argument, then return true if the result is NaN, and otherwise return false; + * @description: Checking all object; +*/ + +// CHECK#1 +if (!(isNaN({}) === true)) { + $ERROR('#1: {} === Not-a-Number. Actual: ' + ({})); +} + +// CHECK#2 +if (!(isNaN(new String("string")) === true)) { + $ERROR('#2: new String("string") === Not-a-Number. Actual: ' + (new String("string"))); +} + +// CHECK#3 +if (isNaN(new String("1")) === true) { + $ERROR('#3: new String("1") === Not-a-Number. Actual: ' + (new String("1"))); +} + +// CHECK#4 +if (isNaN(new Number(1)) === true) { + $ERROR('#4: new Number(1) !== Not-a-Number'); +} + +// CHECK#5 +if (!(isNaN(new Number(NaN)) === true)) { + $ERROR('#5: new Number(NaN) === Not-a-Number. Actual: ' + (new Number(NaN))); +} + +// CHECK#6 +if (isNaN(new Boolean(true)) === true) { + $ERROR('#6: new Boolean(true) !== Not-a-Number'); +} + + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.1.js new file mode 100644 index 000000000..c8bf95da2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.1; + * @section: 15.1.2.4, 15.2.4.7, 12.6.4; + * @assertion: The length property of isNaN has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (isNaN.propertyIsEnumerable('length') !== false) { + $ERROR('#1: isNaN.propertyIsEnumerable(\'length\') === false. Actual: ' + (isNaN.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (p in isNaN){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in isNaN) { 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.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.2.js new file mode 100644 index 000000000..37992570e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.2.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.2.4_A2.2; + * @section: 15.1.2.4, 15.2.4.5, 11.4.1; + * @assertion: The length property of isNaN has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; + * @strict_mode_negative +*/ + +//CHECK#1 +if (isNaN.hasOwnProperty('length') !== true) { + $FAIL('#1: isNaN.hasOwnProperty(\'length\') === true. Actual: ' + (isNaN.hasOwnProperty('length'))); +} + +delete isNaN.length; + +//CHECK#2 +if (isNaN.hasOwnProperty('length') !== true) { + $ERROR('#2: delete isNaN.length; isNaN.hasOwnProperty(\'length\') === true. Actual: ' + (isNaN.hasOwnProperty('length'))); +} + +//CHECK#3 +if (isNaN.length === undefined) { + $ERROR('#3: delete isNaN.length; isNaN.length !== undefined'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.3.js new file mode 100644 index 000000000..0e8f44fc7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.3; + * @section: 15.1.2.4; + * @assertion: The length property of isNaN has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +x = isNaN.length; +isNaN.length = Infinity; +if (isNaN.length !== x) { + $ERROR('#1: x = isNaN.length; isNaN.length = Infinity; isNaN.length === x. Actual: ' + (isNaN.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.4.js new file mode 100644 index 000000000..48af19758 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.4; + * @section: 15.1.2.4; + * @assertion: The length property of isNaN is 1; + * @description: isNaN.length === 1; +*/ + +//CHECK#1 +if (isNaN.length !== 1) { + $ERROR('#1: isNaN.length === 1. Actual: ' + (isNaN.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.5.js new file mode 100644 index 000000000..e42438535 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.5; + * @section: 15.1.2.4, 15.2.4.7, 12.6.4; + * @assertion: The isNaN property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('isNaN') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'isNaN\') === false. Actual: ' + (this.propertyIsEnumerable('isNaN'))); +} + +//CHECK#2 +var result = true; +for (p in this){ + if (p === "isNaN") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "isNaN") 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.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.6.js new file mode 100644 index 000000000..f1595ffb7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.6; +* @section: 15.1.2.4; +* @assertion: The isNaN property has not prototype property; +* @description: Checking isNaN.prototype; +*/ + +//CHECK#1 +if (isNaN.prototype !== undefined) { + $ERROR('#1: isNaN.prototype === undefined. Actual: ' + (isNaN.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.7.js new file mode 100644 index 000000000..844d8db5c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.4_isNaN/S15.1.2.4_A2.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.2.4_A2.7; +* @section: 15.1.2.4, 11.2.2; +* @assertion: The isNaN 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 isNaN(); + $ERROR('#1.1: new isNaN() throw TypeError. Actual: ' + (new isNaN())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new isNaN() 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.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T1.js new file mode 100644 index 000000000..3c7a0744c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T1.js @@ -0,0 +1,69 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.5_A1_T1; + * @section: 15.1.2.5; + * @assertion: isFinite applies ToNumber to its argument, then return false if the result is NaN, +Infinity, -Infinity, and otherwise return true; + * @description: Checking all primitive; +*/ + +// CHECK#1 +if (!(isFinite(NaN) === false)) { + $ERROR('#1: NaN === Not-a-Finite. Actual: ' + (NaN)); +} + +// CHECK#2 +if (!(isFinite(Number.NaN) === false)) { + $ERROR('#2: Number.NaN === Not-a-Finite. Actual: ' + (Number.NaN)); +} + +// CHECK#3 +if (!(isFinite(Number(void 0)) === false)) { + $ERROR('#3: Number(void 0) === Not-a-Finite. Actual: ' + (Number(void 0))); +} + +// CHECK#4 +if (!(isFinite(void 0) === false)) { + $ERROR('#4: void 0 === Not-a-Finite. Actual: ' + (void 0)); +} + +// CHECK#5 +if (!(isFinite("string") === false)) { + $ERROR('#5: "string" === Not-a-Finite. Actual: ' + ("string")); +} + +// CHECK#6 +if (isFinite(Number.POSITIVE_INFINITY) !== false) { + $ERROR('#6: Number.POSITIVE_INFINITY === Not-a-Finite. Actual: ' + (Number.POSITIVE_INFINITY)); +} + +// CHECK#7 +if (isFinite(Number.NEGATIVE_INFINITY) !== false) { + $ERROR('#7: Number.NEGATIVE_INFINITY === Not-a-Finite. Actual: ' + (Number.NEGATIVE_INFINITY)); +} + +// CHECK#8 +if (isFinite(Number.MAX_VALUE) === false) { + $ERROR('#8: Number.MAX_VALUE !== Not-a-Finite'); +} + +// CHECK#9 +if (isFinite(Number.MIN_VALUE) === false) { + $ERROR('#9: Number.MIN_VALUE !== Not-a-Finite'); +} + +// CHECK#10 +if (isFinite(-0) === false) { + $ERROR('#10: -0 !== Not-a-Finite'); +} + +// CHECK#11 +if (isFinite(false) === false) { + $ERROR('#11: false !== Not-a-Finite'); +} + +// CHECK#12 +if (isFinite("1") === false) { + $ERROR('#12: "1" !== Not-a-Finite'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T2.js new file mode 100644 index 000000000..8557087e7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A1_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1.2.5_A1_T2; + * @section: 15.1.2.5; + * @assertion: isFinite applies ToNumber to its argument, then return false if the result is NaN, +Infinity, -Infinity, and otherwise return true; + * @description: Checking all object; +*/ + +// CHECK#1 +if (!(isFinite({}) === false)) { + $ERROR('#1: {} === Not-a-Finite. Actual: ' + ({})); +} + +// CHECK#2 +if (!(isFinite(new String("string")) === false)) { + $ERROR('#2: new String("string") === Not-a-Finite. Actual: ' + (new String("string"))); +} + +// CHECK#3 +if (isFinite(new String("1")) === false) { + $ERROR('#3: new String("1") === Not-a-Finite. Actual: ' + (new String("1"))); +} + +// CHECK#4 +if (isFinite(new Number(1)) === false) { + $ERROR('#4: new Number(1) !== Not-a-Finite'); +} + +// CHECK#5 +if (!(isFinite(new Number(NaN)) === false)) { + $ERROR('#5: new Number(NaN) === Not-a-Finite. Actual: ' + (new Number(NaN))); +} + +// CHECK#6 +if (isFinite(new Boolean(true)) === false) { + $ERROR('#6: new Boolean(true) !== Not-a-Finite'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.1.js new file mode 100644 index 000000000..59cbe8a12 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.1; + * @section: 15.1.2.5, 15.2.4.7, 12.6.4; + * @assertion: The length property of isFinite has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (isFinite.propertyIsEnumerable('length') !== false) { + $ERROR('#1: isFinite.propertyIsEnumerable(\'length\') === false. Actual: ' + (isFinite.propertyIsEnumerable('length'))); +} + +//CHECK#2 +var result = true; +for (p in isFinite){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in isFinite) { 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.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.2.js new file mode 100644 index 000000000..f106d908c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.2.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.2.5_A2.2; + * @section: 15.1.2.5, 15.2.4.5, 11.4.1; + * @assertion: The length property of isFinite has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; + * @strict_mode_negative +*/ + +//CHECK#1 +if (isFinite.hasOwnProperty('length') !== true) { + $FAIL('#1: isFinite.hasOwnProperty(\'length\') === true. Actual: ' + (isFinite.hasOwnProperty('length'))); +} + +delete isFinite.length; + +//CHECK#2 +if (isFinite.hasOwnProperty('length') !== true) { + $ERROR('#2: delete isFinite.length; isFinite.hasOwnProperty(\'length\') === true. Actual: ' + (isFinite.hasOwnProperty('length'))); +} + +//CHECK#3 +if (isFinite.length === undefined) { + $ERROR('#3: delete isFinite.length; isFinite.length !== undefined'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.3.js new file mode 100644 index 000000000..4cc8f8bff --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.3; + * @section: 15.1.2.5; + * @assertion: The length property of isFinite has the attribute ReadOnly; + * @description: Checking if varying the length property fails; + * @strict_mode_negative +*/ + +//CHECK#1 +x = isFinite.length; +isFinite.length = Infinity; +if (isFinite.length !== x) { + $ERROR('#1: x = isFinite.length; isFinite.length = Infinity; isFinite.length === x. Actual: ' + (isFinite.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.4.js new file mode 100644 index 000000000..73d9fcda0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.4; + * @section: 15.1.2.5; + * @assertion: The length property of isFinite is 1; + * @description: isFinite.length === 1; +*/ + +//CHECK#1 +if (isFinite.length !== 1) { + $ERROR('#1: isFinite.length === 1. Actual: ' + (isFinite.length)); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.5.js new file mode 100644 index 000000000..d89b2cc1d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.5; + * @section: 15.1.2.5, 15.2.4.7, 12.6.4; + * @assertion: The isFinite property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('isFinite') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'isFinite\') === false. Actual: ' + (this.propertyIsEnumerable('isFinite'))); +} + +//CHECK#2 +var result = true; +for (p in this){ + if (p === "isFinite") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "isFinite") 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.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.6.js new file mode 100644 index 000000000..15e691b3f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.6; +* @section: 15.1.2.5; +* @assertion: The isFinite property has not prototype property; +* @description: Checking isFinit.prototype; +*/ + +//CHECK#1 +if (isFinite.prototype !== undefined) { + $ERROR('#1: isFinite.prototype === undefined. Actual: ' + (isFinite.prototype)); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.7.js new file mode 100644 index 000000000..43519bd6a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.5_isFinite/S15.1.2.5_A2.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.2.5_A2.7; +* @section: 15.1.2.5, 11.2.2; +* @assertion: The isFinite 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 isFinite(); + $ERROR('#1.1: new isFinite() throw TypeError. Actual: ' + (new isFinite())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new isFinite() 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_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)); + } +} 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.10_T1.js new file mode 100644 index 000000000..f6a83a53f --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.10_T1; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.11_T1.js new file mode 100644 index 000000000..0063212b4 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.11_T1; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.11_T2.js new file mode 100644 index 000000000..9158fc453 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.11_T2; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.12_T1.js new file mode 100644 index 000000000..357d9b5f0 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.12_T1; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.12_T2.js new file mode 100644 index 000000000..7d1fa2050 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.12_T2; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.12_T3.js new file mode 100644 index 000000000..b2e5903cb --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.12_T3; + * @section: 15.1.3.2; + * @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 +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.13_T1.js new file mode 100644 index 000000000..865544b9c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.13_T1; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.13_T2.js new file mode 100644 index 000000000..ddfb4be3b --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.13_T2; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xC0; indexB <= 0xDF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.14_T1.js new file mode 100644 index 000000000..b768d3158 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.14_T1; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.14_T2.js new file mode 100644 index 000000000..6af0e02ae --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.14_T2; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.14_T3.js new file mode 100644 index 000000000..996695a3c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.14_T3; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.14_T4.js new file mode 100644 index 000000000..892981a86 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.14_T4; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xE0; indexB <= 0xEF; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T1.js new file mode 100644 index 000000000..f43de8f40 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T1; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T2.js new file mode 100644 index 000000000..e937b817a --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T2; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T3.js new file mode 100644 index 000000000..83f107f8c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T3; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0x00; indexC <= 0x7F; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T4.js new file mode 100644 index 000000000..845cb49a5 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T4; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T5.js new file mode 100644 index 000000000..9c8ac68a6 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T5; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.15_T6.js new file mode 100644 index 000000000..699dcbb21 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.15_T6; + * @section: 15.1.3.2; + * @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]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB = 0xF0; indexB <= 0xF7; indexB++) { + count++; + hexB = decimalToHexString(indexB); + result = true; + for (indexC = 0xC0; indexC <= 0xFF; indexC++) { + hexC = decimalToHexString(indexC); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.1_T1.js new file mode 100644 index 000000000..766c36bd3 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.1_T1; + * @section: 15.1.3.2; + * @assertion: If string.charAt(k) equal "%" and k + 2 >= string.length, throw URIError; + * @description: Complex tests; +*/ + +result = true; + +//CHECK#1 +try { + decodeURIComponent("%"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#2 +try { + decodeURIComponent("%A"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#3 +try { + decodeURIComponent("%1"); + result = false; +} catch(e) { + if ((e instanceof URIError) !== true) { + result = false; + } +} + +//CHECK#4 +try { + decodeURIComponent("% "); + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.2_T1.js new file mode 100644 index 000000000..be0789158 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.2_T1; + * @section: 15.1.3.2; + * @assertion: If B = string.charAt(k+1) + string.charAt(k+2) do not represent + * hexadecimal digits, throw URIError; + * @description: Complex tests; +*/ + +//CHECK +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.2_T2.js new file mode 100644 index 000000000..868510bb4 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.2_T2; + * @section: 15.1.3.2; + * @assertion: If B = string.charAt(k+1) + string.charAt(k+2) do not represent + * hexadecimal digits, throw URIError; + * @description: Complex tests; +*/ + +//CHECK +result = true; +var interval = [[0x00, 0x29], [0x40,0x40], [0x47, 0x60], [0x67, 0xFFFF]]; +for (indexI = 0; indexI < interval.length; indexI++) { + for (indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { + try { + decodeURIComponent("%" + "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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.3_T1.js new file mode 100644 index 000000000..2236e8d01 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.3_T1; + * @section: 15.1.3.2; + * @assertion: If B = 10xxxxxx or B = 11111xxx, throw URIError; + * @description: Complex tests. B = 10xxxxxx -> B in [0x80 - 0xBF]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0x80; index <= 0xBF; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.3_T2.js new file mode 100644 index 000000000..8dd2a7413 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.3_T2; + * @section: 15.1.3.2; + * @assertion: If B = 10xxxxxx or B = 11111xxx, throw URIError; + * @description: Complex tests. B = 11111xxx -> B in [0xF8 - 0xFF]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xF8; index <= 0xFF; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.4_T1.js new file mode 100644 index 000000000..71781b135 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.4_T1; + * @section: 15.1.3.2; + * @assertion: If B = 110xxxxx (n = 2) and (k + 2) + 3 >= length, throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xC0; index <= 0xDF; index++) { + count++; + str = ""; + result = true; + for (len = 0; len < 3; len++) { + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.5_T1.js new file mode 100644 index 000000000..d219030b6 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.5_T1; + * @section: 15.1.3.2; + * @assertion: If B = 1110xxxx (n = 3) and (k + 2) + 6 >= length, throw URIError; + * @description: Complex tests. B = [0xE0 - 0xEF]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xE0; index <= 0xEF; index++) { + count++; + str = ""; + result = true; + for (len = 0; len < 6; len++) { + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.6_T1.js new file mode 100644 index 000000000..83e0fca8e --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.6_T1; + * @section: 15.1.3.2; + * @assertion: If B = 11110xxx (n = 4) and (k + 2) + 9 >= length, throw URIError; + * @description: Complex tests. B = [0xF0 - 0xF7]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xF0; index <= 0xF7; index++) { + count++; + str = ""; + result = true; + for (len = 0; len < 9; len++) { + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.7_T1.js new file mode 100644 index 000000000..42978945a --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.7_T1; + * @section: 15.1.3.2; + * @assertion: If B = 110xxxxx (n = 2) and string.charAt(k + 3) not equal "%", throw URIError; + * @description: Complex tests. B = [0xC0 - 0xDF]; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xC0; index <= 0xDF; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.8_T1.js new file mode 100644 index 000000000..bfe77c70d --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.8_T1; + * @section: 15.1.3.2; + * @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 "%"; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xE0; index <= 0xEF; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.8_T2.js new file mode 100644 index 000000000..cbef6e553 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.8_T2; + * @section: 15.1.3.2; + * @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 "%"; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xE0; index <= 0xEF; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.9_T1.js new file mode 100644 index 000000000..5d435f780 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.9_T1; + * @section: 15.1.3.2; + * @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 "%"; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xF0; index <= 0xF7; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.9_T2.js new file mode 100644 index 000000000..f035760c5 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.9_T2; + * @section: 15.1.3.2; + * @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 "%"; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xF0; index <= 0xF7; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A1.9_T3.js new file mode 100644 index 000000000..ce0f7e6a9 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A1.9_T3; + * @section: 15.1.3.2; + * @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 "%"; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xF0; index <= 0xF7; index++) { + count++; + hex = decimalToHexString(index); + try { + decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A2.1_T1.js new file mode 100644 index 000000000..f56c4c36c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A2.1_T1; + * @section: 15.1.3.2; + * @assertion: If string.charAt(k) not equal "%", return this char; + * @description: Complex tests; +*/ + +//CHECK +errorCount = 0; +count = 0; +for (indexI = 0; indexI <= 65535; indexI++) { + if (indexI !== 0x25) { + hex = decimalToHexString(indexI); + try { + var str = String.fromCharCode(indexI); + if (decodeURIComponent(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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A2.2_T1.js new file mode 100644 index 000000000..e0d6fe20b --- /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.2_decodeURIComponent/S15.1.3.2_A2.2_T1.js @@ -0,0 +1,77 @@ +// 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.2_A2.2_T1; + * @section: 15.1.3.2; + * @assertion: If B1 = 0xxxxxxxx ([0x00 - 0x7F]), return B1; + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (indexB1 = 0x00; indexB1 <= 0x7F; indexB1++) { + count++; + var hexB1 = decimalToHexString(indexB1); + var index = indexB1; + try { + hex = String.fromCharCode(index); + if (decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A2.3_T1.js new file mode 100644 index 000000000..8af8c1f6f --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A2.3_T1; + * @section: 15.1.3.2; + * @assertion: If B1 = 110xxxxx ([0xC0 - 0xDF]), B2 = 10xxxxxx ([0x80 - 0xBF), without B1 = [0xC0, 0xC1], return UTF8(B1, B2); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB1 = 0xC2; indexB1 <= 0xDF; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + count++; + var hexB2 = decimalToHexString(indexB2); + var index = (indexB1 & 0x1F) * 0x40 + (indexB2 & 0x3F); + try { + if (decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A2.4_T1.js new file mode 100644 index 000000000..bdd9f511b --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A2.4_T1; + * @section: 15.1.3.2; + * @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; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB1 = 0xE0; indexB1 <= 0xEF; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xE0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xED) && (0xA0 <= indexB2)) continue; + var hexB2 = decimalToHexString(indexB2); + for (indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + count++; + var hexB3 = decimalToHexString(indexB3); + var index = (indexB1 & 0x0F) * 0x1000 + (indexB2 & 0x3F) * 0x40 + (indexB3 & 0x3F); + try { + if (decodeURIComponent("%" + hexB1.substring(2) + "%" + hexB2.substring(2) + "%" + hexB3.substring(2)) === String.fromCharCode(index)) continue; + } catch (e) {} + if (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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A2.5_T1.js new file mode 100644 index 000000000..89df40af0 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A2.5_T1; + * @section: 15.1.3.2; + * @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; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (indexB1 = 0xF0; indexB1 <= 0xF4; indexB1++) { + var hexB1 = decimalToHexString(indexB1); + for (indexB2 = 0x80; indexB2 <= 0xBF; indexB2++) { + if ((indexB1 === 0xF0) && (indexB2 <= 0x9F)) continue; + if ((indexB1 === 0xF4) && (indexB2 >= 0x90)) continue; + var hexB2 = decimalToHexString(indexB2); + for (indexB3 = 0x80; indexB3 <= 0xBF; indexB3++) { + var hexB3 = decimalToHexString(indexB3); + for (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 (decodeURIComponent("%" + 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A3_T1.js new file mode 100644 index 000000000..44baf30f0 --- /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.2_decodeURIComponent/S15.1.3.2_A3_T1.js @@ -0,0 +1,64 @@ +// 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.2_A3_T1; + * @section: 15.1.3.2; + * @assertion: Let reservedURIComponentSet be the empty string; + * @description: uriReserved and "#" not in reservedURIComponentSet. HexDigit in [0..9, A..F]; +*/ + +//CHECK#1 +if (decodeURIComponent("%3B") !== ";") { + $ERROR('#1: decodeURIComponent("%3B") equal ";", not "%3B"'); +} + +//CHECK#2 +if (decodeURIComponent("%2F") !== "/") { + $ERROR('#2: decodeURIComponent("%2F") equal "/", not "%2F"'); +} + +//CHECK#3 +if (decodeURIComponent("%3F") !== "?") { + $ERROR('#3: decodeURIComponent("%3F") equal "?", not "%3F"'); +} + +//CHECK#4 +if (decodeURIComponent("%3A") !== ":") { + $ERROR('#4: decodeURIComponent("%3A") equal ":", not "%3A"'); +} + +//CHECK#5 +if (decodeURIComponent("%40") !== "@") { + $ERROR('#5: decodeURIComponent("%40") equal "@", not "%40"'); +} + +//CHECK#6 +if (decodeURIComponent("%26") !== "&") { + $ERROR('#6: decodeURIComponent("%26") equal "&", not "%26"'); +} + +//CHECK#7 +if (decodeURIComponent("%3D") !== "=") { + $ERROR('#7.1: decodeURIComponent("%3D") equal "=", not "%3D"'); +} + +//CHECK#8 +if (decodeURIComponent("%2B") !== "+") { + $ERROR('#8.1: decodeURIComponent("%2B") equal "+", not "%2B"'); +} + +//CHECK#9 +if (decodeURIComponent("%24") !== "$") { + $ERROR('#9: decodeURIComponent("%24") equal "$", not "%24"'); +} + +//CHECK#10 +if (decodeURIComponent("%2C") !== ",") { + $ERROR('#10: decodeURIComponent("%2C") equal ",", not "%2C"'); +} + +//CHECK#11 +if (decodeURIComponent("%23") !== "#") { + $ERROR('#11: decodeURIComponent("%23") equal "#", not "%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A3_T2.js new file mode 100644 index 000000000..8b81e97b8 --- /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.2_decodeURIComponent/S15.1.3.2_A3_T2.js @@ -0,0 +1,64 @@ +// 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.2_A3_T2; + * @section: 15.1.3.2; + * @assertion: Let reservedURIComponentSet be the empty string; + * @description: uriReserved and "#" not in reservedURIComponentSet. HexDigit in [0..9, a..f]; +*/ + +//CHECK#1 +if (decodeURIComponent("%3b") !== ";") { + $ERROR('#1: decodeURIComponent("%3b") equal ";", not "%3B" or "%3b"'); +} + +//CHECK#2 +if (decodeURIComponent("%2f") !== "/") { + $ERROR('#2: decodeURIComponent("%2f") equal "/", not "%2F" or "%2f"'); +} + +//CHECK#3 +if (decodeURIComponent("%3f") !== "?") { + $ERROR('#3: decodeURIComponent("%3f") equal "?", not "%3F" or "%3f"'); +} + +//CHECK#4 +if (decodeURIComponent("%3a") !== ":") { + $ERROR('#4: decodeURIComponent("%3a") equal ":", not "%3A" or "%3a"'); +} + +//CHECK#5 +if (decodeURIComponent("%40") !== "@") { + $ERROR('#5: decodeURIComponent("%40") equal "@", not "%40"'); +} + +//CHECK#6 +if (decodeURIComponent("%26") !== "&") { + $ERROR('#6: decodeURIComponent("%26") equal "&", not "%26"'); +} + +//CHECK#7 +if (decodeURIComponent("%3d") !== "=") { + $ERROR('#7.1: decodeURIComponent("%3d") equal "=", not "%3D" or "%3d"'); +} + +//CHECK#8 +if (decodeURIComponent("%2b") !== "+") { + $ERROR('#8.1: decodeURIComponent("%2b") equal "+", not "%2B" or "%2b"'); +} + +//CHECK#9 +if (decodeURIComponent("%24") !== "$") { + $ERROR('#9: decodeURIComponent("%24") equal "$", not "%24"'); +} + +//CHECK#10 +if (decodeURIComponent("%2c") !== ",") { + $ERROR('#10: decodeURIComponent("%2c") equal ",", not "%2C" or "%2c"'); +} + +//CHECK#11 +if (decodeURIComponent("%23") !== "#") { + $ERROR('#11: decodeURIComponent("%23") equal "#", not "%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A3_T3.js new file mode 100644 index 000000000..c52dcc73d --- /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.2_decodeURIComponent/S15.1.3.2_A3_T3.js @@ -0,0 +1,19 @@ +// 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.2_A3_T3; + * @section: 15.1.3.2; + * @assertion: Let reservedURIComponentSet be the empty string; + * @description: Complex test; +*/ + +//CHECK#1 +if (decodeURIComponent("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") !== ";/?:@&=+$,#") { + $ERROR('#1: decodeURIComponent("%3B%2F%3F%3A%40%26%3D%2B%24%2C%23") equal ";/?:@&=+$,#", not "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23"'); +} + +//CHECK#2 +if (decodeURIComponent("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") !== ";/?:@&=+$,#") { + $ERROR('#2: decodeURIComponent("%3b%2f%3f%3a%40%26%3d%2b%24%2c%23") equal ";/?:@&=+$,#" or "%3B%2F%3F%3A%40%26%3D%2B%24%2C%23", not "%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A4_T1.js new file mode 100644 index 000000000..f3082b14c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A4_T1; + * @section: 15.1.3.2; + * @assertion: URI tests; + * @description: Checking ENGLISH ALPHABET; +*/ + +//CHECK#1 +if (decodeURIComponent("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") { + $ERROR('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (decodeURIComponent("%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 (decodeURIComponent("%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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A4_T2.js new file mode 100644 index 000000000..3a3ad1563 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A4_T2; + * @section: 15.1.3.2; + * @assertion: URI tests; + * @description: Checking RUSSIAN ALPHABET; +*/ + +//CHECK#1 +if (decodeURIComponent("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 (decodeURIComponent("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 (decodeURIComponent("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/Юникод#Версии Юникода") { + $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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A4_T3.js new file mode 100644 index 000000000..ffd81cf8f --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A4_T3; + * @section: 15.1.3.2; + * @assertion: URI tests; + * @description: Checking URL with Line Terminator; +*/ + +//CHECK#1 +if (decodeURIComponent("http://unipro.ru/%0Aabout") !== "http://unipro.ru/\nabout") { + $ERROR('#1: http://unipro.ru/%A0about'); +} + +//CHECK#2 +if (decodeURIComponent("http://unipro.ru/%0Babout") !== "http://unipro.ru/\vabout") { + $ERROR('#2: http://unipro.ru/%0Babout'); +} + +//CHECK#3 +if (decodeURIComponent("http://unipro.ru/%0Cabout") !== "http://unipro.ru/\fabout") { + $ERROR('#3: http://unipro.ru/%0Cabout'); +} + +//CHECK#4 +if (decodeURIComponent("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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A4_T4.js new file mode 100644 index 000000000..12acfd2a3 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A4_T4; + * @section: 15.1.3.2; + * @assertion: URI tests; + * @description: Test some url; +*/ + +//CHECK#1 +if (decodeURIComponent("") !== "") { + $ERROR('#1: ""'); +} + +//CHECK#2 +if (decodeURIComponent("http://unipro.ru") !== "http://unipro.ru") { + $ERROR('#2: http://unipro.ru'); +} + +//CHECK#3 +if (decodeURIComponent("http:%2f%2Fwww.google.ru/support/jobs/bin/static.py%3Fpage%3dwhy-ru.html%26sid%3Dliveandwork") !== "http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") { + $ERROR('#3: http:%2f%2Fwww.google.ru/support/jobs/bin/static.py%3Fpage3dwhy-ru.html%26sid3Dliveandwork"'); +} + +//CHECK#4 +if (decodeURIComponent("http:%2F%2Fen.wikipedia.org/wiki/UTF-8%23Description") !== "http://en.wikipedia.org/wiki/UTF-8#Description") { + $ERROR('#4: http:%2F%2Fen.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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.1.js new file mode 100644 index 000000000..296a9e7f1 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A5.1; + * @section: 15.1.3.2, 15.2.4.7, 12.6.4; + * @assertion: The length property of decodeURIComponent has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (decodeURIComponent.propertyIsEnumerable('length') !== false) { + $ERROR('#1: decodeURIComponent.propertyIsEnumerable(\'length\') === false. Actual: ' + (decodeURIComponent.propertyIsEnumerable('length'))); +} + +//CHECK#2 +result = true; +for (p in decodeURIComponent){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in decodeURIComponent) { 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.2.js new file mode 100644 index 000000000..d37a04f39 --- /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.2_decodeURIComponent/S15.1.3.2_A5.2.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.2_A5.2; + * @section: 15.1.3.2, 15.2.4.5, 11.4.1; + * @assertion: The length property of decodeURIComponent has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; +*/ + +//CHECK#1 +if (decodeURIComponent.hasOwnProperty('length') !== true) { + $FAIL('#1: decodeURIComponent.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURIComponent.hasOwnProperty('length'))); +} + +delete decodeURIComponent.length; + +//CHECK#2 +if (decodeURIComponent.hasOwnProperty('length') !== true) { + $ERROR('#2: delete decodeURIComponent.length; decodeURIComponent.hasOwnProperty(\'length\') === true. Actual: ' + (decodeURIComponent.hasOwnProperty('length'))); +} + +//CHECK#3 +if (decodeURIComponent.length === undefined) { + $ERROR('#3: delete decodeURIComponent.length; decodeURIComponent.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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.3.js new file mode 100644 index 000000000..d94f889d5 --- /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.2_decodeURIComponent/S15.1.3.2_A5.3.js @@ -0,0 +1,17 @@ +// 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.2_A5.3; + * @section: 15.1.3.2; + * @assertion: The length property of decodeURIComponent has the attribute ReadOnly; + * @description: Checking if varying the length property fails; +*/ + +//CHECK#1 +x = decodeURIComponent.length; +decodeURIComponent.length = Infinity; +if (decodeURIComponent.length !== x) { + $ERROR('#1: x = decodeURIComponent.length; decodeURIComponent.length = Infinity; decodeURIComponent.length === x. Actual: ' + (decodeURIComponent.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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.4.js new file mode 100644 index 000000000..23c5bfb50 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A5.4; + * @section: 15.1.3.2; + * @assertion: The length property of decodeURIComponent is 1; + * @description: decodeURIComponent.length === 1; +*/ + +//CHECK#1 +if (decodeURIComponent.length !== 1) { + $ERROR('#1: decodeURIComponent.length === 1. Actual: ' + (decodeURIComponent.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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.5.js new file mode 100644 index 000000000..3d5685ede --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A5.5; + * @section: 15.1.3.2, 15.2.4.7, 12.6.4; + * @assertion: The decodeURIComponent property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('decodeURIComponent') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'decodeURIComponent\') === false. Actual: ' + (this.propertyIsEnumerable('decodeURIComponent'))); +} + +//CHECK#2 +result = true; +for (p in this){ + if (p === "decodeURIComponent") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "decodeURIComponent") 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.6.js new file mode 100644 index 000000000..3822f5c32 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A5.6; +* @section: 15.1.3.2; +* @assertion: The decodeURIComponent property has not prototype property; +* @description: Checking decodeURIComponent.prototype; +*/ + +//CHECK#1 +if (decodeURIComponent.prototype !== undefined) { + $ERROR('#1: decodeURIComponent.prototype === undefined. Actual: ' + (decodeURIComponent.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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A5.7.js new file mode 100644 index 000000000..515d9998c --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A5.7; +* @section: 15.1.3.2, 11.2.2; +* @assertion: The decodeURIComponent 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 decodeURIComponent(); + $ERROR('#1.1: new decodeURIComponent() throw TypeError. Actual: ' + (new decodeURIComponent())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new decodeURIComponent() 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.2_decodeURIComponent/S15.1.3.2_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.2_decodeURIComponent/S15.1.3.2_A6_T1.js new file mode 100644 index 000000000..30c2324b7 --- /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.2_decodeURIComponent/S15.1.3.2_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.2_A6_T1; + * @section: 15.1.3.2, 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 (decodeURIComponent(object) !== "[object Object]") { + $ERROR('#1: var object = {valueOf: function() {return "%5E"}}; decodeURIComponent(object) === [object Object]. Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; +if (decodeURIComponent(object) !== "^") { + $ERROR('#2: var object = {valueOf: function() {return ""}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; +if (decodeURIComponent(object) !== "^") { + $ERROR('#3: var object = {valueOf: function() {return "%5E"}, toString: function() {return {}}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; + if (decodeURIComponent(object) !== "^") { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "%5E"}}; decodeURIComponent(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return "%5E"}}; +if (decodeURIComponent(object) !== "^") { + $ERROR('#5: var object = {toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}} +if (decodeURIComponent(object) !== "^") { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return "%5E"}}; decodeURIComponent(object) === "^". Actual: ' + (decodeURIComponent(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; + decodeURIComponent(object); + $ERROR('#7.1: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURIComponent(object) throw "error". Actual: ' + (decodeURIComponent(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return "%5E"}, toString: function() {throw "error"}}; decodeURIComponent(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + decodeURIComponent(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURIComponent(object) throw TypeError. Actual: ' + (decodeURIComponent(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; decodeURIComponent(object) 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A1.1_T1.js new file mode 100644 index 000000000..241ea9366 --- /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.3_encodeURI/S15.1.3.3_A1.1_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.3_A1.1_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xDC00; index <= 0xDFFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURI(String.fromCharCode(index)); + } 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.3_encodeURI/S15.1.3.3_A1.1_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.3_encodeURI/S15.1.3.3_A1.1_T2.js new file mode 100644 index 000000000..0480311c5 --- /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.3_encodeURI/S15.1.3.3_A1.1_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.3_A1.1_T2; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xDC00; index <= 0xDFFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURI(String.fromCharCode(index, 0x0041)); + } 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A1.2_T1.js new file mode 100644 index 000000000..2fe4d8a3f --- /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.3_encodeURI/S15.1.3.3_A1.2_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.3_A1.2_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURI(String.fromCharCode(index)); + } 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A1.2_T2.js new file mode 100644 index 000000000..93484b815 --- /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.3_encodeURI/S15.1.3.3_A1.2_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.3_A1.2_T2; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURI(String.fromCharCode(0x0041, index)); + } 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A1.3_T1.js new file mode 100644 index 000000000..e933a9b7a --- /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.3_encodeURI/S15.1.3.3_A1.3_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.3_A1.3_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) not in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests, string.charAt(k+1) in [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF]; +*/ + +chars = [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + hex = decimalToHexString(index); + try { + encodeURI(String.fromCharCode(index, chars[indexC])); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + res = false; + } + if (res !== 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A2.1_T1.js new file mode 100644 index 000000000..77f76d078 --- /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.3_encodeURI/S15.1.3.3_A2.1_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.3_A2.1_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0x0000 - 0x007F]\[uriReserved, uriUnescaped, #], return 1 octet (00000000 0zzzzzzz -> 0zzzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","]; +uriUnescaped = ["-", "_", ".", "!", "~", "*", "'", "(", ")", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +l : +for (index = 0x0000; index <= 0x007F; index++) { + count++; + str = String.fromCharCode(index); + for (indexC = 0; indexC < uriReserved.length; indexC++) { + if (uriReserved[indexC] === str) continue l; + } + for (indexC = 0; indexC < uriUnescaped.length; indexC++) { + if (uriUnescaped[indexC] === str) continue l; + } + if ("#" === str) continue l; + try { + if (encodeURI(str).toUpperCase() === "%" + decimalToHexString(index).substring(2)) continue l; + } 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A2.2_T1.js new file mode 100644 index 000000000..319e5ae36 --- /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.3_encodeURI/S15.1.3.3_A2.2_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.3_A2.2_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0x0080 - 0x07FF], return 2 octets (00000yyy yyzzzzzz -> 110yyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +l: +for (index = 0x0080; index <= 0x07FF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x00C0 + (index & 0x07C0) / 0x0040).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURI(str).toUpperCase() === "%" + hex2 + "%" + hex1) 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A2.3_T1.js new file mode 100644 index 000000000..353ca1479 --- /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.3_encodeURI/S15.1.3.3_A2.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.3_A2.3_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0x0800 - 0xD7FF], return 3 octets (xxxxyyyy yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0x0800; index <= 0xD7FF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURI(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A2.4_T1.js new file mode 100644 index 000000000..e8e10bbae --- /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.3_encodeURI/S15.1.3.3_A2.4_T1.js @@ -0,0 +1,88 @@ +// 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.3_A2.4_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz -> 11110www 10xxxxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629, string.charAt(k+1) in [0xDC00, 0xDDFF, 0xDFFF]; +*/ + +chars = [0xDC00, 0xDDFF, 0xDFFF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xD800; index <= 0xDBFF; index++) { + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + index1 = (index - 0xD800) * 0x400 + (chars[indexC] - 0xDC00) + 0x10000; + hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2); + hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2); + str = String.fromCharCode(index, chars[indexC]); + try { + if (encodeURI(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) { + res = false; + } + } catch(e) {res = false} + } + if (res !== 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++; + } + count++; +} + +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.3_encodeURI/S15.1.3.3_A2.4_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.3_encodeURI/S15.1.3.3_A2.4_T2.js new file mode 100644 index 000000000..d078b069b --- /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.3_encodeURI/S15.1.3.3_A2.4_T2.js @@ -0,0 +1,88 @@ +// 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.3_A2.4_T2; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz -> 11110www 10xxxxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629, string.charAt(k) in [0xD800, 0xDBFF, 0xD9FF]; +*/ + +chars = [0xD800, 0xDBFF, 0xD9FF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xDC00; index <= 0xDFFF; index++) { + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + index1 = (chars[indexC] - 0xD800) * 0x400 + (index - 0xDC00) + 0x10000; + hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2); + hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2); + str = String.fromCharCode(chars[indexC], index); + try { + if (encodeURI(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) { + res = false; + } + } catch(e) {res = false} + } + if (res !== 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++; + } + count++; +} + +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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A2.5_T1.js new file mode 100644 index 000000000..9ec1a2b2a --- /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.3_encodeURI/S15.1.3.3_A2.5_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.3_A2.5_T1; + * @section: 15.1.3.3; + * @assertion: If string.charAt(k) in [0xE000 - 0xFFFF], return 3 octets (xxxxyyyy yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xE000; index <= 0xFFFF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURI(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) 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.3_encodeURI/S15.1.3.3_A3.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.3_encodeURI/S15.1.3.3_A3.1_T1.js new file mode 100644 index 000000000..b3119441f --- /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.3_encodeURI/S15.1.3.3_A3.1_T1.js @@ -0,0 +1,17 @@ +// 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.3_A3.1_T1; + * @section: 15.1.3.3; + * @assertion: unescapedURISet containing one instance of each character valid in uriReserved; + * @description: Complex tests; +*/ + +uriReserved = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","]; +for (indexC = 0; indexC < uriReserved.length; indexC++) { + var str = uriReserved[indexC]; + if (encodeURI(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing' + str); + } +} 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.3_encodeURI/S15.1.3.3_A3.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.3_encodeURI/S15.1.3.3_A3.2_T1.js new file mode 100644 index 000000000..f2d16c1e7 --- /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.3_encodeURI/S15.1.3.3_A3.2_T1.js @@ -0,0 +1,17 @@ +// 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.3_A3.2_T1; + * @section: 15.1.3.3; + * @assertion: unescapedURISet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: uriAlpha; +*/ + +uriAlpha = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (indexC = 0; indexC < uriAlpha.length; indexC++) { + var str = uriAlpha[indexC]; + if (encodeURI(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing ' + str); + } +} 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.3_encodeURI/S15.1.3.3_A3.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.3_encodeURI/S15.1.3.3_A3.2_T2.js new file mode 100644 index 000000000..802b73d46 --- /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.3_encodeURI/S15.1.3.3_A3.2_T2.js @@ -0,0 +1,17 @@ +// 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.3_A3.2_T2; + * @section: 15.1.3.3; + * @assertion: unescapedURISet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: DecimalDigit; +*/ + +DecimalDigit = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +for (indexC = 0; indexC < DecimalDigit.length; indexC++) { + var str = DecimalDigit[indexC]; + if (encodeURI(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing' + str); + } +} 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.3_encodeURI/S15.1.3.3_A3.2_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.3_encodeURI/S15.1.3.3_A3.2_T3.js new file mode 100644 index 000000000..5c64bb272 --- /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.3_encodeURI/S15.1.3.3_A3.2_T3.js @@ -0,0 +1,17 @@ +// 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.3_A3.2_T3; + * @section: 15.1.3.3; + * @assertion: unescapedURISet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: uriMark; +*/ + +uriMark = ["-", "_", ".", "!", "~", "*", "'", "(", ")"]; +for (indexC = 0; indexC < uriMark.length; indexC++) { + var str = uriMark[indexC]; + if (encodeURI(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing' + str); + } +} 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.3_encodeURI/S15.1.3.3_A3.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.3_encodeURI/S15.1.3.3_A3.3_T1.js new file mode 100644 index 000000000..8be71a67d --- /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.3_encodeURI/S15.1.3.3_A3.3_T1.js @@ -0,0 +1,13 @@ +// 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.3_A3.3_T1; + * @section: 15.1.3.3; + * @assertion: unescapedURISet containing "#"; + * @description: encodeURI("#") === "#"; +*/ + +if (encodeURI("#") !== "#") { + $ERROR('#1: unescapedURISet containing "#"'); +} 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A4_T1.js new file mode 100644 index 000000000..2f297e5a3 --- /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.3_encodeURI/S15.1.3.3_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.3_A4_T1; + * @section: 15.1.3.3; + * @assertion: URI tests; + * @description: Checking ENGLISH ALPHABET; +*/ + +//CHECK#1 +if (encodeURI("http://unipro.ru/0123456789") !== "http://unipro.ru/0123456789") { + $ERROR('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (encodeURI("aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") !== "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") { + $ERROR('#2: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'); +} + +//CHECK#3 +if (encodeURI("aA_bB-cC.dD!eE~fF*gG'hH(iI)jJ;kK/lL?mM:nN@oO&pP=qQ+rR$sS,tT9uU8vV7wW6xX5yY4zZ") !== "aA_bB-cC.dD!eE~fF*gG'hH(iI)jJ;kK/lL?mM:nN@oO&pP=qQ+rR$sS,tT9uU8vV7wW6xX5yY4zZ") { + $ERROR('#3: '); +} 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A4_T2.js new file mode 100644 index 000000000..4aec4212a --- /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.3_encodeURI/S15.1.3.3_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.3_A4_T2; + * @section: 15.1.3.3; + * @assertion: URI tests; + * @description: Checking RUSSIAN ALPHABET; +*/ + +//CHECK#1 +if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод") !== "http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4") && (encodeURI("http://ru.wikipedia.org/wiki/Юникод") !== "http://ru.wikipedia.org/wiki/" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4".toLowerCase())) { + $ERROR('#1: http://ru.wikipedia.org/wiki/Юникод'); +} + +//CHECK#2 +if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "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") && (encodeURI("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "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".toLowerCase())) { + $ERROR('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки'); +} + +//CHECK#3 +if ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Версии Юникода") !== "http://ru.wikipedia.org/wiki/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%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") && ((encodeURI("http://ru.wikipedia.org/wiki/Юникод#Версии Юникода") !== "http://ru.wikipedia.org/wiki/" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%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".toLowerCase()))) { + $ERROR('#3: http://ru.wikipedia.org/wiki/Юникод#Версии Юникода'); +} 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A4_T3.js new file mode 100644 index 000000000..c28ecf983 --- /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.3_encodeURI/S15.1.3.3_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.3_A4_T3; + * @section: 15.1.3.3; + * @assertion: URI tests; + * @description: Checking URL with Line Terminator; +*/ + +//CHECK#1 +if ((encodeURI("http://unipro.ru/\nabout") !== "http://unipro.ru/%0Aabout") && encodeURI("http://unipro.ru/\nabout") !== "http://unipro.ru/%0aabout") { + $ERROR('#1: http://unipro.ru/\\nabout'); +} + +//CHECK#2 +if ((encodeURI("http://unipro.ru/\vabout") !== "http://unipro.ru/%0Babout") && encodeURI("http://unipro.ru/\vabout") !== "http://unipro.ru/%0babout") { + $ERROR('#2: http://unipro.ru/\\vabout'); +} + +//CHECK#3 +if ((encodeURI("http://unipro.ru/\fabout") !== "http://unipro.ru/%0Cabout") && encodeURI("http://unipro.ru/\fabout") !== "http://unipro.ru/%0cabout") { + $ERROR('#3: http://unipro.ru/\\fabout'); +} + +//CHECK#4 +if ((encodeURI("http://unipro.ru/\rabout") !== "http://unipro.ru/%0Dabout") && encodeURI("http://unipro.ru/\rabout") !== "http://unipro.ru/%0dabout") { + $ERROR('#4: http://unipro.ru/\\rabout'); +} 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A4_T4.js new file mode 100644 index 000000000..eea709e8f --- /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.3_encodeURI/S15.1.3.3_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.3_A4_T4; + * @section: 15.1.3.3; + * @assertion: URI tests; + * @description: Test some url; +*/ + +//CHECK#1 +if (encodeURI("") !== "") { + $ERROR('#1: ""'); +} + +//CHECK#2 +if (encodeURI("http://unipro.ru") !== "http://unipro.ru") { + $ERROR('#2: http://unipro.ru'); +} + +//CHECK#3 +if (encodeURI("http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") !== "http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") { + $ERROR('#3: http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork"'); +} + +//CHECK#4 +if (encodeURI("http://en.wikipedia.org/wiki/UTF-8#Description") !== "http://en.wikipedia.org/wiki/UTF-8#Description") { + $ERROR('#4: http://en.wikipedia.org/wiki/UTF-8#Description'); +} 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.1.js new file mode 100644 index 000000000..a61d56844 --- /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.3_encodeURI/S15.1.3.3_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.3_A5.1; + * @section: 15.1.3.3, 15.2.4.7, 12.6.4; + * @assertion: The length property of encodeURI has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (encodeURI.propertyIsEnumerable('length') !== false) { + $ERROR('#1: encodeURI.propertyIsEnumerable(\'length\') === false. Actual: ' + (encodeURI.propertyIsEnumerable('length'))); +} + +//CHECK#2 +result = true; +for (p in encodeURI){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in encodeURI) { 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.2.js new file mode 100644 index 000000000..11ac65b35 --- /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.3_encodeURI/S15.1.3.3_A5.2.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.3_A5.2; + * @section: 15.1.3.3, 15.2.4.5, 11.4.1; + * @assertion: The length property of encodeURI has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; +*/ + +//CHECK#1 +if (encodeURI.hasOwnProperty('length') !== true) { + $FAIL('#1: encodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (encodeURI.hasOwnProperty('length'))); +} + +delete encodeURI.length; + +//CHECK#2 +if (encodeURI.hasOwnProperty('length') !== true) { + $ERROR('#2: delete encodeURI.length; encodeURI.hasOwnProperty(\'length\') === true. Actual: ' + (encodeURI.hasOwnProperty('length'))); +} + +//CHECK#3 +if (encodeURI.length === undefined) { + $ERROR('#3: delete encodeURI.length; encodeURI.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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.3.js new file mode 100644 index 000000000..deed6373f --- /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.3_encodeURI/S15.1.3.3_A5.3.js @@ -0,0 +1,17 @@ +// 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.3_A5.3; + * @section: 15.1.3.3; + * @assertion: The length property of encodeURI has the attribute ReadOnly; + * @description: Checking if varying the length property fails; +*/ + +//CHECK#1 +x = encodeURI.length; +encodeURI.length = Infinity; +if (encodeURI.length !== x) { + $ERROR('#1: x = encodeURI.length; encodeURI.length = Infinity; encodeURI.length === x. Actual: ' + (encodeURI.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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.4.js new file mode 100644 index 000000000..601127fb2 --- /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.3_encodeURI/S15.1.3.3_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.3_A5.4; + * @section: 15.1.3.3; + * @assertion: The length property of encodeURI is 1; + * @description: encodeURI.length === 1; +*/ + +//CHECK#1 +if (encodeURI.length !== 1) { + $ERROR('#1: encodeURI.length === 1. Actual: ' + (encodeURI.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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.5.js new file mode 100644 index 000000000..ee1baf518 --- /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.3_encodeURI/S15.1.3.3_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.3_A5.5; + * @section: 15.1.3.3, 15.2.4.7, 12.6.4; + * @assertion: The encodeURI property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('encodeURI') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'encodeURI\') === false. Actual: ' + (this.propertyIsEnumerable('encodeURI'))); +} + +//CHECK#2 +result = true; +for (p in this){ + if (p === "encodeURI") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "encodeURI") 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.6.js new file mode 100644 index 000000000..ae32b30bc --- /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.3_encodeURI/S15.1.3.3_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.3_A5.6; +* @section: 15.1.3.3; +* @assertion: The encodeURI property has not prototype property; +* @description: Checking encodeURI.prototype; +*/ + +//CHECK#1 +if (encodeURI.prototype !== undefined) { + $ERROR('#1: encodeURI.prototype === undefined. Actual: ' + (encodeURI.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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A5.7.js new file mode 100644 index 000000000..0ab9b8c9f --- /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.3_encodeURI/S15.1.3.3_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.3_A5.7; +* @section: 15.1.3.3, 11.2.2; +* @assertion: The encodeURI 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 encodeURI(); + $ERROR('#1.1: new encodeURI() throw TypeError. Actual: ' + (new encodeURI())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new encodeURI() 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.3_encodeURI/S15.1.3.3_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.3_encodeURI/S15.1.3.3_A6_T1.js new file mode 100644 index 000000000..6cae662d6 --- /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.3_encodeURI/S15.1.3.3_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.3_A6_T1; + * @section: 15.1.3.3, 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 "^"}}; +if (encodeURI(object) !== "%5Bobject%20Object%5D") { + $ERROR('#1: var object = {valueOf: function() {return "^"}}; encodeURI(object) === %5Bobject%20Object%5D. Actual: ' + (encodeURI(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return ""}, toString: function() {return "^"}}; +if (encodeURI(object) !== "%5E") { + $ERROR('#2: var object = {valueOf: function() {return ""}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return "^"}, toString: function() {return {}}}; +if (encodeURI(object) !== "%5E") { + $ERROR('#3: var object = {valueOf: function() {return "^"}, toString: function() {return {}}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; + if (encodeURI(object) !== "%5E") { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURI(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return "^"}}; +if (encodeURI(object) !== "%5E") { + $ERROR('#5: var object = {toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return "^"}} +if (encodeURI(object) !== "%5E") { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return "^"}}; encodeURI(object) === "%5E". Actual: ' + (encodeURI(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; + encodeURI(object); + $ERROR('#7.1: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURI(object) throw "error". Actual: ' + (encodeURI(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURI(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + encodeURI(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURI(object) throw TypeError. Actual: ' + (encodeURI(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURI(object) 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A1.1_T1.js new file mode 100644 index 000000000..33236bdec --- /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.4_encodeURIComponent/S15.1.3.4_A1.1_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.4_A1.1_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xDC00; index <= 0xDFFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURIComponent(String.fromCharCode(index)); + } 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.4_encodeURIComponent/S15.1.3.4_A1.1_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.4_encodeURIComponent/S15.1.3.4_A1.1_T2.js new file mode 100644 index 000000000..c6da20e22 --- /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.4_encodeURIComponent/S15.1.3.4_A1.1_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.4_A1.1_T2; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xDC00; index <= 0xDFFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURIComponent(String.fromCharCode(index, 0x0041)); + } 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A1.2_T1.js new file mode 100644 index 000000000..f1134901b --- /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.4_encodeURIComponent/S15.1.3.4_A1.2_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.4_A1.2_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURIComponent(String.fromCharCode(index)); + } 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A1.2_T2.js new file mode 100644 index 000000000..286031e3f --- /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.4_encodeURIComponent/S15.1.3.4_A1.2_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.4_A1.2_T2; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.length = k + 1, throw URIError; + * @description: Complex tests; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + hex = decimalToHexString(index); + try { + encodeURIComponent(String.fromCharCode(0x0041, index)); + } 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A1.3_T1.js new file mode 100644 index 000000000..7258c28d0 --- /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.4_encodeURIComponent/S15.1.3.4_A1.3_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.4_A1.3_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) not in [0xDC00 - 0xDFFF], throw URIError; + * @description: Complex tests, string.charAt(k+1) in [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF]; +*/ + +chars = [0x0000, 0xD7FF, 0xD800, 0xDBFE, 0xDBFF, 0xE000, 0xFFFF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +for (index = 0xD800; index <= 0xDBFF; index++) { + count++; + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + hex = decimalToHexString(index); + try { + encodeURIComponent(String.fromCharCode(index, chars[indexC])); + } catch (e) { + if ((e instanceof URIError) === true) continue; + } + res = false; + } + if (res !== 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A2.1_T1.js new file mode 100644 index 000000000..8c4276b3e --- /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.4_encodeURIComponent/S15.1.3.4_A2.1_T1.js @@ -0,0 +1,81 @@ +// 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.4_A2.1_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0x0000 - 0x007F]\[uriUnescaped], return 1 octet (00000000 0zzzzzzz -> 0zzzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +uriUnescaped = ["-", "_", ".", "!", "~", "*", "'", "(", ")", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; + +l : +for (index = 0x0000; index <= 0x007F; index++) { + count++; + str = String.fromCharCode(index); + for (indexC = 0; indexC < uriUnescaped.length; indexC++) { + if (uriUnescaped[indexC] === str) continue l; + } + try { + if (encodeURIComponent(str).toUpperCase() === "%" + decimalToHexString(index).substring(2)) continue l; + } catch(e) {} + if (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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A2.2_T1.js new file mode 100644 index 000000000..6d974c28f --- /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.4_encodeURIComponent/S15.1.3.4_A2.2_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.4_A2.2_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0x0080 - 0x07FF], return 2 octets (00000yyy yyzzzzzz -> 110yyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +l: +for (index = 0x0080; index <= 0x07FF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x00C0 + (index & 0x07C0) / 0x0040).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURIComponent(str).toUpperCase() === "%" + hex2 + "%" + hex1) 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A2.3_T1.js new file mode 100644 index 000000000..b3cd1465d --- /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.4_encodeURIComponent/S15.1.3.4_A2.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.4_A2.3_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0x0800 - 0xD7FF], return 3 octets (xxxxyyyy yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0x0800; index <= 0xD7FF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURIComponent(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A2.4_T1.js new file mode 100644 index 000000000..c5955bda0 --- /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.4_encodeURIComponent/S15.1.3.4_A2.4_T1.js @@ -0,0 +1,88 @@ +// 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.4_A2.4_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz -> 11110www 10xxxxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629, string.charAt(k+1) in [0xDC00, 0xDDFF, 0xDFFF]; +*/ + +chars = [0xDC00, 0xDDFF, 0xDFFF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xD800; index <= 0xDBFF; index++) { + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + index1 = (index - 0xD800) * 0x400 + (chars[indexC] - 0xDC00) + 0x10000; + hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2); + hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2); + str = String.fromCharCode(index, chars[indexC]); + try { + if (encodeURIComponent(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) { + res = false; + } + } catch(e) {res = false} + } + if (res !== 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++; + } + count++; +} + +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.4_encodeURIComponent/S15.1.3.4_A2.4_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.4_encodeURIComponent/S15.1.3.4_A2.4_T2.js new file mode 100644 index 000000000..70d60a55d --- /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.4_encodeURIComponent/S15.1.3.4_A2.4_T2.js @@ -0,0 +1,88 @@ +// 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.4_A2.4_T2; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xD800 - 0xDBFF] and string.charAt(k+1) in [0xDC00 � 0xDFFF], return 4 octets (000wwwxx xxxxyyyy yyzzzzzz -> 11110www 10xxxxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629, string.charAt(k) in [0xD800, 0xDBFF, 0xD9FF]; +*/ + +chars = [0xD800, 0xDBFF, 0xD9FF]; +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xDC00; index <= 0xDFFF; index++) { + res = true; + for (indexC = 0; indexC < chars.length; indexC++) { + index1 = (chars[indexC] - 0xD800) * 0x400 + (index - 0xDC00) + 0x10000; + hex1 = decimalToHexString(0x0080 + (index1 & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index1 & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x0080 + (index1 & 0x3F000) / 0x1000).substring(2); + hex4 = decimalToHexString(0x00F0 + (index1 & 0x1C0000) / 0x40000).substring(2); + str = String.fromCharCode(chars[indexC], index); + try { + if (encodeURIComponent(str).toUpperCase() !== "%" + hex4 + "%" + hex3 + "%" + hex2 + "%" + hex1) { + res = false; + } + } catch(e) {res = false} + } + if (res !== 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++; + } + count++; +} + +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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A2.5_T1.js new file mode 100644 index 000000000..c7ecd1938 --- /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.4_encodeURIComponent/S15.1.3.4_A2.5_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.4_A2.5_T1; + * @section: 15.1.3.4; + * @assertion: If string.charAt(k) in [0xE000 - 0xFFFF], return 3 octets (xxxxyyyy yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz); + * @description: Complex tests, use RFC 3629; +*/ + +errorCount = 0; +count = 0; +var indexP; +var indexO = 0; +for (index = 0xE000; index <= 0xFFFF; index++) { + count++; + hex1 = decimalToHexString(0x0080 + (index & 0x003F)).substring(2); + hex2 = decimalToHexString(0x0080 + (index & 0x0FC0) / 0x0040).substring(2); + hex3 = decimalToHexString(0x00E0 + (index & 0xF000) / 0x1000).substring(2); + str = String.fromCharCode(index); + try { + if (encodeURIComponent(str).toUpperCase() === "%" + hex3 + "%" + hex2 + "%" + hex1) 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.4_encodeURIComponent/S15.1.3.4_A3.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.4_encodeURIComponent/S15.1.3.4_A3.1_T1.js new file mode 100644 index 000000000..c5bc7d2e8 --- /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.4_encodeURIComponent/S15.1.3.4_A3.1_T1.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.4_A3.1_T1; + * @section: 15.1.3.4; + * @assertion: unescapedURIComponentSet not containing uriReserved; + * @description: Complex tests; +*/ + +uriReserved = ["%3B", "%2F", "%3F", "%3A", "%40", "%26", "%3D", "%2B", "%24", "%2C"]; +uriReserved_ = [";", "/", "?", ":", "@", "&", "=", "+", "$", ","]; +for (indexC = 0; indexC < 10; indexC++) { + var str = uriReserved_[indexC]; + if (encodeURIComponent(str) !== uriReserved[indexC]) { + $ERROR('#' + (indexC + 1) + ': unescapedURIComponentSet not containing' + str); + } +} 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.4_encodeURIComponent/S15.1.3.4_A3.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.4_encodeURIComponent/S15.1.3.4_A3.2_T1.js new file mode 100644 index 000000000..8f930dd48 --- /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.4_encodeURIComponent/S15.1.3.4_A3.2_T1.js @@ -0,0 +1,17 @@ +// 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.4_A3.2_T1; + * @section: 15.1.3.4; + * @assertion: unescapedURIComponentSet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: uriAlpha; +*/ + +uriAlpha = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; +for (indexC = 0; indexC < uriAlpha.length; indexC++) { + var str = uriAlpha[indexC]; + if (encodeURIComponent(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing ' + str); + } +} 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.4_encodeURIComponent/S15.1.3.4_A3.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.4_encodeURIComponent/S15.1.3.4_A3.2_T2.js new file mode 100644 index 000000000..7dafca448 --- /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.4_encodeURIComponent/S15.1.3.4_A3.2_T2.js @@ -0,0 +1,17 @@ +// 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.4_A3.2_T2; + * @section: 15.1.3.4; + * @assertion: unescapedURIComponentSet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: DecimalDigit; +*/ + +DecimalDigit = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; +for (indexC = 0; indexC < DecimalDigit.length; indexC++) { + var str = DecimalDigit[indexC]; + if (encodeURIComponent(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing' + str); + } +} 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.4_encodeURIComponent/S15.1.3.4_A3.2_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.4_encodeURIComponent/S15.1.3.4_A3.2_T3.js new file mode 100644 index 000000000..1a1d003b9 --- /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.4_encodeURIComponent/S15.1.3.4_A3.2_T3.js @@ -0,0 +1,17 @@ +// 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.4_A3.2_T3; + * @section: 15.1.3.4; + * @assertion: unescapedURIComponentSet containing one instance of each character valid in uriUnescaped; + * @description: Complex tests, uriUnescaped :: uriMark; +*/ + +uriMark = ["-", "_", ".", "!", "~", "*", "'", "(", ")"]; +for (indexC = 0; indexC < uriMark.length; indexC++) { + var str = uriMark[indexC]; + if (encodeURIComponent(str) !== str) { + $ERROR('#' + (indexC + 1) + ': unescapedURISet containing' + str); + } +} 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.4_encodeURIComponent/S15.1.3.4_A3.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.4_encodeURIComponent/S15.1.3.4_A3.3_T1.js new file mode 100644 index 000000000..da0807f67 --- /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.4_encodeURIComponent/S15.1.3.4_A3.3_T1.js @@ -0,0 +1,13 @@ +// 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.4_A3.3_T1; + * @section: 15.1.3.4; + * @assertion: unescapedURIComponentSet not containing "#"; + * @description: encodeURIComponent("#") === "%23"; +*/ + +if (encodeURIComponent("#") !== "%23") { + $ERROR('#1: unescapedURIComponentSet not containing "%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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A4_T1.js new file mode 100644 index 000000000..a2d6da123 --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A4_T1; + * @section: 15.1.3.4; + * @assertion: URI tests; + * @description: Checking ENGLISH ALPHABET; +*/ + +//CHECK#1 +if (encodeURIComponent("http://unipro.ru/0123456789") !== "http%3A%2F%2Funipro.ru%2F0123456789") { + $ERROR('#1: http://unipro.ru/0123456789'); +} + +//CHECK#2 +if (encodeURIComponent("aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") !== "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ") { + $ERROR('#2: aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'); +} + +//CHECK#3 +if (encodeURIComponent(";/?:@&=+$,") !== "%3B%2F%3F%3A%40%26%3D%2B%24%2C") { + $ERROR('#3: '); +} 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A4_T2.js new file mode 100644 index 000000000..7d0db943e --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A4_T2; + * @section: 15.1.3.4; + * @assertion: URI tests; + * @description: Checking RUSSIAN ALPHABET; +*/ + +//CHECK#1 +if ((encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4") && (encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4".toLowerCase())) { + $ERROR('#1: http://ru.wikipedia.org/wiki/Юникод'); +} + +//CHECK#2 +if ((encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%23%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8") && (encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод#Ссылки") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4%23%D0%A1%D1%81%D1%8B%D0%BB%D0%BA%D0%B8".toLowerCase())) { + $ERROR('#2: http://ru.wikipedia.org/wiki/Юникод#Ссылки'); +} + +//CHECK#3 +if ((encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод#Версии Юникода") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F%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") && ((encodeURIComponent("http://ru.wikipedia.org/wiki/Юникод%23Версии Юникода") !== "http%3A%2F%2Fru.wikipedia.org%2Fwiki%2F" + "%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4#%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".toLowerCase()))) { + $ERROR('#3: http://ru.wikipedia.org/wiki/Юникод#Версии Юникода'); +} 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A4_T3.js new file mode 100644 index 000000000..e52810f6c --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A4_T3; + * @section: 15.1.3.4; + * @assertion: URI tests; + * @description: Checking URL with Line Terminator; +*/ + +//CHECK#1 +if ((encodeURIComponent("http://unipro.ru/\nabout") !== "http%3A%2F%2Funipro.ru%2F%0Aabout") && encodeURIComponent("http://unipro.ru/\nabout") !== "http%3A%2F%2Funipro.ru%2F%0aabout") { + $ERROR('#1: http://unipro.ru/\\nabout'); +} + +//CHECK#2 +if ((encodeURIComponent("http://unipro.ru/\vabout") !== "http%3A%2F%2Funipro.ru%2F%0Babout") && encodeURIComponent("http://unipro.ru/\vabout") !== "http%3A%2F%2Funipro.ru%2F%0babout") { + $ERROR('#2: http://unipro.ru/\\vabout'); +} + +//CHECK#3 +if ((encodeURIComponent("http://unipro.ru/\fabout") !== "http%3A%2F%2Funipro.ru%2F%0Cabout") && encodeURIComponent("http://unipro.ru/\fabout") !== "http%3A%2F%2Funipro.ru%2F%0cabout") { + $ERROR('#3: http://unipro.ru/\\fabout'); +} + +//CHECK#4 +if ((encodeURIComponent("http://unipro.ru/\rabout") !== "http%3A%2F%2Funipro.ru%2F%0Dabout") && encodeURIComponent("http://unipro.ru/\rabout") !== "http%3A%2F%2Funipro.ru%2F%0dabout") { + $ERROR('#4: http://unipro.ru/\\rabout'); +} 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A4_T4.js new file mode 100644 index 000000000..6a0459896 --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A4_T4; + * @section: 15.1.3.4; + * @assertion: URI tests; + * @description: Test some url; +*/ + +//CHECK#1 +if (encodeURIComponent("") !== "") { + $ERROR('#1: ""'); +} + +//CHECK#2 +if (encodeURIComponent("http://unipro.ru") !== "http%3A%2F%2Funipro.ru") { + $ERROR('#2: http://unipro.ru'); +} + +//CHECK#3 +if (encodeURIComponent("http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork") !== "http%3A%2F%2Fwww.google.ru%2Fsupport%2Fjobs%2Fbin%2Fstatic.py%3Fpage%3Dwhy-ru.html%26sid%3Dliveandwork") { + $ERROR('#3: http://www.google.ru/support/jobs/bin/static.py?page=why-ru.html&sid=liveandwork"'); +} + +//CHECK#4 +if (encodeURIComponent("http://en.wikipedia.org/wiki/UTF-8#Description") !== "http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FUTF-8%23Description") { + $ERROR('#4: http://en.wikipedia.org/wiki/UTF-8#Description'); +} 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.1.js new file mode 100644 index 000000000..08bc0319f --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A5.1; + * @section: 15.1.3.4, 15.2.4.7, 12.6.4; + * @assertion: The length property of encodeURIComponent has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (encodeURIComponent.propertyIsEnumerable('length') !== false) { + $ERROR('#1: encodeURIComponent.propertyIsEnumerable(\'length\') === false. Actual: ' + (encodeURIComponent.propertyIsEnumerable('length'))); +} + +//CHECK#2 +result = true; +for (p in encodeURIComponent){ + if (p === "length") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in encodeURIComponent) { 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.2.js new file mode 100644 index 000000000..1708a83a4 --- /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.4_encodeURIComponent/S15.1.3.4_A5.2.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.4_A5.2; + * @section: 15.1.3.4, 15.2.4.5, 11.4.1; + * @assertion: The length property of encodeURIComponent has the attribute DontDelete; + * @description: Checking use hasOwnProperty, delete; +*/ + +//CHECK#1 +if (encodeURIComponent.hasOwnProperty('length') !== true) { + $FAIL('#1: encodeURIComponent.hasOwnProperty(\'length\') === true. Actual: ' + (encodeURIComponent.hasOwnProperty('length'))); +} + +delete encodeURIComponent.length; + +//CHECK#2 +if (encodeURIComponent.hasOwnProperty('length') !== true) { + $ERROR('#2: delete encodeURIComponent.length; encodeURIComponent.hasOwnProperty(\'length\') === true. Actual: ' + (encodeURIComponent.hasOwnProperty('length'))); +} + +//CHECK#3 +if (encodeURIComponent.length === undefined) { + $ERROR('#3: delete encodeURIComponent.length; encodeURIComponent.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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.3.js new file mode 100644 index 000000000..ad8abb9f5 --- /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.4_encodeURIComponent/S15.1.3.4_A5.3.js @@ -0,0 +1,17 @@ +// 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.4_A5.3; + * @section: 15.1.3.4; + * @assertion: The length property of encodeURIComponent has the attribute ReadOnly; + * @description: Checking if varying the length property fails; +*/ + +//CHECK#1 +x = encodeURIComponent.length; +encodeURIComponent.length = Infinity; +if (encodeURIComponent.length !== x) { + $ERROR('#1: x = encodeURIComponent.length; encodeURIComponent.length = Infinity; encodeURIComponent.length === x. Actual: ' + (encodeURIComponent.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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.4.js new file mode 100644 index 000000000..2c01443c0 --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A5.4; + * @section: 15.1.3.4; + * @assertion: The length property of encodeURIComponent is 1; + * @description: encodeURIComponent.length === 1; +*/ + +//CHECK#1 +if (encodeURIComponent.length !== 1) { + $ERROR('#1: encodeURIComponent.length === 1. Actual: ' + (encodeURIComponent.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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.5.js new file mode 100644 index 000000000..fe17d537b --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A5.5; + * @section: 15.1.3.4, 15.2.4.7, 12.6.4; + * @assertion: The encodeURIComponent property has the attribute DontEnum; + * @description: Checking use propertyIsEnumerable, for-in; +*/ + + +//CHECK#1 +if (this.propertyIsEnumerable('encodeURIComponent') !== false) { + $ERROR('#1: this.propertyIsEnumerable(\'encodeURIComponent\') === false. Actual: ' + (this.propertyIsEnumerable('encodeURIComponent'))); +} + +//CHECK#2 +result = true; +for (p in this){ + if (p === "encodeURIComponent") { + result = false; + } +} + +if (result !== true) { + $ERROR('#2: result = true; for (p in this) { if (p === "encodeURIComponent") 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.6.js new file mode 100644 index 000000000..3705c27b9 --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A5.6; +* @section: 15.1.3.4; +* @assertion: The encodeURIComponent property has not prototype property; +* @description: Checking encodeURIComponent.prototype; +*/ + +//CHECK#1 +if (encodeURIComponent.prototype !== undefined) { + $ERROR('#1: encodeURIComponent.prototype === undefined. Actual: ' + (encodeURIComponent.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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A5.7.js new file mode 100644 index 000000000..09bf8aa3e --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A5.7; +* @section: 15.1.3.4, 11.2.2; +* @assertion: The encodeURIComponent 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 encodeURIComponent(); + $ERROR('#1.1: new encodeURIComponent() throw TypeError. Actual: ' + (new encodeURIComponent())); +} catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: new encodeURIComponent() 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.4_encodeURIComponent/S15.1.3.4_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.4_encodeURIComponent/S15.1.3.4_A6_T1.js new file mode 100644 index 000000000..2023af5d8 --- /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.4_encodeURIComponent/S15.1.3.4_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.4_A6_T1; + * @section: 15.1.3.4, 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 "^"}}; +if (encodeURIComponent(object) !== "%5Bobject%20Object%5D") { + $ERROR('#1: var object = {valueOf: function() {return "^"}}; encodeURIComponent(object) === %5Bobject%20Object%5D. Actual: ' + (encodeURIComponent(object))); +} + +//CHECK#2 +var object = {valueOf: function() {return ""}, toString: function() {return "^"}}; +if (encodeURIComponent(object) !== "%5E") { + $ERROR('#2: var object = {valueOf: function() {return ""}, toString: function() {return "^"}}; encodeURIComponent(object) === "%5E". Actual: ' + (encodeURIComponent(object))); +} + +//CHECK#3 +var object = {valueOf: function() {return "^"}, toString: function() {return {}}}; +if (encodeURIComponent(object) !== "%5E") { + $ERROR('#3: var object = {valueOf: function() {return "^"}, toString: function() {return {}}}; encodeURIComponent(object) === "%5E". Actual: ' + (encodeURIComponent(object))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; + if (encodeURIComponent(object) !== "%5E") { + $ERROR('#4.1: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURIComponent(object) === "%5E". Actual: ' + (encodeURIComponent(object))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURIComponent(object) not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {throw "error"}, toString: function() {return "^"}}; encodeURIComponent(object) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return "^"}}; +if (encodeURIComponent(object) !== "%5E") { + $ERROR('#5: var object = {toString: function() {return "^"}}; encodeURIComponent(object) === "%5E". Actual: ' + (encodeURIComponent(object))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return "^"}} +if (encodeURIComponent(object) !== "%5E") { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return "^"}}; encodeURIComponent(object) === "%5E". Actual: ' + (encodeURIComponent(object))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; + encodeURIComponent(object); + $ERROR('#7.1: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURIComponent(object) throw "error". Actual: ' + (encodeURIComponent(object))); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {return "^"}, toString: function() {throw "error"}}; encodeURIComponent(object) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + encodeURIComponent(object); + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURIComponent(object) throw TypeError. Actual: ' + (encodeURIComponent(object))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; encodeURIComponent(object) throw TypeError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T1.js new file mode 100644 index 000000000..086b61bc5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1_A1_T1; + * @section: 15.1; + * @assertion: The global object does not have a [[Construct]] property; + * @description: It is not possible to use the global object as a constructor + * with the new operator; + * @negative +*/ + +new this; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T2.js new file mode 100644 index 000000000..58a46e125 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A1_T2.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1_A1_T2; + * @section: 15.1; + * @assertion: The global object does not have a [[Construct]] property; + * @description: It is not possible to use the global object as a constructor + * with the new operator; + * @negative +*/ + +new this(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A2_T1.js new file mode 100644 index 000000000..050e0a84c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.1_The_Global_Object/S15.1_A2_T1.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.1_A2_T1; + * @section: 15.1; + * @assertion: The global object does not have a [[Call]] property; + * @description: It is not possible to invoke the global object as a function; + * @negative +*/ + +this(); |