From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- js/src/tests/test262/ch09/9.7/S9.7_A1.js | 54 ++++++++++++++++++ js/src/tests/test262/ch09/9.7/S9.7_A2.1.js | 55 +++++++++++++++++++ js/src/tests/test262/ch09/9.7/S9.7_A2.2.js | 70 ++++++++++++++++++++++++ js/src/tests/test262/ch09/9.7/S9.7_A3.1_T1.js | 20 +++++++ js/src/tests/test262/ch09/9.7/S9.7_A3.1_T2.js | 20 +++++++ js/src/tests/test262/ch09/9.7/S9.7_A3.1_T3.js | 20 +++++++ js/src/tests/test262/ch09/9.7/S9.7_A3.1_T4.js | 79 +++++++++++++++++++++++++++ js/src/tests/test262/ch09/9.7/S9.7_A3.2_T1.js | 20 +++++++ js/src/tests/test262/ch09/9.7/browser.js | 0 js/src/tests/test262/ch09/9.7/shell.js | 0 10 files changed, 338 insertions(+) create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A1.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A2.1.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A2.2.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A3.1_T1.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A3.1_T2.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A3.1_T3.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A3.1_T4.js create mode 100644 js/src/tests/test262/ch09/9.7/S9.7_A3.2_T1.js create mode 100644 js/src/tests/test262/ch09/9.7/browser.js create mode 100644 js/src/tests/test262/ch09/9.7/shell.js (limited to 'js/src/tests/test262/ch09/9.7') diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A1.js b/js/src/tests/test262/ch09/9.7/S9.7_A1.js new file mode 100644 index 000000000..443711768 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A1.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If value is NaN, +0, -0, +Infinity, or -Infinity, return +0 + * + * @path ch09/9.7/S9.7_A1.js + * @description For testing use String.fromCharCode(Number).charCodeAt(0) construction + */ + +// CHECK#1 +if (String.fromCharCode(Number.NaN).charCodeAt(0) !== +0) { + $ERROR('#1.1: String.fromCharCode(Number.NaN).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.NaN).charCodeAt(0))); +} else if (1/String.fromCharCode(Number.NaN).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: String.fromCharCode(Number.NaN).charCodeAt(0) === +0. Actual: -0'); +} + +// CHECK#2 +if (String.fromCharCode(Number("abc")).charCodeAt(0) !== +0) { + $ERROR('#2.1: String.fromCharCode(Number("abc")).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number("abc")).charCodeAt(0))); +} else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0'); +} + +// CHECK#3 +if (String.fromCharCode(0).charCodeAt(0) !== +0) { + $ERROR('#3.1: String.fromCharCode(0).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(0).charCodeAt(0))); +} else if (1/String.fromCharCode(0).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: String.fromCharCode(0).charCodeAt(0) === +0. Actual: -0'); +} + +// CHECK#4 +if (String.fromCharCode(-0).charCodeAt(0) !== +0) { + $ERROR("#4.1: String.fromCharCode(-0).charCodeAt(0) === +0"); +} else if (1/String.fromCharCode(-0).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR("#4.2: String.fromCharCode(-0).charCodeAt(0) === +0. Actual: -0"); +} + +// CHECK#5 +if (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== +0) { + $ERROR('#5.1: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0))); +} else if (1/String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) === +0. Actual: -0'); +} + +// CHECK#6 +if (String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== +0) { + $ERROR("#6.1: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0"); +} else if (1/String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) !== Number.POSITIVE_INFINITY) { + $ERROR("#6.2: String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) === +0. Actual: -0"); +} + + + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A2.1.js b/js/src/tests/test262/ch09/9.7/S9.7_A2.1.js new file mode 100644 index 000000000..5073f9c87 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A2.1.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. + +/** + * ToUint16 returns values between 0 and 2^16-1 + * + * @path ch09/9.7/S9.7_A2.1.js + * @description Converting numbers, which are in\outside of Uint16 scopes, with String.fromCharCode(Number).charCodeAt(0) construction + */ + +// CHECK#1 +if (String.fromCharCode(0).charCodeAt(0) !== 0) { + $ERROR('#1: String.fromCharCode(0).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(0).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode(1).charCodeAt(0) !== 1) { + $ERROR('#2: String.fromCharCode(1).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(1).charCodeAt(0))); +} + +// CHECK#3 +if (String.fromCharCode(-1).charCodeAt(0) !== 65535) { + $ERROR('#3: String.fromCharCode(-1).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-1).charCodeAt(0))); +} + +// CHECK#4 +if (String.fromCharCode(65535).charCodeAt(0) !== 65535) { + $ERROR('#4: String.fromCharCode(65535).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(65535).charCodeAt(0))); +} + +// CHECK#5 +if (String.fromCharCode(65534).charCodeAt(0) !== 65534) { + $ERROR('#5: String.fromCharCode(65534).charCodeAt(0) === 65534. Actual: ' + (String.fromCharCode(65534).charCodeAt(0))); +} + +// CHECK#6 +if (String.fromCharCode(65536).charCodeAt(0) !== 0) { + $ERROR('#6: String.fromCharCode(65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(65536).charCodeAt(0))); +} + +// CHECK#7 +if (String.fromCharCode(4294967295).charCodeAt(0) !== 65535) { + $ERROR('#7: String.fromCharCode(4294967295).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(4294967295).charCodeAt(0))); +} + +// CHECK#8 +if (String.fromCharCode(4294967294).charCodeAt(0) !== 65534) { + $ERROR('#8: String.fromCharCode(4294967294).charCodeAt(0) === 65534. Actual: ' + (String.fromCharCode(4294967294).charCodeAt(0))); +} + +// CHECK#9 +if (String.fromCharCode(4294967296).charCodeAt(0) !== 0) { + $ERROR('#9: String.fromCharCode(4294967296).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(4294967296).charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A2.2.js b/js/src/tests/test262/ch09/9.7/S9.7_A2.2.js new file mode 100644 index 000000000..d631bd912 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A2.2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Compute result modulo 2^16 + * + * @path ch09/9.7/S9.7_A2.2.js + * @description For testing use String.fromCharCode(Number).charCodeAt(0) construction + */ + +// CHECK#1 +if (String.fromCharCode(-32767).charCodeAt(0) !== 32769) { + $ERROR('#1: String.fromCharCode(-32767).charCodeAt(0) === 32769. Actual: ' + (String.fromCharCode(-32767).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode(-32768).charCodeAt(0) !== 32768) { + $ERROR('#2: String.fromCharCode(-32768).charCodeAt(0) === 32768. Actual: ' + (String.fromCharCode(-32768).charCodeAt(0))); +} + +// CHECK#3 +if (String.fromCharCode(-32769).charCodeAt(0) !== 32767) { + $ERROR('#3: String.fromCharCode(-32769).charCodeAt(0) === 32767. Actual: ' + (String.fromCharCode(-32769).charCodeAt(0))); +} + +// CHECK#4 +if (String.fromCharCode(-65535).charCodeAt(0) !== 1) { + $ERROR('#4: String.fromCharCode(-65535).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(-65535).charCodeAt(0))); +} + +// CHECK#5 +if (String.fromCharCode(-65536).charCodeAt(0) !== 0) { + $ERROR('#5: String.fromCharCode(-65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(-65536).charCodeAt(0))); +} + +// CHECK#6 +if (String.fromCharCode(-65537).charCodeAt(0) !== 65535) { + $ERROR('#6: String.fromCharCode(-65537).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-65537).charCodeAt(0))); +} + +// CHECK#7 +if (String.fromCharCode(65535).charCodeAt(0) !== 65535) { + $ERROR('#7: String.fromCharCode(65535).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(65535).charCodeAt(0))); +} + +// CHECK#8 +if (String.fromCharCode(65536).charCodeAt(0) !== 0) { + $ERROR('#8: String.fromCharCode(65536).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(65536).charCodeAt(0))); +} + +// CHECK#9 +if (String.fromCharCode(65537).charCodeAt(0) !== 1) { + $ERROR('#9: String.fromCharCode(65537).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(65537).charCodeAt(0))); +} + +// CHECK#10 +if (String.fromCharCode(131071).charCodeAt(0) !== 65535) { + $ERROR('#10: String.fromCharCode(131071).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(131071).charCodeAt(0))); +} + +// CHECK#11 +if (String.fromCharCode(131072).charCodeAt(0) !== 0) { + $ERROR('#11: String.fromCharCode(131072).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(131072).charCodeAt(0))); +} + +// CHECK#12 +if (String.fromCharCode(131073).charCodeAt(0) !== 1) { + $ERROR('#12: String.fromCharCode(131073).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(131073).charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T1.js b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T1.js new file mode 100644 index 000000000..315b133d2 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.7/S9.7_A3.1_T1.js + * @description Type(x) is Boolean + */ + +// CHECK#1 +if (String.fromCharCode(new Boolean(true)).charCodeAt(0) !== 1) { + $ERROR('#1: String.fromCharCode(new Boolean(true)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new Boolean(true)).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode(false).charCodeAt(0) !== 0) { + $ERROR('#2: String.fromCharCode(false).charCodeAt(0) === 0. Actual: ' + (String.fromCharCode(false).charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T2.js b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T2.js new file mode 100644 index 000000000..613229333 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T2.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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.7/S9.7_A3.1_T2.js + * @description Type(x) is Number + */ + +// CHECK#1 +if (String.fromCharCode(new Number(1)).charCodeAt(0) !== 1) { + $ERROR('#1: String.fromCharCode(new Number(1)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new Number(1)).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode(-1.234).charCodeAt(0) !== 65535) { + $ERROR('#2: String.fromCharCode(-1.234).charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode(-1.234).charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T3.js b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T3.js new file mode 100644 index 000000000..ff66475ca --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_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. + +/** + * Operator uses ToNumber + * + * @path ch09/9.7/S9.7_A3.1_T3.js + * @description Type(x) is String + */ + +// CHECK#1 +if (String.fromCharCode(new String(1)).charCodeAt(0) !== 1) { + $ERROR('#1: String.fromCharCode(new String(1)).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(new String(1)).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode("-1.234").charCodeAt(0) !== 65535) { + $ERROR('#2: String.fromCharCode("-1.234").charCodeAt(0) === 65535. Actual: ' + (String.fromCharCode("-1.234").charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T4.js b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T4.js new file mode 100644 index 000000000..49627e759 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A3.1_T4.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator uses ToNumber + * + * @path ch09/9.7/S9.7_A3.1_T4.js + * @description Type(x) is Object + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (String.fromCharCode(object).charCodeAt(0) !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; String.fromCharCode(object).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(object).charCodeAt(0))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + object >>> 0; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object throw "error". Actual: ' + (object >>> 0)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + object >>> 0; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (object >>> 0)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch09/9.7/S9.7_A3.2_T1.js b/js/src/tests/test262/ch09/9.7/S9.7_A3.2_T1.js new file mode 100644 index 000000000..b7b6ecbbe --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/S9.7_A3.2_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. + +/** + * Operator uses floor, abs + * + * @path ch09/9.7/S9.7_A3.2_T1.js + * @description For testing use String.fromCharCode(Number).charCodeAt(0) construction + */ + +// CHECK#1 +if (String.fromCharCode(1.2345).charCodeAt(0) !== 1) { + $ERROR('#1: String.fromCharCode(1.2345).charCodeAt(0) === 1. Actual: ' + (String.fromCharCode(1.2345).charCodeAt(0))); +} + +// CHECK#2 +if (String.fromCharCode(-5.4321).charCodeAt(0) !== 65531) { + $ERROR('#2: String.fromCharCode(-5.4321).charCodeAt(0) === 65531. Actual: ' + (String.fromCharCode(-5.4321).charCodeAt(0))); +} + diff --git a/js/src/tests/test262/ch09/9.7/browser.js b/js/src/tests/test262/ch09/9.7/browser.js new file mode 100644 index 000000000..e69de29bb diff --git a/js/src/tests/test262/ch09/9.7/shell.js b/js/src/tests/test262/ch09/9.7/shell.js new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3