diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch09 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch09')
152 files changed, 5266 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch09/9.1/S9.1_A1_T1.js b/js/src/tests/test262/ch09/9.1/S9.1_A1_T1.js new file mode 100644 index 000000000..662591054 --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/S9.1_A1_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of primitive conversion from object is a default value for the Object + * + * @path ch09/9.1/S9.1_A1_T1.js + * @description Using operator Number. The operator calls ToPrimitive with hint Number + */ + +// CHECK#1 +var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; +if (Number(object) !== 1) { + $ERROR('#1: var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; Number(object) === 1. Actual: ' + (Number(object))); +} + +// CHECK#2 +var object = {valueOf: function() {return {}}, toString: function() {return "0"}}; +if (Number(object) !== 0) { + $ERROR('#2: var object = {valueOf: function() {return {}}, toString: function() {return "0"}}; Number(object) === 0. Actual: ' + (Number(object))); +} + + diff --git a/js/src/tests/test262/ch09/9.1/S9.1_A1_T2.js b/js/src/tests/test262/ch09/9.1/S9.1_A1_T2.js new file mode 100644 index 000000000..636591dab --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/S9.1_A1_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of primitive conversion from object is a default value for the Object + * + * @path ch09/9.1/S9.1_A1_T2.js + * @description Using operator Number. This operator calls ToPrimitive with hint Number + */ + +// CHECK#1 +var object = {valueOf: function() {return 0}, toString: function() {return 1}}; +if (String(object) !== "1") { + $ERROR('#1: var object = {valueOf: function() {return 0}, toString: function() {return 1}}; String(object) === "1". Actual: ' + (String(object))); +} + +// CHECK#2 +var object = {valueOf: function() {return 0}, toString: function() {return {}}}; +if (String(object) !== "0") { + $ERROR('#2: var object = {valueOf: function() {return 0}, toString: function() {return {}}}; String(object) === "0". Actual: ' + (String(object))); +} + + diff --git a/js/src/tests/test262/ch09/9.1/S9.1_A1_T3.js b/js/src/tests/test262/ch09/9.1/S9.1_A1_T3.js new file mode 100644 index 000000000..cf418eeef --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/S9.1_A1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of primitive conversion from object is a default value for the Object + * + * @path ch09/9.1/S9.1_A1_T3.js + * @description Using operator "+". This operator firstly calls ToPrimitive and then calls ToString or ToNumber + */ + +// CHECK#1 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (object + "" !== "1") { + $ERROR('#1: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object + "" === "1". Actual: ' + (object + "")); +} + +// CHECK#2 +var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; +if (object + 0 !== "10") { + $ERROR('#2: var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; object + 0 === "10". Actual: ' + (object + 0)); +} + + diff --git a/js/src/tests/test262/ch09/9.1/S9.1_A1_T4.js b/js/src/tests/test262/ch09/9.1/S9.1_A1_T4.js new file mode 100644 index 000000000..9dcd88f50 --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/S9.1_A1_T4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of primitive conversion from object is a default value for the Object + * + * @path ch09/9.1/S9.1_A1_T4.js + * @description Using operator "<". The operator firstly calls ToPrimitive and then calls ToString or ToNumber + */ + +// CHECK#1 +var object = {valueOf: function() {return -2}, toString: function() {return "-2"}}; +if ("-1" < object) { + $ERROR('#1: var object = {valueOf: function() {return -2}, toString: function() {return "-2"}}; "-1" < object'); +} + +// CHECK#2 +var object = {valueOf: function() {return "-2"}, toString: function() {return -2}}; +if (object < "-1") { + $ERROR('#2: var object = {valueOf: function() {return "-2"}, toString: function() {return -2}}; object < "-1"'); +} + + diff --git a/js/src/tests/test262/ch09/9.1/browser.js b/js/src/tests/test262/ch09/9.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/browser.js diff --git a/js/src/tests/test262/ch09/9.1/shell.js b/js/src/tests/test262/ch09/9.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.1/shell.js diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A1_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A1_T1.js new file mode 100644 index 000000000..44bbaae6a --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A1_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. + +/** + * Result of boolean conversion from undefined value is false + * + * @path ch09/9.2/S9.2_A1_T1.js + * @description Undefined, void and others are converted to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(undefined) !== false) { + $ERROR('#1: Boolean(undefined) === false. Actual: ' + (Boolean(undefined))); +} + +// CHECK#2 +if (Boolean(void 0) !== false) { + $ERROR('#2: Boolean(undefined) === false. Actual: ' + (Boolean(undefined))); +} + +// CHECK#3 +if (Boolean(eval("var x")) !== false) { + $ERROR('#3: Boolean(eval("var x")) === false. Actual: ' + (Boolean(eval("var x")))); +} + +// CHECK#4 +if (Boolean() !== false) { + $ERROR('#4: Boolean() === false. Actual: ' + (Boolean())); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A1_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A1_T2.js new file mode 100644 index 000000000..0700b8da6 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A1_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. + +/** + * Result of boolean conversion from undefined value is false + * + * @path ch09/9.2/S9.2_A1_T2.js + * @description Undefined, void and others are converted to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(undefined) !== true) { + $ERROR('#1: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#2 +if (!(void 0) !== true) { + $ERROR('#2: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#3 +if (!(eval("var x")) !== true) { + $ERROR('#3: !(eval("var x")) === true. Actual: ' + (!(eval("var x")))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A2_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A2_T1.js new file mode 100644 index 000000000..c53da91bf --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A2_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. + +/** + * Result of boolean conversion from null value is false + * + * @path ch09/9.2/S9.2_A2_T1.js + * @description null convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(null) !== false) { + $ERROR('#1: Boolean(null) === false. Actual: ' + (Boolean(null))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A2_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A2_T2.js new file mode 100644 index 000000000..ffd391b90 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.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. + +/** + * Result of boolean conversion from null value is false + * + * @path ch09/9.2/S9.2_A2_T2.js + * @description null convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(null) !== true) { + $ERROR('#1: !(null) === true. Actual: ' + (!(null))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A3_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A3_T1.js new file mode 100644 index 000000000..103f4eab3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A3_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. + +/** + * Result of boolean conversion from boolean value is no conversion + * + * @path ch09/9.2/S9.2_A3_T1.js + * @description true and false convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(true) !== true) { + $ERROR('#1: Boolean(true) === true. Actual: ' + (Boolean(true))); +} + +// CHECK#2 +if (Boolean(false) !== false) { + $ERROR('#2: Boolean(false) === false. Actual: ' + (Boolean(false))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A3_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A3_T2.js new file mode 100644 index 000000000..d1ede1c6d --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A3_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. + +/** + * Result of boolean conversion from boolean value is no conversion + * + * @path ch09/9.2/S9.2_A3_T2.js + * @description true and false convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(true) !== false) { + $ERROR('#1: !(true) === false. Actual: ' + (!(true))); +} + +// CHECK#2 +if (!(false) !== true) { + $ERROR('#2: !(false) === true. Actual: ' + (!(false))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A4_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A4_T1.js new file mode 100644 index 000000000..71860cac8 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A4_T1.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. + +/** + * Result of boolean conversion from number value is false if the argument is +0, -0, or NaN; otherwise, is true + * + * @path ch09/9.2/S9.2_A4_T1.js + * @description +0, -0 and NaN convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(+0) !== false) { + $ERROR('#1: Boolean(+0) === false. Actual: ' + (Boolean(+0))); +} + +// CHECK#2 +if (Boolean(-0) !== false) { + $ERROR('#2: Boolean(-0) === false. Actual: ' + (Boolean(-0))); +} + +// CHECK#3 +if (Boolean(Number.NaN) !== false) { + $ERROR('#3: Boolean(Number.NaN) === false. Actual: ' + (Boolean(Number.NaN))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A4_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A4_T2.js new file mode 100644 index 000000000..66047bea5 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A4_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. + +/** + * Result of boolean conversion from number value is false if the argument is +0, -0, or NaN; otherwise, is true + * + * @path ch09/9.2/S9.2_A4_T2.js + * @description +0, -0 and NaN convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(+0) !== true) { + $ERROR('#1: !(+0) === true. Actual: ' + (!(+0))); +} + +// CHECK#2 +if (!(-0) !== true) { + $ERROR('#2: !(-0) === true. Actual: ' + (!(-0))); +} + +// CHECK#3 +if (!(Number.NaN) !== true) { + $ERROR('#3: !(Number.NaN) === true. Actual: ' + (!(Number.NaN))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A4_T3.js b/js/src/tests/test262/ch09/9.2/S9.2_A4_T3.js new file mode 100644 index 000000000..9a16966d6 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A4_T3.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of boolean conversion from number value is false if the argument is +0, -0, or NaN; otherwise, is true + * + * @path ch09/9.2/S9.2_A4_T3.js + * @description Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + * Number.MAX_VALUE, Number.MIN_VALUE and some numbers convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(Number.POSITIVE_INFINITY) !== true) { + $ERROR('#1: Boolean(+Infinity) === true. Actual: ' + (Boolean(+Infinity))); +} + +// CHECK#2; +if (Boolean(Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#2: Boolean(-Infinity) === true. Actual: ' + (Boolean(-Infinity))); +} + +// CHECK#3 +if (Boolean(Number.MAX_VALUE) !== true) { + $ERROR('#3: Boolean(Number.MAX_VALUE) === true. Actual: ' + (Boolean(Number.MAX_VALUE))); +} + +// CHECK#4 +if (Boolean(Number.MIN_VALUE) !== true) { + $ERROR('#4: Boolean(Number.MIN_VALUE) === true. Actual: ' + (Boolean(Number.MIN_VALUE))); +} + +// CHECK#5 +if (Boolean(13) !== true) { + $ERROR('#5: Boolean(13) === true. Actual: ' + (Boolean(13))); +} + +// CHECK#6 +if (Boolean(-13) !== true) { + $ERROR('#6: Boolean(-13) === true. Actual: ' + (Boolean(-13))); +} + +// CHECK#7 +if (Boolean(1.3) !== true) { + $ERROR('#7: Boolean(1.3) === true. Actual: ' + (Boolean(1.3))); +} + +// CHECK#8 +if (Boolean(-1.3) !== true) { + $ERROR('#8: Boolean(-1.3) === true. Actual: ' + (Boolean(-1.3))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A4_T4.js b/js/src/tests/test262/ch09/9.2/S9.2_A4_T4.js new file mode 100644 index 000000000..692ab77bf --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A4_T4.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of boolean conversion from number value is false if the argument is +0, -0, or NaN; otherwise, is true + * + * @path ch09/9.2/S9.2_A4_T4.js + * @description Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + * Number.MAX_VALUE, Number.MIN_VALUE and some other numbers are converted to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(Number.POSITIVE_INFINITY) !== false) { + $ERROR('#1: !(+Infinity) === false. Actual: ' + (!(+Infinity))); +} + +// CHECK#2; +if (!(Number.NEGATIVE_INFINITY) !== false) { + $ERROR('#2: !(-Infinity) === false. Actual: ' + (!(-Infinity))); +} + +// CHECK#3 +if (!(Number.MAX_VALUE) !== false) { + $ERROR('#3: !(Number.MAX_VALUE) === false. Actual: ' + (!(Number.MAX_VALUE))); +} + +// CHECK#4 +if (!(Number.MIN_VALUE) !== false) { + $ERROR('#4: !(Number.MIN_VALUE) === false. Actual: ' + (!(Number.MIN_VALUE))); +} + +// CHECK#5 +if (!(13) !== false) { + $ERROR('#5: !(13) === false. Actual: ' + (!(13))); +} + +// CHECK#6 +if (!(-13) !== false) { + $ERROR('#6: !(-13) === false. Actual: ' + (!(-13))); +} + +// CHECK#7 +if (!(1.3) !== false) { + $ERROR('#7: !(1.3) === false. Actual: ' + (!(1.3))); +} + +// CHECK#8 +if (!(-1.3) !== false) { + $ERROR('#8: !(-1.3) === false. Actual: ' + (!(-1.3))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A5_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A5_T1.js new file mode 100644 index 000000000..293ee2375 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A5_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. + +/** + * Result of boolean conversion from nonempty string value (length is not zero) is true; from empty String (length is zero) is false + * + * @path ch09/9.2/S9.2_A5_T1.js + * @description "" is converted to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean("") !== false) { + $ERROR('#1: Boolean("") === false. Actual: ' + (Boolean(""))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A5_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A5_T2.js new file mode 100644 index 000000000..de391a329 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A5_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. + +/** + * Result of boolean conversion from nonempty string value (length is not zero) is true; from empty String (length is zero) is false + * + * @path ch09/9.2/S9.2_A5_T2.js + * @description "" convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!("") !== true) { + $ERROR('#1: !("") === true. Actual: ' + (!(""))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A5_T3.js b/js/src/tests/test262/ch09/9.2/S9.2_A5_T3.js new file mode 100644 index 000000000..f8f185c59 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A5_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. + +/** + * Result of boolean conversion from nonempty string value (length is not zero) is true; from empty String (length is zero) is false + * + * @path ch09/9.2/S9.2_A5_T3.js + * @description Any nonempty string convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(" ") !== true) { + $ERROR('#1: Boolean(" ") === true. Actual: ' + (Boolean(" "))); +} + +// CHECK#2 +if (Boolean("Nonempty String") !== true) { + $ERROR('#2: Boolean("Nonempty String") === true. Actual: ' + (Boolean("Nonempty String"))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A5_T4.js b/js/src/tests/test262/ch09/9.2/S9.2_A5_T4.js new file mode 100644 index 000000000..c8ea44e9d --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A5_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. + +/** + * Result of boolean conversion from nonempty string value (length is not zero) is true; from empty String (length is zero) is false + * + * @path ch09/9.2/S9.2_A5_T4.js + * @description Any nonempty string convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(" ") !== false) { + $ERROR('#1: !(" ") === false. Actual: ' + (!(" "))); +} + +// CHECK#2 +if (!("Nonempty String") !== false) { + $ERROR('#2: !("Nonempty String") === false. Actual: ' + (!("Nonempty String"))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A6_T1.js b/js/src/tests/test262/ch09/9.2/S9.2_A6_T1.js new file mode 100644 index 000000000..72bb34e26 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A6_T1.js @@ -0,0 +1,105 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of boolean conversion from object is true + * + * @path ch09/9.2/S9.2_A6_T1.js + * @description Different objects convert to Boolean by explicit transformation + */ + +// CHECK#1 +if (Boolean(new Object()) !== true) { + $ERROR('#1: Boolean(new Object()) === true. Actual: ' + (Boolean(new Object()))); +} + +// CHECK#2 +if (Boolean(new String("")) !== true) { + $ERROR('#2: Boolean(new String("")) === true. Actual: ' + (Boolean(new String("")))); +} + +// CHECK#3 +if (Boolean(new String()) !== true) { + $ERROR('#3: Boolean(new String()) === true. Actual: ' + (Boolean(new String()))); +} + +// CHECK#4 +if (Boolean(new Boolean(true)) !== true) { + $ERROR('#4: Boolean(new Boolean(true)) === true. Actual: ' + (Boolean(new Boolean(true)))); +} + +// CHECK#5 +if (Boolean(new Boolean(false)) !== true) { + $ERROR('#5: Boolean(new Boolean(false)) === true. Actual: ' + (Boolean(new Boolean(false)))); +} + +// CHECK#6 +if (Boolean(new Boolean()) !== true) { + $ERROR('#6: Boolean(new Boolean()) === true. Actual: ' + (Boolean(new Boolean()))); +} + +// CHECK#7 +if (Boolean(new Array()) !== true) { + $ERROR('#7: Boolean(new Array()) === true. Actual: ' + (Boolean(new Array()))); +} + +// CHECK#8 +if (Boolean(new Number()) !== true) { + $ERROR('#8: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number()))); +} + +// CHECK#9 +if (Boolean(new Number(-0)) !== true) { + $ERROR('#9: Boolean(new Number(-0)) === true. Actual: ' + (Boolean(new Number(-0)))); +} + +// CHECK#10 +if (Boolean(new Number(0)) !== true) { + $ERROR('#10: Boolean(new Number(0)) === true. Actual: ' + (Boolean(new Number(0)))); +} + +// CHECK#11 +if (Boolean(new Number()) !== true) { + $ERROR('#11: Boolean(new Number()) === true. Actual: ' + (Boolean(new Number()))); +} + +// CHECK#12 +if (Boolean(new Number(Number.NaN)) !== true) { + $ERROR('#12: Boolean(new Number(Number.NaN)) === true. Actual: ' + (Boolean(new Number(Number.NaN)))); +} + +// CHECK#13 +if (Boolean(new Number(-1)) !== true) { + $ERROR('#13: Boolean(new Number(-1)) === true. Actual: ' + (Boolean(new Number(-1)))); +} + +// CHECK#14 +if (Boolean(new Number(1)) !== true) { + $ERROR('#14: Boolean(new Number(1)) === true. Actual: ' + (Boolean(new Number(1)))); +} + +// CHECK#15 +if (Boolean(new Number(Number.POSITIVE_INFINITY)) !== true) { + $ERROR('#15: Boolean(new Number(Number.POSITIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.POSITIVE_INFINITY)))); +} + +// CHECK#16 +if (Boolean(new Number(Number.NEGATIVE_INFINITY)) !== true) { + $ERROR('#16: Boolean(new Number(Number.NEGATIVE_INFINITY)) === true. Actual: ' + (Boolean(new Number(Number.NEGATIVE_INFINITY)))); +} + +// CHECK#17 +if (Boolean(new Function()) !== true) { + $ERROR('#17: Boolean(new Function()) === true. Actual: ' + (Boolean(new Function()))); +} + +// CHECK#18 +if (Boolean(new Date()) !== true) { + $ERROR('#18: Boolean(new Date()) === true. Actual: ' + (Boolean(new Date()))); +} + +// CHECK#19 +if (Boolean(new Date(0)) !== true) { + $ERROR('#19: Boolean(new Date(0)) === true. Actual: ' + (Boolean(new Date(0)))); +} + diff --git a/js/src/tests/test262/ch09/9.2/S9.2_A6_T2.js b/js/src/tests/test262/ch09/9.2/S9.2_A6_T2.js new file mode 100644 index 000000000..54dbbb6f3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/S9.2_A6_T2.js @@ -0,0 +1,105 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of boolean conversion from object is true + * + * @path ch09/9.2/S9.2_A6_T2.js + * @description Different objects convert to Boolean by implicit transformation + */ + +// CHECK#1 +if (!(new Object()) !== false) { + $ERROR('#1: !(new Object()) === false. Actual: ' + (!(new Object()))); +} + +// CHECK#2 +if (!(new String("")) !== false) { + $ERROR('#2: !(new String("")) === false. Actual: ' + (!(new String("")))); +} + +// CHECK#3 +if (!(new String()) !== false) { + $ERROR('#3: !(new String()) === false. Actual: ' + (!(new String()))); +} + +// CHECK#4 +if (!(new Boolean(true)) !== false) { + $ERROR('#4: !(new Boolean(true)) === false. Actual: ' + (!(new Boolean(true)))); +} + +// CHECK#5 +if (!(new Boolean(false)) !== false) { + $ERROR('#5: !(new Boolean(false)) === false. Actual: ' + (!(new Boolean(false)))); +} + +// CHECK#6 +if (!(new Boolean()) !== false) { + $ERROR('#6: !(new Boolean()) === false. Actual: ' + (!(new Boolean()))); +} + +// CHECK#7 +if (!(new Array()) !== false) { + $ERROR('#7: !(new Array()) === false. Actual: ' + (!(new Array()))); +} + +// CHECK#8 +if (!(new Number()) !== false) { + $ERROR('#8: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#9 +if (!(new Number(-0)) !== false) { + $ERROR('#9: !(new Number(-0)) === false. Actual: ' + (!(new Number(-0)))); +} + +// CHECK#10 +if (!(new Number(0)) !== false) { + $ERROR('#10: !(new Number(0)) === false. Actual: ' + (!(new Number(0)))); +} + +// CHECK#11 +if (!(new Number()) !== false) { + $ERROR('#11: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#12 +if (!(new Number(Number.NaN)) !== false) { + $ERROR('#12: !(new Number(Number.NaN)) === false. Actual: ' + (!(new Number(Number.NaN)))); +} + +// CHECK#13 +if (!(new Number(-1)) !== false) { + $ERROR('#13: !(new Number(-1)) === false. Actual: ' + (!(new Number(-1)))); +} + +// CHECK#14 +if (!(new Number(1)) !== false) { + $ERROR('#14: !(new Number(1)) === false. Actual: ' + (!(new Number(1)))); +} + +// CHECK#15 +if (!(new Number(Number.POSITIVE_INFINITY)) !== false) { + $ERROR('#15: !(new Number(Number.POSITIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.POSITIVE_INFINITY)))); +} + +// CHECK#16 +if (!(new Number(Number.NEGATIVE_INFINITY)) !== false) { + $ERROR('#16: !(new Number(Number.NEGATIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.NEGATIVE_INFINITY)))); +} + +// CHECK#17 +if (!(new Function()) !== false) { + $ERROR('#17: !(new Function()) === false. Actual: ' + (!(new Function()))); +} + +// CHECK#18 +if (!(new Date()) !== false) { + $ERROR('#18: !(new Date()) === false. Actual: ' + (!(new Date()))); +} + +// CHECK#19 +if (!(new Date(0)) !== false) { + $ERROR('#19: !(new Date(0)) === false. Actual: ' + (!(new Date(0)))); +} + diff --git a/js/src/tests/test262/ch09/9.2/browser.js b/js/src/tests/test262/ch09/9.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/browser.js diff --git a/js/src/tests/test262/ch09/9.2/shell.js b/js/src/tests/test262/ch09/9.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.2/shell.js diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A1.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A1.js new file mode 100644 index 000000000..35b235fa3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A1.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. + +/** + * The MV of StringNumericLiteral ::: [empty] is 0 + * + * @path ch09/9.3/9.3.1/S9.3.1_A1.js + * @description Number('') convert to Number by explicit transformation + */ + +// CHECK#1 +if (Number("") !== 0) { + $ERROR('#1.1: Number("") === 0. Actual: ' + (Number(""))); +} else { + if (1/Number("") !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: Number("") == +0. Actual: -0'); + } +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A10.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A10.js new file mode 100644 index 000000000..1f7d3f958 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A10.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. + +/** + * The MV of StrUnsignedDecimalLiteral:::. DecimalDigits is the + * MV of DecimalDigits times 10<sup><small>-n</small></sup>, where n is the + * number of characters in DecimalDigits + * + * @path ch09/9.3/9.3.1/S9.3.1_A10.js + * @description Compare Number('.12345') with +('12345')*1e-5 + */ + +// CHECK#1 +if (Number(".12345") !== +("12345")*1e-5) { + $ERROR('#1: Number(".12345") === +("12345")*1e-5'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A11.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A11.js new file mode 100644 index 000000000..9f58e16f2 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A11.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrUnsignedDecimalLiteral:::. DecimalDigits ExponentPart + * is the MV of DecimalDigits times 10<sup><small>e-n</small></sup>, where n is + * the number of characters in DecimalDigits and e is the MV of ExponentPart + * + * @path ch09/9.3/9.3.1/S9.3.1_A11.js + * @description Compare Number('.12345e6') with +('12345')*1e1, + * and Number('.12345e-3') !== Number('12345')*1e-8 + */ + +// CHECK#1 +if (Number(".12345e6") !== +("12345")*1e1) { + $ERROR('#1: Number(".12345e6") === +("12345")*1e1'); +} + +// CHECK#2 +if (Number(".12345e-3") !== Number("12345")*1e-8) { + $ERROR('#2: Number(".12345e-3") === Number("12345")*1e-8'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A12.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A12.js new file mode 100644 index 000000000..201040946 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A12.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrUnsignedDecimalLiteral::: DecimalDigits ExponentPart + * is the MV of DecimalDigits times 10<sup><small>e</small></sup>, where e is the MV of ExponentPart + * + * @path ch09/9.3/9.3.1/S9.3.1_A12.js + * @description Compare Number('12345e6') with +('12345')*1e1, + * and Number('12345e-6') !== Number('12345')*1e-6 + */ + +// CHECK#1 +if (Number("12345e6") !== +("12345")*1e6) { + $ERROR('#1: Number("12345e6") === +("12345")*1e6'); +} + +// CHECK#2 +if (Number("12345e-6") !== Number("12345")*1e-6) { + $ERROR('#2: Number("12345e-6") === Number("12345")*1e-6'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A13.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A13.js new file mode 100644 index 000000000..8d51f4b02 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A13.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. + +/** + * The MV of DecimalDigits ::: DecimalDigits DecimalDigit is + * (the MV of DecimalDigits times 10) plus the MV of DecimalDigit + * + * @path ch09/9.3/9.3.1/S9.3.1_A13.js + * @description Compare '12' with Number("1")*10+Number("2") and analogous + */ + +// CHECK#1 +if (+("12") !== Number("1")*10+Number("2")) { + $ERROR('#1: +("12") === Number("1")*10+Number("2")'); +} + +// CHECK#2 +if (Number("123") !== Number("12")*10+Number("3")) { + $ERROR('#2: Number("123") === Number("12")*10+Number("3")'); +} + +// CHECK#2 +if (Number("1234") !== Number("123")*10+Number("4")) { + $ERROR('#2: Number("1234") === Number("123")*10+Number("4")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A14.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A14.js new file mode 100644 index 000000000..4ed80b082 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A14.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. + +/** + * The MV of SignedInteger ::: + DecimalDigits is the MV of DecimalDigits + * + * @path ch09/9.3/9.3.1/S9.3.1_A14.js + * @description Compare Number('+1234567890') with +('1234567890') + */ + +// CHECK#1 +if (Number("+1234567890") !== +("1234567890")) { + $ERROR('#1: Number("+1234567890") === +("1234567890")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A15.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A15.js new file mode 100644 index 000000000..d0ba80b6e --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A15.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. + +/** + * The MV of SignedInteger ::: - DecimalDigits is the negative of the MV of DecimalDigits + * + * @path ch09/9.3/9.3.1/S9.3.1_A15.js + * @description Compare -Number('1234567890') with ('-1234567890') + */ + +// CHECK#1 +if (+("-1234567890") !== -Number("1234567890")) { + $ERROR('#1: +("-1234567890") === -Number("1234567890")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A16.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A16.js new file mode 100644 index 000000000..6163fbb4a --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A16.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. + +/** + * The MV of DecimalDigit ::: 0 or of HexDigit ::: 0 is 0 + * + * @path ch09/9.3/9.3.1/S9.3.1_A16.js + * @description Compare Number('0x0') and Number('0X0') with 0 + */ + +// CHECK#1 +if (Number("0") !== 0) { + $ERROR('#1: Number("0") === 0. Actual: ' + (Number("0"))); +} + +// CHECK#2 +if (+("0x0") !== 0) { + $ERROR('#2: +("0x0") === 0. Actual: ' + (+("0x0"))); +} + +// CHECK#3 +if (Number("0X0") !== 0) { + $ERROR('#3: Number("0X0") === 0. Actual: ' + (Number("0X0"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A17.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A17.js new file mode 100644 index 000000000..d4b72bbf5 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A17.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. + +/** + * The MV of DecimalDigit ::: 1 or of HexDigit ::: 1 is 1 + * + * @path ch09/9.3/9.3.1/S9.3.1_A17.js + * @description Compare Number('0x1') and Number('0X1') with 1 + */ + +// CHECK#1 +if (Number("1") !== 1) { + $ERROR('#1: Number("1") === 1. Actual: ' + (Number("1"))); +} + +// CHECK#2 +if (Number("0x1") !== 1) { + $ERROR('#2: Number("0x1") === 1. Actual: ' + (Number("0x1"))); +} + +// CHECK#3 +if (+("0X1") !== 1) { + $ERROR('#3: +("0X1") === 1. Actual: ' + (+("0X1"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A18.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A18.js new file mode 100644 index 000000000..b4375494c --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A18.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. + +/** + * The MV of DecimalDigit ::: 2 or of HexDigit ::: 2 is 2 + * + * @path ch09/9.3/9.3.1/S9.3.1_A18.js + * @description Compare Number('0x2') and Number('0X2') with 2 + */ + +// CHECK#1 +if (+("2") !== 2) { + $ERROR('#1: +("2") === 2. Actual: ' + (+("2"))); +} + +// CHECK#2 +if (Number("0x2") !== 2) { + $ERROR('#2: Number("0x2") === 2. Actual: ' + (Number("0x2"))); +} + +// CHECK#3 +if (Number("0X2") !== 2) { + $ERROR('#3: Number("0X2") === 2. Actual: ' + (Number("0X2"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A19.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A19.js new file mode 100644 index 000000000..0abc0200a --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A19.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. + +/** + * The MV of DecimalDigit ::: 3 or of HexDigit ::: 3 is 3 + * + * @path ch09/9.3/9.3.1/S9.3.1_A19.js + * @description Compare Number('0x3') and Number('0X3') with 3 + */ + +// CHECK#1 +if (Number("3") !== 3) { + $ERROR('#1: Number("3") === 3. Actual: ' + (Number("3"))); +} + +// CHECK#2 +if (+("0x3") !== 3) { + $ERROR('#2: +("0x3") === 3. Actual: ' + (+("0x3"))); +} + +// CHECK#3 +if (Number("0X3") !== 3) { + $ERROR('#3: Number("0X3") === 3. Actual: ' + (Number("0X3"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A2.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A2.js new file mode 100644 index 000000000..f9bb01465 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A2.js @@ -0,0 +1,289 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StringNumericLiteral ::: StrWhiteSpace is 0 + * + * @path ch09/9.3/9.3.1/S9.3.1_A2.js + * @description Strings with various WhiteSpaces convert to Number by explicit transformation + */ + +// CHECK#1 +if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== 0) { + $ERROR('#1.1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === 0. Actual: ' + (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000"))); +} else { + if (1/Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === +0. Actual: -0'); + } +} + +// CHECK#2 +if (Number(" ") !== 0) { + $ERROR('#2.1: Number(" ") === 0. Actual: ' + (Number(" "))); +} else { + if (1/Number(" ") !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: Number(" ") === +0. Actual: -0'); + } +} + +// CHECK#3 +if (Number("\t") !== 0) { + $ERROR('#3.1: Number("\\t") === 0. Actual: ' + (Number("\t"))); +} else { + if (1/Number("\t") !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: Number("\\t") === +0. Actual: -0'); + } +} + +// CHECK#4 +if (Number("\r") !== 0) { + $ERROR('#4.1: Number("\\r") === 0. Actual: ' + (Number("\r"))); +} else { + if (1/Number("\r") !== Number.POSITIVE_INFINITY) { + $ERROR('#4.2: Number("\\r") === +0. Actual: -0'); + } +} + +// CHECK#5 +if (Number("\n") !== 0) { + $ERROR('#5.1: Number("\\n") === 0. Actual: ' + (Number("\n"))); +} else { + if (1/Number("\n") !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: Number("\\n") === +0. Actual: -0'); + } +} + +// CHECK#6 +if (Number("\f") !== 0) { + $ERROR('#6.1: Number("\\f") === 0. Actual: ' + (Number("\f"))); +} else { + if (1/Number("\f") !== Number.POSITIVE_INFINITY) { + $ERROR('#6.2: Number("\\f") === +0. Actual: -0'); + } +} + +// CHECK#7 +if (Number("\u0009") !== 0) { + $ERROR('#7.1: Number("\\u0009") === 0. Actual: ' + (Number("\u0009"))); +} else { + if (1/Number("\u0009") !== Number.POSITIVE_INFINITY) { + $ERROR('#7.2: Number("\\u0009") === +0. Actual: -0'); + } +} + +// CHECK#8 +if (Number("\u000A") !== 0) { + $ERROR('#8.1: Number("\\u000A") === 0. Actual: ' + (Number("\u000A"))); +} else { + if (1/Number("\u000A") !== Number.POSITIVE_INFINITY) { + $ERROR('#8.2: Number("\\u000A") === +0. Actual: -0'); + } +} + +// CHECK#9 +if (Number("\u000B") !== 0) { + $ERROR('#9.1: Number("\\u000B") === 0. Actual: ' + (Number("\u000B"))); +} else { + if (1/Number("\u000B") !== Number.POSITIVE_INFINITY) { + $ERROR('#9.1.2: Number("\\u000B") === +0. Actual: -0'); + } +} + +// CHECK#10 +if (Number("\u000C") !== 0) { + $ERROR('#10.1: Number("\\u000C") === 0. Actual: ' + (Number("\u000C"))); +} else { + if (1/Number("\u000C") !== Number.POSITIVE_INFINITY) { + $ERROR('#10.2: Number("\\u000C") === +0. Actual: -0'); + } +} + +// CHECK#11 +if (Number("\u000D") !== 0) { + $ERROR('#11.1: Number("\\u000D") === 0. Actual: ' + (Number("\u000D"))); +} else { + if (1/Number("\u000D") !== Number.POSITIVE_INFINITY) { + $ERROR('#11.2: Number("\\u000D") === +0. Actual: -0'); + } +} + +// CHECK#12 +if (Number("\u00A0") !== 0) { + $ERROR('#12.1: Number("\\u00A0") === 0. Actual: ' + (Number("\u00A0"))); +} else { + if (1/Number("\u00A0") !== Number.POSITIVE_INFINITY) { + $ERROR('#12.2: Number("\\u00A0") === +0. Actual: -0'); + } +} + +// CHECK#13 +if (Number("\u0020") !== 0) { + $ERROR('#13.1: Number("\\u0020") === 0. Actual: ' + (Number("\u0020"))); +} else { + if (1/Number("\u0020") !== Number.POSITIVE_INFINITY) { + $ERROR('#13.2: Number("\\u0020") === +0. Actual: -0'); + } +} + +// CHECK#14 +if (Number("\u2028") !== 0) { + $ERROR('#14.1: Number("\\u2028") === 0. Actual: ' + (Number("\u2028"))); +} else { + if (1/Number("\u2028") !== Number.POSITIVE_INFINITY) { + $ERROR('#14.2: Number("\\u2028") === +0. Actual: -0'); + } +} + +// CHECK#15 +if (Number("\u2029") !== 0) { + $ERROR('#15.1: Number("\\u2029") === 0. Actual: ' + (Number("\u2029"))); +} else { + if (1/Number("\u2029") !== Number.POSITIVE_INFINITY) { + $ERROR('#15.2: Number("\\u2029") === +0. Actual: -0'); + } +} + +// CHECK#16 +if (Number("\u1680") !== 0) { + $ERROR('#16.1: Number("\\u1680") === 0. Actual: ' + (Number("\u1680"))); +} else { + if (1/Number("\u1680") !== Number.POSITIVE_INFINITY) { + $ERROR('#16.2: Number("\\u1680") === +0. Actual: -0'); + } +} + +// CHECK#17 +if (Number("\u180E") !== 0) { + $ERROR('#17.1: Number("\\u180E") === 0. Actual: ' + (Number("\u180E"))); +} else { + if (1/Number("\u180E") !== Number.POSITIVE_INFINITY) { + $ERROR('#17.2: Number("\\u180E") === +0. Actual: -0'); + } +} + +// CHECK#18 +if (Number("\u2000") !== 0) { + $ERROR('#18.1: Number("\\u2000") === 0. Actual: ' + (Number("\u2000"))); +} else { + if (1/Number("\u2000") !== Number.POSITIVE_INFINITY) { + $ERROR('#18.2: Number("\\u2000") === +0. Actual: -0'); + } +} + +// CHECK#19 +if (Number("\u2001") !== 0) { + $ERROR('#19.1: Number("\\u2001") === 0. Actual: ' + (Number("\u2001"))); +} else { + if (1/Number("\u2001") !== Number.POSITIVE_INFINITY) { + $ERROR('#19.2: Number("\\u2001") === +0. Actual: -0'); + } +} + +// CHECK#20 +if (Number("\u2002") !== 0) { + $ERROR('#20.1: Number("\\u2002") === 0. Actual: ' + (Number("\u2002"))); +} else { + if (1/Number("\u2002") !== Number.POSITIVE_INFINITY) { + $ERROR('#20.2: Number("\\u2002") === +0. Actual: -0'); + } +} + +// CHECK#21 +if (Number("\u2003") !== 0) { + $ERROR('#21.1: Number("\\u2003") === 0. Actual: ' + (Number("\u2003"))); +} else { + if (1/Number("\u2003") !== Number.POSITIVE_INFINITY) { + $ERROR('#21.2: Number("\\u2003") === +0. Actual: -0'); + } +} + +// CHECK#22 +if (Number("\u2004") !== 0) { + $ERROR('#22.1: Number("\\u2004") === 0. Actual: ' + (Number("\u2004"))); +} else { + if (1/Number("\u2004") !== Number.POSITIVE_INFINITY) { + $ERROR('#22.2: Number("\\u2004") === +0. Actual: -0'); + } +} + +// CHECK#23 +if (Number("\u2005") !== 0) { + $ERROR('#23.1: Number("\\u2005") === 0. Actual: ' + (Number("\u2005"))); +} else { + if (1/Number("\u2005") !== Number.POSITIVE_INFINITY) { + $ERROR('#23.2: Number("\\u2005") === +0. Actual: -0'); + } +} + +// CHECK#24 +if (Number("\u2006") !== 0) { + $ERROR('#24.1: Number("\\u2006") === 0. Actual: ' + (Number("\u2006"))); +} else { + if (1/Number("\u2006") !== Number.POSITIVE_INFINITY) { + $ERROR('#24.2: Number("\\u2006") === +0. Actual: -0'); + } +} + +// CHECK#25 +if (Number("\u2007") !== 0) { + $ERROR('#25.1: Number("\\u2007") === 0. Actual: ' + (Number("\u2007"))); +} else { + if (1/Number("\u2007") !== Number.POSITIVE_INFINITY) { + $ERROR('#25.2: Number("\\u2007") === +0. Actual: -0'); + } +} + +// CHECK#26 +if (Number("\u2008") !== 0) { + $ERROR('#26.1: Number("\\u2008") === 0. Actual: ' + (Number("\u2008"))); +} else { + if (1/Number("\u2008") !== Number.POSITIVE_INFINITY) { + $ERROR('#26.2: Number("\\u2008") === +0. Actual: -0'); + } +} + +// CHECK#27 +if (Number("\u2009") !== 0) { + $ERROR('#27.1: Number("\\u2009") === 0. Actual: ' + (Number("\u2009"))); +} else { + if (1/Number("\u2009") !== Number.POSITIVE_INFINITY) { + $ERROR('#27.2: Number("\\u2009") === +0. Actual: -0'); + } +} + +// CHECK#28 +if (Number("\u200A") !== 0) { + $ERROR('#28.1: Number("\\u200A") === 0. Actual: ' + (Number("\u200A"))); +} else { + if (1/Number("\u200A") !== Number.POSITIVE_INFINITY) { + $ERROR('#28.2: Number("\\u200A") === +0. Actual: -0'); + } +} + +// CHECK#29 +if (Number("\u202F") !== 0) { + $ERROR('#29.1: Number("\\u202F") === 0. Actual: ' + (Number("\u202F"))); +} else { + if (1/Number("\u202F") !== Number.POSITIVE_INFINITY) { + $ERROR('#29.2: Number("\\u202F") === +0. Actual: -0'); + } +} + +// CHECK#30 +if (Number("\u205F") !== 0) { + $ERROR('#30.1: Number("\\u205F") === 0. Actual: ' + (Number("\u205F"))); +} else { + if (1/Number("\u205F") !== Number.POSITIVE_INFINITY) { + $ERROR('#30.2: Number("\\u205F") === +0. Actual: -0'); + } +} + +// CHECK#31 +if (Number("\u3000") !== 0) { + $ERROR('#31.1: Number("\\u3000") === 0. Actual: ' + (Number("\u3000"))); +} else { + if (1/Number("\u3000") !== Number.POSITIVE_INFINITY) { + $ERROR('#31.2: Number("\\u3000") === +0. Actual: -0'); + } +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A20.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A20.js new file mode 100644 index 000000000..78689d42d --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A20.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. + +/** + * The MV of DecimalDigit ::: 4 or of HexDigit ::: 4 is 4 + * + * @path ch09/9.3/9.3.1/S9.3.1_A20.js + * @description Compare Number('0x4') and Number('0X4') with 4 + */ + +// CHECK#1 +if (Number("4") !== 4) { + $ERROR('#1: Number("4") === 4. Actual: ' + (Number("4"))); +} + +// CHECK#2 +if (Number("0x4") !== 4) { + $ERROR('#2: Number("0x4") === 4. Actual: ' + (Number("0x4"))); +} + +// CHECK#3 +if (+("0X4") !== 4) { + $ERROR('#3: +("0X4") === 4. Actual: ' + (+("0X4"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A21.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A21.js new file mode 100644 index 000000000..de8fe9fe1 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A21.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. + +/** + * The MV of DecimalDigit ::: 5 or of HexDigit ::: 5 is 5 + * + * @path ch09/9.3/9.3.1/S9.3.1_A21.js + * @description Compare Number('0x5') and Number('0X5') with 5 + */ + +// CHECK#1 +if (+("5") !== 5) { + $ERROR('#1: +("5") === 5. Actual: ' + (+("5"))); +} + +// CHECK#2 +if (Number("0x5") !== 5) { + $ERROR('#2: Number("0x5") === 5. Actual: ' + (Number("0x5"))); +} + +// CHECK#3 +if (Number("0X5") !== 5) { + $ERROR('#3: Number("0X5") === 5. Actual: ' + (Number("0X5"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A22.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A22.js new file mode 100644 index 000000000..02aa703a3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A22.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. + +/** + * The MV of DecimalDigit ::: 6 or of HexDigit ::: 6 is 6 + * + * @path ch09/9.3/9.3.1/S9.3.1_A22.js + * @description Compare Number('0x6') and Number('0X6') with 6 + */ + +// CHECK#1 +if (Number("6") !== 6) { + $ERROR('#1: Number("6") === 6. Actual: ' + (Number("6"))); +} + +// CHECK#2 +if (+("0x6") !== 6) { + $ERROR('#2: +("0x6") === 6. Actual: ' + (+("0x6"))); +} + +// CHECK#3 +if (Number("0X6") !== 6) { + $ERROR('#3: Number("0X6") === 6. Actual: ' + (Number("0X6"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A23.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A23.js new file mode 100644 index 000000000..d1745156d --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A23.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. + +/** + * The MV of DecimalDigit ::: 7 or of HexDigit ::: 7 is 7 + * + * @path ch09/9.3/9.3.1/S9.3.1_A23.js + * @description Compare Number('0x7') and Number('0X7') with 7 + */ + +// CHECK#1 +if (Number("7") !== 7) { + $ERROR('#1: Number("7") === 7. Actual: ' + (Number("7"))); +} + +// CHECK#2 +if (Number("0x7") !== 7) { + $ERROR('#2: Number("0x7") === 7. Actual: ' + (Number("0x7"))); +} + +// CHECK#3 +if (+("0X7") !== 7) { + $ERROR('#3: +("0X7") === 7. Actual: ' + (+("0X7"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A24.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A24.js new file mode 100644 index 000000000..91409bead --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A24.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. + +/** + * The MV of DecimalDigit ::: 8 or of HexDigit ::: 8 is 8 + * + * @path ch09/9.3/9.3.1/S9.3.1_A24.js + * @description Compare Number('0x8') and Number('0X8') with 8 + */ + +// CHECK#1 +if (+("8") !== 8) { + $ERROR('#1: +("8") === 8. Actual: ' + (+("8"))); +} + +// CHECK#2 +if (Number("0x8") !== 8) { + $ERROR('#2: Number("0x8") === 8. Actual: ' + (Number("0x8"))); +} + +// CHECK#3 +if (Number("0X8") !== 8) { + $ERROR('#3: Number("0X8") === 8. Actual: ' + (Number("0X8"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A25.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A25.js new file mode 100644 index 000000000..761ceb443 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A25.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. + +/** + * The MV of DecimalDigit ::: 9 or of HexDigit ::: 9 is 9 + * + * @path ch09/9.3/9.3.1/S9.3.1_A25.js + * @description Compare Number('0x9') and Number('0X9') with 9 + */ + +// CHECK#1 +if (Number("9") !== 9) { + $ERROR('#1: Number("9") === 9. Actual: ' + (Number("9"))); +} + +// CHECK#2 +if (+("0x9") !== 9) { + $ERROR('#2: +("0x9") === 9. Actual: ' + (+("0x9"))); +} + +// CHECK#3 +if (Number("0X9") !== 9) { + $ERROR('#3: Number("0X9") === 9. Actual: ' + (Number("0X9"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A26.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A26.js new file mode 100644 index 000000000..404203f59 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A26.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. + +/** + * The MV of HexDigit ::: a or of HexDigit ::: A is 10 + * + * @path ch09/9.3/9.3.1/S9.3.1_A26.js + * @description Compare Number('0xA'), Number('0XA'), Number('0xa') and Number('0Xa') with 10 + */ + +// CHECK#1 +if (Number("0xa") !== 10) { + $ERROR('#1: Number("0xa") === 10. Actual: ' + (Number("0xa"))); +} + +// CHECK#2 +if (Number("0xA") !== 10) { + $ERROR('#2: Number("0xA") === 10. Actual: ' + (Number("0xA"))); +} + +// CHECK#3 +if (Number("0Xa") !== 10) { + $ERROR('#3: Number("0Xa") === 10. Actual: ' + (Number("0Xa"))); +} + +// CHECK#4 +if (+("0XA") !== 10) { + $ERROR('#4: +("0XA") === 10. Actual: ' + (+("0XA"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A27.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A27.js new file mode 100644 index 000000000..67e6a6e5f --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A27.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. + +/** + * The MV of HexDigit ::: b or of HexDigit ::: B is 11 + * + * @path ch09/9.3/9.3.1/S9.3.1_A27.js + * @description Compare Number('0xB'), Number('0XB'), Number('0xb') and Number('0Xb') with 11 + */ + +// CHECK#1 +if (Number("0xb") !== 11) { + $ERROR('#1: Number("0xb") === 11. Actual: ' + (Number("0xb"))); +} + +// CHECK#2 +if (Number("0xB") !== 11) { + $ERROR('#2: Number("0xB") === 11. Actual: ' + (Number("0xB"))); +} + +// CHECK#3 +if (+("0Xb") !== 11) { + $ERROR('#3: +("0Xb") === 11. Actual: ' + (+("0Xb"))); +} + +// CHECK#4 +if (Number("0XB") !== 11) { + $ERROR('#4: Number("0XB") === 11. Actual: ' + (Number("0XB"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A28.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A28.js new file mode 100644 index 000000000..d29b8c289 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A28.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. + +/** + * The MV of HexDigit ::: c or of HexDigit ::: C is 12 + * + * @path ch09/9.3/9.3.1/S9.3.1_A28.js + * @description Compare Number('0xC'), Number('0XC'), Number('0xc') and Number('0Xc') with 12 + */ + +// CHECK#1 +if (Number("0xc") !== 12) { + $ERROR('#1: Number("0xc") === 12. Actual: ' + (Number("0xc"))); +} + +// CHECK#2 +if (+("0xC") !== 12) { + $ERROR('#2: +("0xC") === 12. Actual: ' + (+("0xC"))); +} + +// CHECK#3 +if (Number("0Xc") !== 12) { + $ERROR('#3: Number("0Xc") === 12. Actual: ' + (Number("0Xc"))); +} + +// CHECK#4 +if (Number("0XC") !== 12) { + $ERROR('#4: Number("0XC") === 12. Actual: ' + (Number("0XC"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A29.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A29.js new file mode 100644 index 000000000..88473af85 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A29.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. + +/** + * The MV of HexDigit ::: d or of HexDigit ::: D is 13 + * + * @path ch09/9.3/9.3.1/S9.3.1_A29.js + * @description Compare Number('0xD'), Number('0XD'), Number('0xd') and Number('0Xd') with 13 + */ + +// CHECK#1 +if (+("0xd") !== 13) { + $ERROR('#1: +("0xd") === 13. Actual: ' + (+("0xd"))); +} + +// CHECK#2 +if (Number("0xD") !== 13) { + $ERROR('#2: Number("0xD") === 13. Actual: ' + (Number("0xD"))); +} + +// CHECK#3 +if (Number("0Xd") !== 13) { + $ERROR('#3: Number("0Xd") === 13. Actual: ' + (Number("0Xd"))); +} + +// CHECK#4 +if (Number("0XD") !== 13) { + $ERROR('#4: Number("0XD") === 13. Actual: ' + (Number("0XD"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A30.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A30.js new file mode 100644 index 000000000..b94bacbd7 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A30.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. + +/** + * The MV of HexDigit ::: e or of HexDigit ::: E is 14 + * + * @path ch09/9.3/9.3.1/S9.3.1_A30.js + * @description Compare Number('0xE'), Number('0XE'), Number('0xe') and Number('0Xe') with 14 + */ + +// CHECK#1 +if (Number("0xe") !== 14) { + $ERROR('#1: Number("0xe") === 14. Actual: ' + (Number("0xe"))); +} + +// CHECK#2 +if (Number("0xE") !== 14) { + $ERROR('#2: Number("0xE") === 14. Actual: ' + (Number("0xE"))); +} + +// CHECK#3 +if (Number("0Xe") !== 14) { + $ERROR('#3: Number("0Xe") === 14. Actual: ' + (Number("0Xe"))); +} + +// CHECK#4 +if (+("0XE") !== 14) { + $ERROR('#4: +("0XE") === 14. Actual: ' + (+("0XE"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A31.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A31.js new file mode 100644 index 000000000..f5f151b76 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A31.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. + +/** + * The MV of HexDigit ::: f or of HexDigit ::: F is 15 + * + * @path ch09/9.3/9.3.1/S9.3.1_A31.js + * @description Compare Number('0xF'), Number('0XF'), Number('0xf') and Number('0Xf') with 15 + */ + +// CHECK#1 +if (Number("0xf") !== 15) { + $ERROR('#1: Number("0xf") === 15. Actual: ' + (Number("0xf"))); +} + +// CHECK#2 +if (Number("0xF") !== 15) { + $ERROR('#2: Number("0xF") === 15. Actual: ' + (Number("0xF"))); +} + +// CHECK#3 +if (+("0Xf") !== 15) { + $ERROR('#3: +("0Xf") === 15. Actual: ' + (+("0Xf"))); +} + +// CHECK#4 +if (Number("0XF") !== 15) { + $ERROR('#4: Number("0XF") === 15. Actual: ' + (Number("0XF"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A32.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A32.js new file mode 100644 index 000000000..700feb717 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A32.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. + +/** + * Once the exact MV for a string numeric literal has been + * determined, it is then rounded to a value of the Number type with 20 + * significant digits by replacing each significant digit after the 20th + * with a 0 digit or the number value + * + * @path ch09/9.3/9.3.1/S9.3.1_A32.js + * @description Use various long numbers, for example, 1234567890.1234567890 + */ + +// CHECK#1 +if (Number("1234567890.1234567890") !== 1234567890.1234567890) { + $ERROR('#1: Number("1234567890.1234567890") === 1234567890.1234567890. Actual: ' + (Number("1234567890.1234567890"))); +} + +// CHECK#2 +if (Number("1234567890.1234567890") !== 1234567890.1234567000) { + $ERROR('#2: Number("1234567890.1234567890") === 1234567890.1234567000. Actual: ' + (Number("1234567890.1234567890"))); +} + +// CHECK#3 +if (+("1234567890.1234567890") === 1234567890.123456) { + $ERROR('#3: +("1234567890.1234567890") !== 1234567890.123456'); +} + +// CHECK#4 +if (Number("0.12345678901234567890") !== 0.123456789012345678) { + $ERROR('#4: Number("0.12345678901234567890") === 0.123456789012345678. Actual: ' + (Number("0.12345678901234567890"))); +} + +// CHECK#4 +if (Number("00.12345678901234567890") !== 0.123456789012345678) { + $ERROR('#4: Number("00.12345678901234567890") === 0.123456789012345678. Actual: ' + (Number("00.12345678901234567890"))); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_T1.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_T1.js new file mode 100644 index 000000000..304f5ba4e --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_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. + +/** + * The MV of StringNumericLiteral ::: StrWhiteSpaceopt StrNumericLiteral StrWhiteSpaceopt is the MV of StrNumericLiteral, no matter whether white space is present or not + * + * @path ch09/9.3/9.3.1/S9.3.1_A3_T1.js + * @description static string + */ + +// CHECK#1 +if (Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("")) { + $ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")'); +} + +// CHECK#2 +if (Number("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u30001234567890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") !== Number("1234567890")) { + $ERROR('#2: Number("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u30001234567890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")'); +} + +// CHECK#3 +if (!(+("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number("Infinity"))) { + $ERROR('#3: +("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")'); +} + +// CHECK#4 +if (!(Number("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000-Infinity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000") == Number(-"Infinity"))) { + $ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000-Infinity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_T2.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_T2.js new file mode 100644 index 000000000..0969dd9bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A3_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. + +/** + * The MV of StringNumericLiteral ::: StrWhiteSpaceopt StrNumericLiteral StrWhiteSpaceopt is the MV of StrNumericLiteral, no matter whether white space is present or not + * + * @path ch09/9.3/9.3.1/S9.3.1_A3_T2.js + * @description dynamic string + */ + +function dynaString(s1, s2){ + return String(s1)+String(s2); +} + +// CHECK#1 +if (Number(dynaString("\u0009\u000C\u0020\u00A0\u000B", "\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("")) { + $ERROR('#1: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B"+"\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("")'); +} + +// CHECK#2 +if (+(dynaString("\u0009\u000C\u0020\u00A0\u000A\u000D\u2028\u2029\u000B12345", "67890\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) !== Number("1234567890")) { + $ERROR('#2: +("\\u0009\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029\\u000B12345"+"67890\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") === Number("1234567890")'); +} + +// CHECK#3 +if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number("Infinity"))) { + $ERROR('#3: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("Infinity")'); +} + +// CHECK#4 +if (!(Number(dynaString("\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029-Infi", "nity\u0009\u000C\u0020\u00A0\u000B\u000A\u000D\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000")) == Number(-"Infinity"))) { + $ERROR('#4: Number("\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029-Infi"+"nity\\u0009\\u000C\\u0020\\u00A0\\u000B\\u000A\\u000D\\u2028\\u2029\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000") == Number("-Infinity")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T1.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T1.js new file mode 100644 index 000000000..8d2051140 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T1.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. + +/** + * The MV of StrDecimalLiteral::: + StrUnsignedDecimalLiteral is the MV of StrUnsignedDecimalLiteral + * + * @path ch09/9.3/9.3.1/S9.3.1_A4_T1.js + * @description Compare Number('+any_number') with Number('any_number') + */ + +// CHECK#1 +if (Number("+0") !== Number("0")) { + $ERROR('#1.1: Number("+0") === Number("0")'); +} else { + // CHECK#2 + if (1/Number("+0") !== 1/Number("0")) { + $ERROR('#2.2: 1/Number("+0") === 1/Number("0")'); + } +} + +// CHECK#3 +if (Number("+Infinity") !== Number("Infinity")) { + $ERROR('#3: Number("+Infinity") === Number("Infinity")'); +} + +// CHECK#4 +if (Number("+1234.5678") !== Number("1234.5678")) { + $ERROR('#4: Number("+1234.5678") === Number("1234.5678")'); +} + +// CHECK#5 +if (Number("+1234.5678e90") !== Number("1234.5678e90")) { + $ERROR('#5: Number("+1234.5678e90") === Number("1234.5678e90")'); +} + +// CHECK#6 +if (Number("+1234.5678E90") !== Number("1234.5678E90")) { + $ERROR('#6: Number("+1234.5678E90") === Number("1234.5678E90")'); +} + +// CHECK#7 +if (Number("+1234.5678e-90") !== Number("1234.5678e-90")) { + $ERROR('#7: Number("+1234.5678e-90") === Number("1234.5678e-90")'); +} + +// CHECK#8 +if (Number("+1234.5678E-90") !== Number("1234.5678E-90")) { + $ERROR('#8: Number("+1234.5678E-90") === Number("1234.5678E-90")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T2.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T2.js new file mode 100644 index 000000000..e10d517ce --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A4_T2.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. + +/** + * The MV of StrDecimalLiteral::: + StrUnsignedDecimalLiteral is the MV of StrUnsignedDecimalLiteral + * + * @path ch09/9.3/9.3.1/S9.3.1_A4_T2.js + * @description Compare Number('+' + 'any_number') with Number('any_number') + */ + +function dynaString(s1, s2){ + return String(s1)+String(s2); +} + +// CHECK#1 +if (Number(dynaString("+", "0")) !== Number("0")) { + $ERROR('#1: Number("+"+"0") === Number("0")'); +} else { + // CHECK#2 + if (1/Number(dynaString("+", "0")) !== 1/Number("0")) { + $ERROR('#2: 1/Number("+"+"0") === 1/Number("0")'); + } +} + +// CHECK#3 +if (Number(dynaString("+Infi", "nity")) !== Number("Infinity")) { + $ERROR('#3: Number("+Infin"+"ity") === Number("Infinity")'); +} + +// CHECK#4 +if (Number(dynaString("+1234.", "5678")) !== Number("1234.5678")) { + $ERROR('#4: Number("+1234."+"5678") === Number("1234.5678")'); +} + +// CHECK#5 +if (Number(dynaString("+1234.", "5678e90")) !== Number("1234.5678e90")) { + $ERROR('#5: Number("+1234."+"5678e90") === Number("1234.5678e90")'); +} + +// CHECK#6 +if (Number(dynaString("+1234.", "5678E90")) !== Number("1234.5678E90")) { + $ERROR('#6: Number("+1234."+"5678E90") === Number("1234.5678E90")'); +} + +// CHECK#7 +if (Number(dynaString("+1234.", "5678e-90")) !== Number("1234.5678e-90")) { + $ERROR('#7: Number("+1234."+"5678e-90") === Number("1234.5678e-90")'); +} + +// CHECK#8 +if (Number(dynaString("+1234.", "5678E-90")) !== Number("1234.5678E-90")) { + $ERROR('#8: Number("+1234."+"5678E-90") === Number("1234.5678E-90")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T1.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T1.js new file mode 100644 index 000000000..b6bb8137d --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T1.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrDecimalLiteral::: - StrUnsignedDecimalLiteral is the negative + * of the MV of StrUnsignedDecimalLiteral. (the negative of this 0 is also 0) + * + * @path ch09/9.3/9.3.1/S9.3.1_A5_T1.js + * @description Compare Number('-any_number') with -Number('any_number') + */ + +// CHECK#1 +if (Number("-0") !== -Number("0")) { + $ERROR('#1: Number("-0") === -Number("0")'); +} else { + // CHECK#2 + if (1/Number("-0") !== -1/Number("0")) { + $ERROR('#2: 1/Number("-0") === -1/Number("0")'); + } +} + +// CHECK#3 +if (Number("-Infinity") !== -Number("Infinity")) { + $ERROR('#3: Number("-Infinity") === -Number("Infinity")'); +} + +// CHECK#4 +if (Number("-1234567890") !== -Number("1234567890")) { + $ERROR('#4: Number("-1234567890") === -Number("1234567890")'); +} + +// CHECK#5 +if (Number("-1234.5678") !== -Number("1234.5678")) { + $ERROR('#5: Number("-1234.5678") === -Number("1234.5678")'); +} + +// CHECK#6 +if (Number("-1234.5678e90") !== -Number("1234.5678e90")) { + $ERROR('#6: Number("-1234.5678e90") === -Number("1234.5678e90")'); +} + +// CHECK#7 +if (Number("-1234.5678E90") !== -Number("1234.5678E90")) { + $ERROR('#6: Number("-1234.5678E90") === -Number("1234.5678E90")'); +} + +// CHECK#8 +if (Number("-1234.5678e-90") !== -Number("1234.5678e-90")) { + $ERROR('#6: Number("-1234.5678e-90") === -Number("1234.5678e-90")'); +} + +// CHECK#9 +if (Number("-1234.5678E-90") !== -Number("1234.5678E-90")) { + $ERROR('#6: Number("-1234.5678E-90") === -Number("1234.5678E-90")'); +} + +// CHECK#10 +if (Number("-Infinity") !== Number.NEGATIVE_INFINITY) { + $ERROR('#3: Number("-Infinity") === Number.NEGATIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T2.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T2.js new file mode 100644 index 000000000..47bc6549e --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T2.js @@ -0,0 +1,146 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrDecimalLiteral::: - StrUnsignedDecimalLiteral is the negative + * of the MV of StrUnsignedDecimalLiteral. (the negative of this 0 is also 0) + * + * @path ch09/9.3/9.3.1/S9.3.1_A5_T2.js + * @description Compare Number('-[or +]any_number') with -[or without -]any_number) + */ + +// CHECK#1 +if (Number("1") !== 1) { + $ERROR('#1: Number("1") === 1'); +} + +// CHECK#2 +if (Number("+1") !== 1) { + $ERROR('#3: Number("+1") === 1'); +} + +// CHECK#3 +if (Number("-1") !== -1) { + $ERROR('#3: Number("-1") === -1'); +} + +// CHECK#4 +if (Number("2") !== 2) { + $ERROR('#4: Number("2") === 2'); +} + +// CHECK#5 +if (Number("+2") !== 2) { + $ERROR('#5: Number("+2") === 2'); +} + +// CHECK#6 +if (Number("-2") !== -2) { + $ERROR('#6: Number("-2") === -2'); +} + +// CHECK#7 +if (Number("3") !== 3) { + $ERROR('#7: Number("3") === 3'); +} + +// CHECK#8 +if (Number("+3") !== 3) { + $ERROR('#8: Number("+3") === 3'); +} + +// CHECK#9 +if (Number("-3") !== -3) { + $ERROR('#9: Number("-3") === -3'); +} + +// CHECK#10 +if (Number("4") !== 4) { + $ERROR('#10: Number("4") === 4'); +} + +// CHECK#11 +if (Number("+4") !== 4) { + $ERROR('#11: Number("+4") === 4'); +} + +// CHECK#12 +if (Number("-4") !== -4) { + $ERROR('#12: Number("-4") === -4'); +} + +// CHECK#13 +if (Number("5") !== 5) { + $ERROR('#13: Number("5") === 5'); +} + +// CHECK#14 +if (Number("+5") !== 5) { + $ERROR('#14: Number("+5") === 5'); +} + +// CHECK#15 +if (Number("-5") !== -5) { + $ERROR('#15: Number("-5") === -5'); +} + +// CHECK#16 +if (Number("6") !== 6) { + $ERROR('#16: Number("6") === 6'); +} + +// CHECK#17 +if (Number("+6") !== 6) { + $ERROR('#17: Number("+6") === 6'); +} + +// CHECK#18 +if (Number("-6") !== -6) { + $ERROR('#18: Number("-6") === -6'); +} + +// CHECK#19 +if (Number("7") !== 7) { + $ERROR('#19: Number("7") === 7'); +} + +// CHECK#20 +if (Number("+7") !== 7) { + $ERROR('#20: Number("+7") === 7'); +} + +// CHECK#21 +if (Number("-7") !== -7) { + $ERROR('#21: Number("-7") === -7'); +} + +// CHECK#22 +if (Number("8") !== 8) { + $ERROR('#22: Number("8") === 8'); +} + +// CHECK#23 +if (Number("+8") !== 8) { + $ERROR('#23: Number("+8") === 8'); +} + +// CHECK#24 +if (Number("-8") !== -8) { + $ERROR('#24: Number("-8") === -8'); +} + +// CHECK#25 +if (Number("9") !== 9) { + $ERROR('#25: Number("9") === 9'); +} + +// CHECK#26 +if (Number("+9") !== 9) { + $ERROR('#26: Number("+9") === 9'); +} + +// CHECK#27 +if (Number("-9") !== -9) { + $ERROR('#27: Number("-9") === -9'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T3.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T3.js new file mode 100644 index 000000000..c062e198f --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A5_T3.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. + +/** + * The MV of StrDecimalLiteral::: - StrUnsignedDecimalLiteral is the negative + * of the MV of StrUnsignedDecimalLiteral. (the negative of this 0 is also 0) + * + * @path ch09/9.3/9.3.1/S9.3.1_A5_T3.js + * @description Compare Number('-' + 'any_number') with -Number('any_number') + */ + +function dynaString(s1, s2){ + return String(s1)+String(s2); +} + +// CHECK#1 +if (Number(dynaString("-", "0")) !== -Number("0")) { + $ERROR('#1: Number("-"+"0") === -Number("0")'); +} else { + // CHECK#2 + if (1/Number(dynaString("-", "0")) !== -1/Number("0")) { + $ERROR('#2: 1/Number("-"+"0") === -1/Number("0")'); + } +} + +// CHECK#3 +if (Number(dynaString("-Infi", "nity")) !== -Number("Infinity")) { + $ERROR('#3: Number("-Infi"+"nity") === -Number("Infinity")'); +} + +// CHECK#4 +if (Number(dynaString("-12345", "67890")) !== -Number("1234567890")) { + $ERROR('#4: Number("-12345"+"67890") === -Number("1234567890")'); +} + +// CHECK#5 +if (Number(dynaString("-1234.", "5678")) !== -Number("1234.5678")) { + $ERROR('#5: Number("-1234."+"5678") === -Number("1234.5678")'); +} + +// CHECK#6 +if (Number(dynaString("-1234.", "5678e90")) !== -Number("1234.5678e90")) { + $ERROR('#6: Number("-1234."+"5678e90") === -Number("1234.5678e90")'); +} + +// CHECK#7 +if (Number(dynaString("-1234.", "5678E90")) !== -Number("1234.5678E90")) { + $ERROR('#6: Number("-1234."+"5678E90") === -Number("1234.5678E90")'); +} + +// CHECK#8 +if (Number(dynaString("-1234.", "5678e-90")) !== -Number("1234.5678e-90")) { + $ERROR('#6: Number("-1234."+"5678e-90") === -Number("1234.5678e-90")'); +} + +// CHECK#9 +if (Number(dynaString("-1234.", "5678E-90")) !== -Number("1234.5678E-90")) { + $ERROR('#6: Number("-1234."+"5678E-90") === -Number("1234.5678E-90")'); +} + +// CHECK#10 +if (Number(dynaString("-Infi", "nity")) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3: Number("-Infi"+"nity") === Number.NEGATIVE_INFINITY'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T1.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T1.js new file mode 100644 index 000000000..6aeeef242 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrUnsignedDecimalLiteral::: Infinity is 10<sup><small>10000</small></sup> + * (a value so large that it will round to <b><tt>+∞</tt></b>) + * + * @path ch09/9.3/9.3.1/S9.3.1_A6_T1.js + * @description Compare Number('Infinity') with Number.POSITIVE_INFINITY, 10e10000, 10E10000 and Number("10e10000") + */ + +// CHECK#1 +if (Number("Infinity") !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number("Infinity") === Number.POSITIVE_INFINITY'); +} + +// CHECK#2 +if (Number("Infinity") !== 10e10000) { + $ERROR('#2: Number("Infinity") === 10e10000'); +} + +// CHECK#3 +if (Number("Infinity") !== 10E10000) { + $ERROR('#3: Number("Infinity") === 10E10000'); +} + +// CHECK#4 +if (Number("Infinity") !== Number("10e10000")) { + $ERROR('#4: Number("Infinity") === Number("10e10000")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T2.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T2.js new file mode 100644 index 000000000..9e4659873 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A6_T2.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. + +/** + * The MV of StrUnsignedDecimalLiteral::: Infinity is 10<sup><small>10000</small></sup> + * (a value so large that it will round to <b><tt>+∞</tt></b>) + * + * @path ch09/9.3/9.3.1/S9.3.1_A6_T2.js + * @description Compare Number('Infi'+'nity') with Number.POSITIVE_INFINITY, 10e10000, 10E10000 and Number("10e10000") + */ + +function dynaString(s1, s2){ + return String(s1)+String(s2); +} + + +// CHECK#1 +if (Number(dynaString("Infi", "nity")) !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number("Infi"+"nity") === Number.POSITIVE_INFINITY'); +} + +// CHECK#2 +if (Number(dynaString("Infi", "nity")) !== 10e10000) { + $ERROR('#2: Number("Infi"+"nity") === 10e10000'); +} + +// CHECK#3 +if (Number(dynaString("Infi", "nity")) !== 10E10000) { + $ERROR('#3: Number("Infi"+"nity") === 10E10000'); +} + +// CHECK#4 +if (Number(dynaString("Infi", "nity")) !== Number("10e10000")) { + $ERROR('#4: Number("Infi"+"nity") === Number("10e10000")'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A7.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A7.js new file mode 100644 index 000000000..50a7f357f --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A7.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. + +/** + * The MV of StrUnsignedDecimalLiteral::: DecimalDigits. DecimalDigits + * is the MV of the first DecimalDigits plus the MV of the second DecimalDigits times + * 10<sup><small>-n</small></sup>, where n is the number of characters in the second DecimalDigits + * + * @path ch09/9.3/9.3.1/S9.3.1_A7.js + * @description Compare Number('1234.5678') with Number('1234')+(+('5678')*1e-4) + */ + +// CHECK#1 +if (Number("1234.5678") !== Number("1234")+(+("5678")*1e-4)) { + $ERROR('#1: Number("1234.5678") === Number("1234")+(+("5678")*1e-4)'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A8.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A8.js new file mode 100644 index 000000000..6b7a5d4a3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A8.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The MV of StrUnsignedDecimalLiteral::: DecimalDigits. ExponentPart + * is the MV of DecimalDigits times 10<sup><small>e</small></sup> , where e is the MV of ExponentPart + * + * @path ch09/9.3/9.3.1/S9.3.1_A8.js + * @description Compare Number('1234e5') and Number('1234.e5') with Number('1234')*1e5 + */ + +// CHECK#1 +if (Number("1234e5") !== Number("1234")*1e5) { + $ERROR('#1: Number("1234e5") === Number("1234")*1e5'); +} + +// CHECK#2 +if (Number("1234.e5") !== +("1234")*1e5) { + $ERROR('#2: Number("1234.e5") === +("1234")*1e5'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A9.js b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A9.js new file mode 100644 index 000000000..1c88a5322 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/S9.3.1_A9.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. + +/** + * The MV of StrUnsignedDecimalLiteral::: DecimalDigits. DecimalDigits ExponentPart + * is (the MV of the first DecimalDigits plus (the MV of the second DecimalDigits times + * 10<sup><small>-n</small></sup>)) times 10<sup><small>e</small></sup>, where n is the number + * of characters in the second DecimalDigits and e is the MV of ExponentPart + * + * @path ch09/9.3/9.3.1/S9.3.1_A9.js + * @description Compare Number('1234.5678e9') with (Number('1234')+(Number('5678')*1e-4))*1e9, + * and +('1234.5678e-9') with (Number('1234')+(Number('5678')*1e-4))*1e-9 + */ + +// CHECK#1 +if (Number("1234.5678e9") !== (Number("1234")+(Number("5678")*1e-4))*1e9) { + $ERROR('#1: Number("1234.5678e9") === (Number("1234")+(Number("5678")*1e-4))*1e9'); +} + +// CHECK#2 +if (+("1234.5678e-9") !== (Number("1234")+(Number("5678")*1e-4))*1e-9) { + $ERROR('#2: +("1234.5678e-9") === (Number("1234")+(Number("5678")*1e-4))*1e-9'); +} + diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/browser.js b/js/src/tests/test262/ch09/9.3/9.3.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/browser.js diff --git a/js/src/tests/test262/ch09/9.3/9.3.1/shell.js b/js/src/tests/test262/ch09/9.3/9.3.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/9.3.1/shell.js diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A1_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A1_T1.js new file mode 100644 index 000000000..bd7869f1e --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A1_T1.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. + +/** + * Result of number conversion from undefined value is NaN + * + * @path ch09/9.3/S9.3_A1_T1.js + * @description Undefined convert to Number by explicit transformation + */ + +// CHECK#1 +if (isNaN(Number(undefined)) !== true) { + $ERROR('#1: Number(undefined) === Not-a-Number. Actual: ' + (Number(undefined))); +} + +// CHECK#2 +if (isNaN(Number(void 0)) !== true) { + $ERROR('#2: Number(void 0) === Not-a-Number. Actual: ' + (Number(void 0))); +} + +// CHECK#3 +if (isNaN(Number(eval("var x"))) !== true) { + $ERROR('#3: Number(eval("var x")) === Not-a-Number. Actual: ' + (Number(eval("var x")))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A1_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A1_T2.js new file mode 100644 index 000000000..930e96919 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A1_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. + +/** + * Result of number conversion from undefined value is NaN + * + * @path ch09/9.3/S9.3_A1_T2.js + * @description Undefined convert to Number by implicit transformation + */ + +// CHECK#1 +if (isNaN(+(undefined)) !== true) { + $ERROR('#1: +(undefined) === Not-a-Number. Actual: ' + (+(undefined))); +} + +// CHECK#2 +if (isNaN(+(void 0)) !== true) { + $ERROR('#2: +(void 0) === Not-a-Number. Actual: ' + (+(void 0))); +} + +// CHECK#3 +if (isNaN(+(eval("var x"))) !== true) { + $ERROR('#3: +(eval("var x")) === Not-a-Number. Actual: ' + (+(eval("var x")))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A2_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A2_T1.js new file mode 100644 index 000000000..2be743bc7 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A2_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. + +/** + * Result of number conversion from null value is +0 + * + * @path ch09/9.3/S9.3_A2_T1.js + * @description null convert to Number by explicit transformation + */ + +// CHECK #1 +if (Number(null) !== 0) { + $ERROR('#1.1: Number(null) === 0. Actual: ' + (Number(null))); +} else { + if (1/Number(null) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: Number(null) === +0. Actual: -0'); + } +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A2_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A2_T2.js new file mode 100644 index 000000000..ce035b90a --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A2_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. + +/** + * Result of number conversion from null value is +0 + * + * @path ch09/9.3/S9.3_A2_T2.js + * @description null convert to Number by implicit transformation + */ + +// CHECK #1 +if (+(null) !== 0) { + $ERROR('#1.1: +(null) === 0. Actual: ' + (+(null))); +} else { + if (1/+(null) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: +(null) === +0. Actual: -0'); + } +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A3_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A3_T1.js new file mode 100644 index 000000000..1feee2b6b --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A3_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. + +/** + * Result of number conversion from boolean value is 1 if the argument is true, else is +0 + * + * @path ch09/9.3/S9.3_A3_T1.js + * @description False and true convert to Number by explicit transformation + */ + +// CHECK#1 +if (Number(false) !== +0) { + $ERROR('#1.1: Number(false) === 0. Actual: ' + (Number(false))); +} else { + if (1/Number(false) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: Number(false) === +0. Actual: -0'); + } +} + +// CHECK#2 +if (Number(true) !== 1) { + $ERROR('#2: Number(true) === 1. Actual: ' + (Number(true))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A3_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A3_T2.js new file mode 100644 index 000000000..4b7f30539 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A3_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. + +/** + * Result of number conversion from boolean value is 1 if the argument is true, else is +0 + * + * @path ch09/9.3/S9.3_A3_T2.js + * @description False and true convert to Number by implicit transformation + */ + +// CHECK#1 +if (+(false) !== +0) { + $ERROR('#1.1: +(false) === 0. Actual: ' + (+(false))); +} else { + if (1/+(false) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: +(false) === +0. Actual: -0'); + } +} + +// CHECK#2 +if (+(true) !== 1) { + $ERROR('#2: +(true) === 1. Actual: ' + (+(true))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T1.js new file mode 100644 index 000000000..96d24be9f --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of number conversion from number value equals to the input argument (no conversion) + * + * @path ch09/9.3/S9.3_A4.1_T1.js + * @description Some numbers including Number.MAX_VALUE and Number.MIN_VALUE are converted to Number with explicit transformation + */ + +// CHECK#1 +if (Number(13) !== 13) { + $ERROR('#1: Number(13) === 13. Actual: ' + (Number(13))); +} + +// CHECK#2 +if (Number(-13) !== -13) { + $ERROR('#2: Number(-13) === -13. Actual: ' + (Number(-13))); +} + +// CHECK#3 +if (Number(1.3) !== 1.3) { + $ERROR('#3: Number(1.3) === 1.3. Actual: ' + (Number(1.3))); +} + +// CHECK#4 +if (Number(-1.3) !== -1.3) { + $ERROR('#4: Number(-1.3) === -1.3. Actual: ' + (Number(-1.3))); +} + +// CHECK#5 +if (Number(Number.MAX_VALUE) !== 1.7976931348623157e308) { + $ERROR('#5: Number(Number.MAX_VALUE) === 1.7976931348623157e308. Actual: ' + (Number(Number.MAX_VALUE))); +} + +// CHECK#6 +if (Number(Number.MIN_VALUE) !== 5e-324) { + $ERROR('#6: Number(Number.MIN_VALUE) === 5e-324. Actual: ' + (Number(Number.MIN_VALUE))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T2.js new file mode 100644 index 000000000..6c1c28b3d --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A4.1_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of number conversion from number value equals to the input argument (no conversion) + * + * @path ch09/9.3/S9.3_A4.1_T2.js + * @description Some numbers including Number.MAX_VALUE and Number.MIN_VALUE are converted to Number with implicit transformation + */ + +// CHECK#1 +if (+(13) !== 13) { + $ERROR('#1: +(13) === 13. Actual: ' + (+(13))); +} + +// CHECK#2 +if (+(-13) !== -13) { + $ERROR('#2: +(-13) === -13. Actual: ' + (+(-13))); +} + +// CHECK#3 +if (+(1.3) !== 1.3) { + $ERROR('#3: +(1.3) === 1.3. Actual: ' + (+(1.3))); +} + +// CHECK#4 +if (+(-1.3) !== -1.3) { + $ERROR('#4: +(-1.3) === -1.3. Actual: ' + (+(-1.3))); +} + +// CHECK#5 +if (+(Number.MAX_VALUE) !== 1.7976931348623157e308) { + $ERROR('#5: +(Number.MAX_VALUE) === 1.7976931348623157e308. Actual: ' + (+(Number.MAX_VALUE))); +} + +// CHECK#6 +if (+(Number.MIN_VALUE) !== 5e-324) { + $ERROR('#6: +(Number.MIN_VALUE) === 5e-324. Actual: ' + (+(Number.MIN_VALUE))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T1.js new file mode 100644 index 000000000..788f20cb9 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T1.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. + +/** + * Result of number conversion from number value equals to the input argument (no conversion) + * + * @path ch09/9.3/S9.3_A4.2_T1.js + * @description Number.NaN, +0, -0, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + * Number.MAX_VALUE and Number.MIN_VALUE convert to Number by explicit transformation + */ + +// CHECK#1 +if (isNaN(Number(Number.NaN)) !== true) { + $ERROR('#1: Number(NaN) === Not-a-Number. Actual: ' + (Number(NaN))); +} + +// CHECK#2 +if (Number(+0) !== +0) { + $ERROR('#2.1: Number(+0) === 0. Actual: ' + (Number(+0))); +} else { + if (1/Number(+0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: Number(+0) === +0. Actual: -0'); + } +} + +// CHECK#3 +if (Number(-0) !== -0) { + $ERROR('#3.1: Number(-0) === 0. Actual: ' + (Number(-0))); +} else { + if (1/Number(-0) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3.2: Number(-0) === -0. Actual: +0'); + } +} + +// CHECK#4 +if (Number(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#4: Number(+Infinity) === +Infinity. Actual: ' + (Number(+Infinity))); +} + +// CHECK#5 +if (Number(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#5: Number(-Infinity) === -Infinity. Actual: ' + (Number(-Infinity))); +} + +// CHECK#6 +if (Number(Number.MAX_VALUE) !== Number.MAX_VALUE) { + $ERROR('#6: Number(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (Number(Number.MAX_VALUE))); +} + +// CHECK#7 +if (Number(Number.MIN_VALUE) !== Number.MIN_VALUE) { + $ERROR('#7: Number(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (Number(Number.MIN_VALUE))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T2.js new file mode 100644 index 000000000..3e4d8ad4a --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A4.2_T2.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. + +/** + * Result of number conversion from number value equals to the input argument (no conversion) + * + * @path ch09/9.3/S9.3_A4.2_T2.js + * @description Number.NaN, +0, -0, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + * Number.MAX_VALUE and Number.MIN_VALUE convert to Number by implicit transformation + */ + +// CHECK#1 +if (isNaN(+(Number.NaN)) !== true) { + $ERROR('#1: +(NaN) === Not-a-Number. Actual: ' + (+(NaN))); +} + +// CHECK#2 +if (+(+0) !== +0) { + $ERROR('#2.1: +(+0) === 0. Actual: ' + (+(+0))); +} else { + if (1/+(+0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: +(+0) === +0. Actual: -0'); + } +} + +// CHECK#3 +if (+(-0) !== -0) { + $ERROR('#3.1: +(-0) === 0. Actual: ' + (+(-0))); +} else { + if (1/+(-0) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3.2: +(-0) === -0. Actual: +0'); + } +} + +// CHECK#4 +if (+(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#4: +(+Infinity) === +Infinity. Actual: ' + (+(+Infinity))); +} + +// CHECK#5 +if (+(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#5: +(-Infinity) === -Infinity. Actual: ' + (+(-Infinity))); +} + +// CHECK#6 +if (+(Number.MAX_VALUE) !== Number.MAX_VALUE) { + $ERROR('#6: +(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (+(Number.MAX_VALUE))); +} + +// CHECK#7 +if (+(Number.MIN_VALUE) !== Number.MIN_VALUE) { + $ERROR('#7: +(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (+(Number.MIN_VALUE))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A5_T1.js b/js/src/tests/test262/ch09/9.3/S9.3_A5_T1.js new file mode 100644 index 000000000..a76f65b1d --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A5_T1.js @@ -0,0 +1,126 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of number conversion from object value is the result + * of conversion from primitive value + * + * @path ch09/9.3/S9.3_A5_T1.js + * @description new Number(), new Number(0), new Number(Number.NaN), new Number(null), + * new Number(void 0) and others convert to Number by explicit transformation + */ + +// CHECK#1 +if (Number(new Number()) !== 0) { + $ERROR('#1: Number(new Number()) === 0. Actual: ' + (Number(new Number()))); +} + +// CHECK#2 +if (Number(new Number(0)) !== 0) { + $ERROR('#2: Number(new Number(0)) === 0. Actual: ' + (Number(new Number(0)))); +} + +// CHECK#3 +if (isNaN(Number(new Number(Number.NaN)) !== true)) { + $ERROR('#3: Number(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (Number(new Number(Number.NaN)))); +} + +// CHECK#4 +if (Number(new Number(null)) !== 0) { + $ERROR('#4.1: Number(new Number(null)) === 0. Actual: ' + (Number(new Number(null)))); +} else { + if (1/Number(new Number(null)) !== Number.POSITIVE_INFINITY) { + $ERROR('#4.2: Number(new Number(null)) === +0. Actual: -0'); + } +} + +// CHECK#5 +if (isNaN(Number(new Number(void 0)) !== true)) { + $ERROR('#5: Number(new Number(void 0)) === Not-a-Number. Actual: ' + (Number(new Number(void 0)))); +} + +// CHECK#6 +if (Number(new Number(true)) !== 1) { + $ERROR('#6: Number(new Number(true)) === 1. Actual: ' + (Number(new Number(true)))); +} + +// CHECK#7 +if (Number(new Number(false)) !== +0) { + $ERROR('#7.1: Number(new Number(false)) === 0. Actual: ' + (Number(new Number(false)))); +} else { + if (1/Number(new Number(false)) !== Number.POSITIVE_INFINITY) { + $ERROR('#7.2: Number(new Number(false)) === +0. Actual: -0'); + } +} + +// CHECK#8 +if (Number(new Boolean(true)) !== 1) { + $ERROR('#8: Number(new Boolean(true)) === 1. Actual: ' + (Number(new Boolean(true)))); +} + +// CHECK#9 +if (Number(new Boolean(false)) !== +0) { + $ERROR('#9.1: Number(new Boolean(false)) === 0. Actual: ' + (Number(new Boolean(false)))); +} else { + if (1/Number(new Boolean(false)) !== Number.POSITIVE_INFINITY) { + $ERROR('#9.2: Number(new Boolean(false)) === +0. Actual: -0'); + } +} + +// CHECK#10 +if (isNaN(Number(new Array(2,4,8,16,32))) !== true) { + $ERROR('#10: Number(new Array(2,4,8,16,32)) === Not-a-Number. Actual: ' + (Number(new Array(2,4,8,16,32)))); +} + +// CHECK#11 +var myobj1 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "[object MyObj]";} + }; + +if (isNaN(Number(myobj1)) !== true){ + $ERROR("#11: Number(myobj1) calls ToPrimitive with hint Number. Actual: " + (Number(myobj1))); +} + +// CHECK#12 +var myobj2 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "9876543210";} + }; + +if (Number(myobj2) !== 9876543210){ + $ERROR("#12: Number(myobj2) calls ToPrimitive with hint Number. Exptected: 9876543210. Actual: " + (Number(myobj2))); +} + + +// CHECK#13 +var myobj3 = { + ToNumber : function(){return 12345;}, + toString : function(){return "[object MyObj]";} + }; + +if (isNaN(Number(myobj3)) !== true){ + $ERROR("#13: Number(myobj3) calls ToPrimitive with hint Number. Exptected: Not-a-Number. Actual: " + (Number(myobj3))); +} + +// CHECK#14 +var myobj4 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";} + }; + +if (Number(myobj4) !== 67890){ + $ERROR("#14: Number(myobj4) calls ToPrimitive with hint Number. Exptected: 67890. Actual: " + (Number(myobj4))); +} + +// CHECK#15 +var myobj5 = { + ToNumber : function(){return 12345;} + }; + +if (isNaN(Number(myobj5)) !== true){ + $ERROR("#15: Number(myobj5) calls ToPrimitive with hint Number. Exptected: Not-a-Number. Actual: " + (Number(myobj5))); +} + diff --git a/js/src/tests/test262/ch09/9.3/S9.3_A5_T2.js b/js/src/tests/test262/ch09/9.3/S9.3_A5_T2.js new file mode 100644 index 000000000..b4ebb5422 --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/S9.3_A5_T2.js @@ -0,0 +1,126 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of number conversion from object value is the result + * of conversion from primitive value + * + * @path ch09/9.3/S9.3_A5_T2.js + * @description new Number(), new Number(0), new Number(Number.NaN), new Number(null), + * new Number(void 0) and others convert to Number by implicit transformation + */ + +// CHECK#1 +if (+(new Number()) !== 0) { + $ERROR('#1: +(new Number()) === 0. Actual: ' + (+(new Number()))); +} + +// CHECK#2 +if (+(new Number(0)) !== 0) { + $ERROR('#2: +(new Number(0)) === 0. Actual: ' + (+(new Number(0)))); +} + +// CHECK#3 +if (isNaN(+(new Number(Number.NaN)) !== true)) { + $ERROR('#3: +(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (+(new Number(Number.NaN)))); +} + +// CHECK#4 +if (+(new Number(null)) !== 0) { + $ERROR('#4.1: +(new Number(null)) === 0. Actual: ' + (+(new Number(null)))); +} else { + if (1/+(new Number(null)) !== Number.POSITIVE_INFINITY) { + $ERROR('#4.2: +(new Number(null)) === +0. Actual: -0'); + } +} + +// CHECK#5 +if (isNaN(+(new Number(void 0)) !== true)) { + $ERROR('#5: +(new Number(void 0)) === Not-a-Number. Actual: ' + (+(new Number(void 0)))); +} + +// CHECK#6 +if (+(new Number(true)) !== 1) { + $ERROR('#6: +(new Number(true)) === 1. Actual: ' + (+(new Number(true)))); +} + +// CHECK#7 +if (+(new Number(false)) !== +0) { + $ERROR('#7.1: +(new Number(false)) === 0. Actual: ' + (+(new Number(false)))); +} else { + if (1/+(new Number(false)) !== Number.POSITIVE_INFINITY) { + $ERROR('#7.2: +(new Number(false)) === +0. Actual: -0'); + } +} + +// CHECK#8 +if (+(new Boolean(true)) !== 1) { + $ERROR('#8: +(new Boolean(true)) === 1. Actual: ' + (+(new Boolean(true)))); +} + +// CHECK#9 +if (+(new Boolean(false)) !== +0) { + $ERROR('#9.1: +(new Boolean(false)) === 0. Actual: ' + (+(new Boolean(false)))); +} else { + if (1/+(new Boolean(false)) !== Number.POSITIVE_INFINITY) { + $ERROR('#9.2: +(new Boolean(false)) === +0. Actual: -0'); + } +} + +// CHECK#10 +if (isNaN(+(new Array(2,4,8,16,32))) !== true) { + $ERROR('#10: +(new Array(2,4,8,16,32)) === Not-a-Number. Actual: ' + (+(new Array(2,4,8,16,32)))); +} + +// CHECK#11 +var myobj1 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "[object MyObj]";} + }; + +if (isNaN(+(myobj1)) !== true){ + $ERROR("#11: +(myobj1) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj1))); +} + +// CHECK#12 +var myobj2 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "9876543210";} + }; + +if (+(myobj2) !== 9876543210){ + $ERROR("#12: +(myobj2) calls ToPrimitive with hint +. Exptected: 9876543210. Actual: " + (+(myobj2))); +} + + +// CHECK#13 +var myobj3 = { + ToNumber : function(){return 12345;}, + toString : function(){return "[object MyObj]";} + }; + +if (isNaN(+(myobj3)) !== true){ + $ERROR("#13: +(myobj3) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj3))); +} + +// CHECK#14 +var myobj4 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";} + }; + +if (+(myobj4) !== 67890){ + $ERROR("#14: +(myobj4) calls ToPrimitive with hint +. Exptected: 67890. Actual: " + (+(myobj4))); +} + +// CHECK#15 +var myobj5 = { + ToNumber : function(){return 12345;} + }; + +if (isNaN(+(myobj5)) !== true){ + $ERROR("#15: +(myobj5) calls ToPrimitive with hint +. Exptected: 12345. Actual: " + (+(myobj5))); +} + diff --git a/js/src/tests/test262/ch09/9.3/browser.js b/js/src/tests/test262/ch09/9.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/browser.js diff --git a/js/src/tests/test262/ch09/9.3/shell.js b/js/src/tests/test262/ch09/9.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.3/shell.js diff --git a/js/src/tests/test262/ch09/9.4/S9.4_A1.js b/js/src/tests/test262/ch09/9.4/S9.4_A1.js new file mode 100644 index 000000000..6c1b354c4 --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/S9.4_A1.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. + +/** + * If ToNumber(value) is NaN, ToInteger(value) returns +0 + * + * @path ch09/9.4/S9.4_A1.js + * @description Check what position is defined by Number.NaN in string "abc": "abc".charAt(Number.NaN) + */ + +// CHECK#1 +if ("abc".charAt(Number.NaN) !== "a") { + $ERROR('#1: "abc".charAt(Number.NaN) === "a". Actual: ' + ("abc".charAt(Number.NaN))); +} + +// CHECK#2 +if ("abc".charAt("x") !== "a") { + $ERROR('#2: "abc".charAt("x") === "a". Actual: ' + ("abc".charAt("x"))); +} + diff --git a/js/src/tests/test262/ch09/9.4/S9.4_A2.js b/js/src/tests/test262/ch09/9.4/S9.4_A2.js new file mode 100644 index 000000000..6b0ac54ac --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/S9.4_A2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If ToNumber(value) is +0, -0, +Infinity, or -Infinity, + * return ToNumber(value) + * + * @path ch09/9.4/S9.4_A2.js + * @description Check what position is defined by Number.NaN in string "abc": "abc".charAt(Number.NaN) + */ + +// CHECK#1 +if ("abc".charAt(0.0) !== "a") { + $ERROR('#1: "abc".charAt(0.0) === "a". Actual: ' + ("abc".charAt(0.0))); +} + +// CHECK#2 +if ("abc".charAt(-0.0) !== "a") { + $ERROR('#2: "abc".charAt(-0.0) === "a". Actual: ' + ("abc".charAt(-0.0))); +} + diff --git a/js/src/tests/test262/ch09/9.4/S9.4_A3_T1.js b/js/src/tests/test262/ch09/9.4/S9.4_A3_T1.js new file mode 100644 index 000000000..d16c30b38 --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/S9.4_A3_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. + +/** + * Result of ToInteger(value) conversion is the result of computing + * sign(ToNumber(value)) * floor(abs(ToNumber(value))) + * + * @path ch09/9.4/S9.4_A3_T1.js + * @description For testing constructor Date(Number) is used + */ + +// CHECK#1 +var d1 = new Date(6.54321); +if (d1.valueOf() !== 6) { + $ERROR('#1: var d1 = new Date(6.54321); d1.valueOf() === 6;'); +} + +// CHECK#2 +var d2 = new Date(-6.54321); +if (d2.valueOf() !== -6) { + $ERROR('#2: var d2 = new Date(-6.54321); d2.valueOf() === -6;'); +} + +// CHECK#3 +var d3 = new Date(6.54321e2); +if (d3.valueOf() !== 654) { + $ERROR('#3: var d3 = new Date(6.54321e2); d3.valueOf() === 654;'); +} + +// CHECK#4 +var d4 = new Date(-6.54321e2); +if (d4.valueOf() !== -654) { + $ERROR('#4: var d4 = new Date(-6.54321e2); d4.valueOf() === -654;'); +} + +// CHECK#5 +var d5 = new Date(0.654321e1); +if (d5.valueOf() !== 6) { + $ERROR('#5: var d5 = new Date(0.654321e1); d5.valueOf() === 6;'); +} + +// CHECK#6 +var d6 = new Date(-0.654321e1); +if (d6.valueOf() !== -6) { + $ERROR('#6: var d6 = new Date(-0.654321e1); d6.valueOf() === -6;'); +} + +// CHECK#7 +var d7 = new Date(true); +if (d7.valueOf() !== 1) { + $ERROR('#7: var d7 = new Date(true); d7.valueOf() === 1;'); +} + +// CHECK#8 +var d8 = new Date(false); +if (d8.valueOf() !== 0) { + $ERROR('#8: var d8 = new Date(false); d8.valueOf() === 0;'); +} + +// CHECK#9 +var d9 = new Date(1.23e15); +if (d9.valueOf() !== 1.23e15) { + $ERROR('#9: var d9 = new Date(1.23e15); d9.valueOf() === 1.23e15;'); +} + +// CHECK#10 +var d10 = new Date(-1.23e15); +if (d10.valueOf() !== -1.23e15) { + $ERROR('#10: var d10 = new Date(-1.23e15); d10.valueOf() === -1.23e15;'); +} + +// CHECK#11 +var d11 = new Date(1.23e-15); +if (d11.valueOf() !== 0) { + $ERROR('#11: var d11 = new Date(1.23e-15); d11.valueOf() === 0;'); +} + +// CHECK#12 +var d12 = new Date(-1.23e-15); +if (d12.valueOf() !== -0) { + $ERROR('#12: var d12 = new Date(-1.23e-15); d12.valueOf() === -0;'); +} + diff --git a/js/src/tests/test262/ch09/9.4/S9.4_A3_T2.js b/js/src/tests/test262/ch09/9.4/S9.4_A3_T2.js new file mode 100644 index 000000000..f3a9796e8 --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/S9.4_A3_T2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of ToInteger(value) conversion is the result of computing + * sign(ToNumber(value)) * floor(abs(ToNumber(value))) + * + * @path ch09/9.4/S9.4_A3_T2.js + * @description For testing constructor Date(NaN, Infinity, Infinity, +0 and -0) is used + */ + +// CHECK#1 +var d1 = new Date(Number.NaN); +if (!isNaN(d1.valueOf())) { + $ERROR('#1: var d1 = new Date(Number.NaN); d1.valueOf() === Number.NaN;'); +} + +// CHECK#2 +var d2 = new Date(Infinity); +if (!isNaN(d2.valueOf())) { + $ERROR('#2: var d2 = new Date(Infinity); d2.valueOf() === Number.NaN;'); +} + +// CHECK#3 +var d3 = new Date(-Infinity); +if (!isNaN(d3.valueOf())) { + $ERROR('#3: var d3 = new Date(-Infinity); d3.valueOf() === Number.NaN;'); +} + +// CHECK#4 +var d4 = new Date(0); +if (d4.valueOf() !== 0) { + $ERROR('#4: var d4 = new Date(0); d4.valueOf() === 0;'); +} + +// CHECK#5 +var d5 = new Date(-0); +if (d5.valueOf() !== -0) { + $ERROR('#5: var d5 = new Date(-0); d5.valueOf() === -0;'); +} + diff --git a/js/src/tests/test262/ch09/9.4/browser.js b/js/src/tests/test262/ch09/9.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/browser.js diff --git a/js/src/tests/test262/ch09/9.4/shell.js b/js/src/tests/test262/ch09/9.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.4/shell.js diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A1_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A1_T1.js new file mode 100644 index 000000000..76296a3a9 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A1_T1.js @@ -0,0 +1,52 @@ +// 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.5/S9.5_A1_T1.js + * @description For testing use operator <<0 + */ + +// CHECK#1 +if ((Number.NaN << 0) !== +0) { + $ERROR('#1.1: (Number.NaN << 0) === 0. Actual: ' + ((Number.NaN << 0))); +} else if (1/(Number.NaN << 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: (Number.NaN << 0) === +0. Actual: -0'); +} + +// CHECK#2 +if ((Number("abc") << 0) !== +0) { + $ERROR('#2.1: (Number("abc") << 0) === 0. Actual: ' + ((Number("abc") << 0))); +} else if (1/(0 << 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (0 << 0) === +0. Actual: -0'); +} + +// CHECK#3 +if ((0 << 0) !== +0) { + $ERROR('#3.1: (0 << 0) === 0. Actual: ' + ((0 << 0))); +} else if (1/(0 << 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: (0 << 0) === +0. Actual: -0'); +} + +// CHECK#4 +if ((-0 << 0) !== +0) { + $ERROR("#4.1: (-0 << 0) === 0"); +} else if (1/(-0 << 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#4.2: (-0 << 0) === +0. Actual: -0"); +} + +// CHECK#5 +if ((Number.POSITIVE_INFINITY << 0) !== +0) { + $ERROR('#5.1: (Number.POSITIVE_INFINITY << 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY << 0))); +} else if (1/(Number.POSITIVE_INFINITY << 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: (Number.POSITIVE_INFINITY << 0) === +0. Actual: -0'); +} + +// CHECK#6 +if ((Number.NEGATIVE_INFINITY << 0) !== +0) { + $ERROR("#6.1: (Number.NEGATIVE_INFINITY << 0) === 0"); +} else if (1/(Number.NEGATIVE_INFINITY << 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#6.2: (Number.NEGATIVE_INFINITY << 0) === +0. Actual: -0"); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.1_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.1_T1.js new file mode 100644 index 000000000..943425e85 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.1_T1.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. + +/** + * ToInt32 returns values between -2^31 and 2^31-1 + * + * @path ch09/9.5/S9.5_A2.1_T1.js + * @description Converting some numbers, which are in\outside of Int32 scopes, with <<0 operator + */ + +// CHECK#1 +if ((-2147483647 << 0) !== -2147483647) { + $ERROR('#1: (-2147483647 << 0) === -2147483647. Actual: ' + ((-2147483647 << 0))); +} + +// CHECK#2 +if ((-2147483648 << 0) !== -2147483648) { + $ERROR('#2: (-2147483648 << 0) === -2147483648. Actual: ' + ((-2147483648 << 0))); +} + +// CHECK#3 +if ((-2147483649 << 0) !== 2147483647) { + $ERROR('#3: (-2147483649 << 0) === 2147483647. Actual: ' + ((-2147483649 << 0))); +} + +// CHECK#4 +if ((-4294967296 << 0) !== 0) { + $ERROR('#4: (-4294967296 << 0) === 0. Actual: ' + ((-4294967296 << 0))); +} + +// CHECK#5 +if ((2147483646 << 0) !== 2147483646) { + $ERROR('#5: (2147483646 << 0) === 2147483646. Actual: ' + ((2147483646 << 0))); +} + +// CHECK#6 +if ((2147483647 << 0) !== 2147483647) { + $ERROR('#6: (2147483647 << 0) === 2147483647. Actual: ' + ((2147483647 << 0))); +} + +// CHECK#7 +if ((2147483648 << 0) !== -2147483648) { + $ERROR('#7: (2147483648 << 0) === -2147483648. Actual: ' + ((2147483648 << 0))); +} + +// CHECK#8 +if ((4294967296 << 0) !== 0) { + $ERROR('#8: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.1_T2.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.1_T2.js new file mode 100644 index 000000000..9037035c8 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.1_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. + +/** + * ToInt32 returns values between -2^31 and 2^31-1 + * + * @path ch09/9.5/S9.5_A2.1_T2.js + * @description Converting some numbers, which are in\outside of Int32 scopes, with ~ operator + */ + +// CHECK#1 +if (~-2147483649 !== ~2147483647) { + $ERROR('#1: ~-2147483649 === ~2147483647'); +} + +// CHECK#2 +if (~-4294967296 !== ~0) { + $ERROR('#2: ~-4294967296 === ~0'); +} + +// CHECK#3 +if (~2147483648 !== ~-2147483648) { + $ERROR('#3: ~2147483648 === ~-2147483648'); +} + +// CHECK#4 +if (~4294967296 !== ~0) { + $ERROR('#4: ~4294967296 === ~0'); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T1.js new file mode 100644 index 000000000..e8c454498 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T1.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^32 + * + * @path ch09/9.5/S9.5_A2.2_T1.js + * @description Use operator <<0 + */ + +// CHECK#1 +if ((-2147483647 << 0) !== -2147483647) { + $ERROR('#1: (-2147483647 << 0) === -2147483647. Actual: ' + ((-2147483647 << 0))); +} + +// CHECK#2 +if ((-2147483648 << 0) !== -2147483648) { + $ERROR('#2: (-2147483648 << 0) === -2147483648. Actual: ' + ((-2147483648 << 0))); +} + +// CHECK#3 +if ((-2147483649 << 0) !== 2147483647) { + $ERROR('#3: (-2147483649 << 0) === 2147483647. Actual: ' + ((-2147483649 << 0))); +} + +// CHECK#4 +if ((4294967295 << 0) !== -1) { + $ERROR('#4: (4294967295 << 0) === -1. Actual: ' + ((4294967295 << 0))); +} + +// CHECK#5 +if ((4294967296 << 0) !== 0) { + $ERROR('#5: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + +// CHECK#6 +if ((4294967297 << 0) !== 1) { + $ERROR('#6: (4294967297 << 0) === 1. Actual: ' + ((4294967297 << 0))); +} + +// CHECK#7 +if ((-4294967295 << 0) !== 1) { + $ERROR('#7: (-4294967295 << 0) === 1. Actual: ' + ((-4294967295 << 0))); +} + +// CHECK#8 +if ((-4294967296 << 0) !== 0) { + $ERROR('#8: (-4294967296 << 0) === 0. Actual: ' + ((-4294967296 << 0))); +} + +// CHECK#9 +if ((-4294967297 << 0) !== -1) { + $ERROR('#9: (-4294967297 << 0) === -1. Actual: ' + ((-4294967297 << 0))); +} + +// CHECK#10 +if ((8589934591 << 0) !== -1) { + $ERROR('#10: (8589934591 << 0) === -1. Actual: ' + ((8589934591 << 0))); +} + +// CHECK#11 +if ((8589934592 << 0) !== 0) { + $ERROR('#11: (8589934592 << 0) === 0. Actual: ' + ((8589934592 << 0))); +} + +// CHECK#12 +if ((8589934593 << 0) !== 1) { + $ERROR('#12: (8589934593 << 0) === 1. Actual: ' + ((8589934593 << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T2.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T2.js new file mode 100644 index 000000000..a138d03d7 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.2_T2.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^32 + * + * @path ch09/9.5/S9.5_A2.2_T2.js + * @description Use operator ~ + */ + +// CHECK#1 +if (~-2147483647 !== 2147483646) { + $ERROR('#1: ~-2147483647 === 2147483646)'); +} + +// CHECK#2 +if (~-2147483648 !== ~-2147483648) { + $ERROR('#2: ~-2147483648 ==== ~-2147483648)'); +} + +// CHECK#3 +if (~-2147483649 !== ~2147483647) { + $ERROR('#3: ~-2147483649 ==== ~2147483647)'); +} + +// CHECK#4 +if ((~4294967295 << 0) !== ~-1) { + $ERROR('#4: (~4294967295 << 0) === ~-1)'); +} + +// CHECK#5 +if ((~4294967296 << 0) !== ~0) { + $ERROR('#5: (~4294967296 << 0) === ~0)'); +} + +// CHECK#6 +if ((~4294967297 << 0) !== ~1) { + $ERROR('#6: (~4294967297 << 0) === ~1)'); +} + +// CHECK#7 +if ((~-4294967295 << 0) !== ~1) { + $ERROR('#7: (~-4294967295 << 0) === ~1)'); +} + +// CHECK#8 +if ((~-4294967296 << 0) !== ~0) { + $ERROR('#8: (~-4294967296 << 0) === ~0)'); +} + +// CHECK#9 +if ((~-4294967297 << 0) !== ~-1) { + $ERROR('#9: (~-4294967297 << 0) === ~-1)'); +} + +// CHECK#10 +if ((~8589934591 << 0) !== ~-1) { + $ERROR('#10: (~8589934591 << 0) === ~-1)'); +} + +// CHECK#11 +if ((~8589934592 << 0) !== ~0) { + $ERROR('#11: (~8589934592 << 0) === ~0)'); +} + +// CHECK#12 +if ((~8589934593 << 0) !== ~1) { + $ERROR('#12: (~8589934593 << 0) === ~1)'); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T1.js new file mode 100644 index 000000000..af0e3702e --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If result is greater than or equal to 2^31, return result -2^32 + * + * @path ch09/9.5/S9.5_A2.3_T1.js + * @description Use operator <<0 + */ + +// CHECK#1 +if ((2147483647 << 0) !== 2147483647) { + $ERROR('#1: (2147483647 << 0) === 2147483647. Actual: ' + ((2147483647 << 0))); +} + +// CHECK#2 +if ((2147483648 << 0) !== -2147483648) { + $ERROR('#2: (2147483648 << 0) === -2147483648. Actual: ' + ((2147483648 << 0))); +} + +// CHECK#3 +if ((2147483649 << 0) !== -2147483647) { + $ERROR('#3: (2147483649 << 0) === -2147483647. Actual: ' + ((2147483649 << 0))); +} + +// CHECK#4 +if ((4294967295 << 0) !== -1) { + $ERROR('#4: (4294967295 << 0) === -1. Actual: ' + ((4294967295 << 0))); +} + +// CHECK#5 +if ((4294967296 << 0) !== 0) { + $ERROR('#5: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + +// CHECK#6 +if ((4294967297 << 0) !== 1) { + $ERROR('#6: (4294967297 << 0) === 1. Actual: ' + ((4294967297 << 0))); +} + + + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T2.js b/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T2.js new file mode 100644 index 000000000..70c23270b --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A2.3_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If result is greater than or equal to 2^31, return result -2^32 + * + * @path ch09/9.5/S9.5_A2.3_T2.js + * @description Use operator ~ + */ + +// CHECK#1 +if (~2147483647 !== -2147483648) { + $ERROR('#1: ~2147483647 ==== -2147483648)'); +} + +// CHECK#2 +if (~2147483648 !== ~-2147483648) { + $ERROR('#2: ~2147483648 ==== ~-2147483648)'); +} + +// CHECK#3 +if (~2147483649 !== ~-2147483647) { + $ERROR('#3: ~2147483649 ==== ~-2147483647)'); +} + +// CHECK#4 +if (~4294967295 !== ~-1) { + $ERROR('#4: ~4294967295 ==== ~-1)'); +} + +// CHECK#5 +if (~4294967296 !== ~0) { + $ERROR('#5: ~4294967296 ==== ~0)'); +} + +// CHECK#6 +if (~4294967297 !== ~1) { + $ERROR('#6: ~4294967297 ==== ~1)'); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T1.js new file mode 100644 index 000000000..ea9cc2048 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_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.5/S9.5_A3.1_T1.js + * @description Type(x) is Boolean + */ + +// CHECK#1 +if ((new Boolean(true) << 0) !== 1) { + $ERROR('#1: (new Boolean(true) << 0) === 1. Actual: ' + ((new Boolean(true) << 0))); +} + +// CHECK#2 +if ((false << 0) !== 0) { + $ERROR('#2: (false << 0) === 0. Actual: ' + ((false << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T2.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T2.js new file mode 100644 index 000000000..0a8769ba8 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_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.5/S9.5_A3.1_T2.js + * @description Type(x) is Number + */ + +// CHECK#1 +if ((new Number(1) << 0) !== 1) { + $ERROR('#1: (new Number(1) << 0) === 1. Actual: ' + ((new Number(1) << 0))); +} + +// CHECK#2 +if ((-1.234 << 0) !== -1) { + $ERROR('#2: (-1.234 << 0) === -1. Actual: ' + ((-1.234 << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T3.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T3.js new file mode 100644 index 000000000..5886b0daf --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_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.5/S9.5_A3.1_T3.js + * @description Type(x) is String + */ + +// CHECK#1 +if ((new String(1) << 0) !== 1) { + $ERROR('#1: (new String(1) << 0) === 1. Actual: ' + ((new String(1) << 0))); +} + +// CHECK#2 +if (("-1.234" << 0) !== -1) { + $ERROR('#2: ("-1.234" << 0) === -1. Actual: ' + (("-1.234" << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T4.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.1_T4.js new file mode 100644 index 000000000..a4a701fc5 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_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.5/S9.5_A3.1_T4.js + * @description Type(x) is Object + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (~object !== ~1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; ~object === ~1'); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (~object !== ~1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === ~1'); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (~object !== ~1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === ~1'); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (~object !== ~1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === ~1'); + } +} +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 (~object !== ~1) { + $ERROR('#5: var object = {toString: function() {return 1}}; ~object === ~1'); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (~object !== ~1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === ~1'); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ~object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object)); +} +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; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object)); +} +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.5/S9.5_A3.2_T1.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.2_T1.js new file mode 100644 index 000000000..6a53855b4 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_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.5/S9.5_A3.2_T1.js + * @description Use operator <<0 + */ + +// CHECK#1 +if ((1.2345 << 0) !== 1) { + $ERROR('#1: (1.2345 << 0) === 1. Actual: ' + ((1.2345 << 0))); +} + +// CHECK#2 +if ((-5.4321 << 0) !== -5) { + $ERROR('#2: (-5.4321 << 0) === -5. Actual: ' + ((-5.4321 << 0))); +} + diff --git a/js/src/tests/test262/ch09/9.5/S9.5_A3.2_T2.js b/js/src/tests/test262/ch09/9.5/S9.5_A3.2_T2.js new file mode 100644 index 000000000..47838f6a1 --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/S9.5_A3.2_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 floor, abs + * + * @path ch09/9.5/S9.5_A3.2_T2.js + * @description Use operator ~ + */ + +// CHECK#1 +if (~1.2345 !== ~1) { + $ERROR('#1: ~1.2345 === ~1)'); +} + +// CHECK#2 +if (~-5.4321 !== ~-5) { + $ERROR('#2: ~-5.4321 === ~-5)'); +} + diff --git a/js/src/tests/test262/ch09/9.5/browser.js b/js/src/tests/test262/ch09/9.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/browser.js diff --git a/js/src/tests/test262/ch09/9.5/shell.js b/js/src/tests/test262/ch09/9.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.5/shell.js diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A1.js b/js/src/tests/test262/ch09/9.6/S9.6_A1.js new file mode 100644 index 000000000..6e370541b --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A1.js + * @description For testing use operator >>>0 + */ + +// CHECK#1 +if ((Number.NaN >>> 0) !== +0) { + $ERROR('#1.1: (Number.NaN >>> 0) === 0. Actual: ' + ((Number.NaN >>> 0))); +} else if (1/(Number.NaN >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: (Number.NaN >>> 0) === +0. Actual: -0'); +} + +// CHECK#2 +if ((Number("abc") >>> 0) !== +0) { + $ERROR('#2.1: (Number("abc") >>> 0) === 0. Actual: ' + ((Number("abc") >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#3 +if ((0 >>> 0) !== +0) { + $ERROR('#3.1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#4 +if ((-0 >>> 0) !== +0) { + $ERROR("#4.1: (-0 >>> 0) === 0"); +} else if (1/(-0 >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#4.2: (-0 >>> 0) === +0. Actual: -0"); +} + +// CHECK#5 +if ((Number.POSITIVE_INFINITY >>> 0) !== +0) { + $ERROR('#5.1: (Number.POSITIVE_INFINITY >>> 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY >>> 0))); +} else if (1/(Number.POSITIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: (Number.POSITIVE_INFINITY >>> 0) === +0. Actual: -0'); +} + +// CHECK#6 +if ((Number.NEGATIVE_INFINITY >>> 0) !== +0) { + $ERROR("#6.1: (Number.NEGATIVE_INFINITY >>> 0) === 0"); +} else if (1/(Number.NEGATIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + $ERROR("#6.2: (Number.NEGATIVE_INFINITY >>> 0) === +0. Actual: -0"); +} + + + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A2.1.js b/js/src/tests/test262/ch09/9.6/S9.6_A2.1.js new file mode 100644 index 000000000..cc2f38c85 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_A2.1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ToUint32 returns values between 0 and 2^32-1 + * + * @path ch09/9.6/S9.6_A2.1.js + * @description Converting numbers, which are in\outside of Uint32 scopes, with >>>0 operator + */ + +// CHECK#1 +if ((0 >>> 0) !== 0) { + $ERROR('#1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} + +// CHECK#2 +if ((1 >>> 0) !== 1) { + $ERROR('#2: (1 >>> 0) === 1. Actual: ' + ((1 >>> 0))); +} + +// CHECK#3 +if ((-1 >>> 0) !== 4294967295) { + $ERROR('#3: (-1 >>> 0) === 4294967295. Actual: ' + ((-1 >>> 0))); +} + +// CHECK#4 +if ((4294967295 >>> 0) !== 4294967295) { + $ERROR('#4: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#5 +if ((4294967294 >>> 0) !== 4294967294) { + $ERROR('#5: (4294967294 >>> 0) === 4294967294. Actual: ' + ((4294967294 >>> 0))); +} + +// CHECK#6 +if ((4294967296 >>> 0) !== 0) { + $ERROR('#6: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A2.2.js b/js/src/tests/test262/ch09/9.6/S9.6_A2.2.js new file mode 100644 index 000000000..7438cbe95 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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^32 + * + * @path ch09/9.6/S9.6_A2.2.js + * @description Use operator >>>0 + */ + +// CHECK#1 +if ((-2147483647 >>> 0) !== 2147483649) { + $ERROR('#1: (-2147483647 >>> 0) === 2147483649. Actual: ' + ((-2147483647 >>> 0))); +} + +// CHECK#2 +if ((-2147483648 >>> 0) !== 2147483648) { + $ERROR('#2: (-2147483648 >>> 0) === 2147483648. Actual: ' + ((-2147483648 >>> 0))); +} + +// CHECK#3 +if ((-2147483649 >>> 0) !== 2147483647) { + $ERROR('#3: (-2147483649 >>> 0) === 2147483647. Actual: ' + ((-2147483649 >>> 0))); +} + +// CHECK#4 +if ((-4294967295 >>> 0) !== 1) { + $ERROR('#4: (-4294967295 >>> 0) === 1. Actual: ' + ((-4294967295 >>> 0))); +} + +// CHECK#5 +if ((-4294967296 >>> 0) !== 0) { + $ERROR('#5: (-4294967296 >>> 0) === 0. Actual: ' + ((-4294967296 >>> 0))); +} + +// CHECK#6 +if ((-4294967297 >>> 0) !== 4294967295) { + $ERROR('#6: (-4294967297 >>> 0) === 4294967295. Actual: ' + ((-4294967297 >>> 0))); +} + +// CHECK#7 +if ((4294967295 >>> 0) !== 4294967295) { + $ERROR('#7: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#8 +if ((4294967296 >>> 0) !== 0) { + $ERROR('#8: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + +// CHECK#9 +if ((4294967297 >>> 0) !== 1) { + $ERROR('#9: (4294967297 >>> 0) === 1. Actual: ' + ((4294967297 >>> 0))); +} + +// CHECK#10 +if ((8589934591 >>> 0) !== 4294967295) { + $ERROR('#10: (8589934591 >>> 0) === 4294967295. Actual: ' + ((8589934591 >>> 0))); +} + +// CHECK#11 +if ((8589934592 >>> 0) !== 0) { + $ERROR('#11: (8589934592 >>> 0) === 0. Actual: ' + ((8589934592 >>> 0))); +} + +// CHECK#12 +if ((8589934593 >>> 0) !== 1) { + $ERROR('#12: (8589934593 >>> 0) === 1. Actual: ' + ((8589934593 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T1.js new file mode 100644 index 000000000..d73f715b9 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A3.1_T1.js + * @description Type(x) is Boolean + */ + +// CHECK#1 +if ((new Boolean(true) >>> 0) !== 1) { + $ERROR('#1: (new Boolean(true) >>> 0) === 1. Actual: ' + ((new Boolean(true) >>> 0))); +} + +// CHECK#2 +if ((false >>> 0) !== 0) { + $ERROR('#2: (false >>> 0) === 0. Actual: ' + ((false >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T2.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T2.js new file mode 100644 index 000000000..5e99b13b3 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A3.1_T2.js + * @description Type(x) is Number + */ + +// CHECK#1 +if ((new Number(1) >>> 0) !== 1) { + $ERROR('#1: (new Number(1) >>> 0) === 1. Actual: ' + ((new Number(1) >>> 0))); +} + +// CHECK#2 +if ((-1.234 >>> 0) !== 4294967295) { + $ERROR('#2: (-1.234 >>> 0) === 4294967295. Actual: ' + ((-1.234 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T3.js new file mode 100644 index 000000000..480ffd0cc --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A3.1_T3.js + * @description Type(x) is String + */ + +// CHECK#1 +if ((new String(1) >>> 0) !== 1) { + $ERROR('#1: (new String(1) >>> 0) === 1. Actual: ' + ((new String(1) >>> 0))); +} + +// CHECK#2 +if (("-1.234" >>> 0) !== 4294967295) { + $ERROR('#2: ("-1.234" >>> 0) === 4294967295. Actual: ' + (("-1.234" >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.1_T4.js new file mode 100644 index 000000000..65381fd0d --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A3.1_T4.js + * @description Type(x) is Object + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if ((object >>> 0) !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if ((object >>> 0) !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if ((object >>> 0) !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if ((object >>> 0) !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; (object >>> 0) === 1. Actual: ' + ((object >>> 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 ((object >>> 0) !== 1) { + $ERROR('#5: var object = {toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if ((object >>> 0) !== 1) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 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.6/S9.6_A3.2_T1.js b/js/src/tests/test262/ch09/9.6/S9.6_A3.2_T1.js new file mode 100644 index 000000000..87d0b2a84 --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/S9.6_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.6/S9.6_A3.2_T1.js + * @description Use operator >>>0 + */ + +// CHECK#1 +if ((1.2345 >>> 0) !== 1) { + $ERROR('#1: (1.2345 >>> 0) === 1. Actual: ' + ((1.2345 >>> 0))); +} + +// CHECK#2 +if ((-5.4321 >>> 0) !== 4294967291) { + $ERROR('#2: (-5.4321 >>> 0) === 4294967291. Actual: ' + ((-5.4321 >>> 0))); +} + diff --git a/js/src/tests/test262/ch09/9.6/browser.js b/js/src/tests/test262/ch09/9.6/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/browser.js diff --git a/js/src/tests/test262/ch09/9.6/shell.js b/js/src/tests/test262/ch09/9.6/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.6/shell.js 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 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/browser.js 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 --- /dev/null +++ b/js/src/tests/test262/ch09/9.7/shell.js diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A1.js new file mode 100644 index 000000000..b51e4cca1 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.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. + +/** + * If m is NaN, return the string "NaN" + * + * @path ch09/9.8/9.8.1/S9.8.1_A1.js + * @description NaN convert to String by explicit transformation + */ + +// CHECK#1 +if (String(NaN) !== "NaN") { + $ERROR('#1: String(NaN) === Not-a-Number Actual: ' + (String(NaN))); +} + +// CHECK#2 +if (String(Number.NaN) !== "NaN") { + $ERROR('#2: String(Number.NaN) === Not-a-Number Actual: ' + (String(Number.NaN))); +} + +// CHECK#3 +if (String(Number("asasa")) !== "NaN") { + $ERROR('#3: String(Number("asasa")) === Not-a-Number Actual: ' + (String(Number("asasa")))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.js new file mode 100644 index 000000000..17fa40697 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A10.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. + +/** + * Return the string consisting of the most significant + * digit of the decimal representation of s, followed by a decimal point '.', + * followed by the remaining k-1 digits of the decimal representation of s, + * followed by the lowercase character 'e', followed by a plus sign '+' or + * minus sign '-' according to whether n-1 is positive or negative, followed + * by the decimal representation of the integer abs(n-1) (with no leading zeros) + * + * @path ch09/9.8/9.8.1/S9.8.1_A10.js + * @description Various float numbers convert to String by explicit transformation + */ + +// CHECK#1 +if (String(1.2345) !== "1.2345") { + $ERROR('#1: String(1.2345) === "1.2345". Actual: ' + (String(1.2345))); +} + +// CHECK#2 +if (String(1.234567890) !== "1.23456789") { + $ERROR('#2: String(1.234567890) === "1.23456789". Actual: ' + (String(1.234567890))); +} + +// CHECK#3 +if (String(0.12345) !== "0.12345") { + $ERROR('#3: String(0.12345) === "0.12345". Actual: ' + (String(0.12345))); +} + +// CHECK#4 +if (String(.012345) !== "0.012345") { + $ERROR('#4: String(.012345) === "0.012345". Actual: ' + (String(.012345))); +} + +// CHECK#5 +if (String(.0012345) !== "0.0012345") { + $ERROR('#5: String(.0012345) === "0.0012345". Actual: ' + (String(.0012345))); +} + +// CHECK#6 +if (String(.00012345) !== "0.00012345") { + $ERROR('#6: String(.00012345) === "0.00012345". Actual: ' + (String(.00012345))); +} + +// CHECK#7 +if (String(.000012345) !== "0.000012345") { + $ERROR('#7: String(.000012345) === "0.000012345". Actual: ' + (String(.000012345))); +} + +// CHECK#8 +if (String(.0000012345) !== "0.0000012345") { + $ERROR('#8: String(.0000012345) === "0.0000012345". Actual: ' + (String(.0000012345))); +} + +// CHECK#9 +if (String(.00000012345) !== "1.2345e-7") { + $ERROR('#9: String(.00000012345) === "1.2345e-7". Actual: ' + (String(.00000012345))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.js new file mode 100644 index 000000000..adc8e1f5e --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A2.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. + +/** + * If m is +0 or -0, return the string "0" + * + * @path ch09/9.8/9.8.1/S9.8.1_A2.js + * @description +0 and -0 convert to String by explicit transformation + */ + +// CHECK#1 +if (String(+0) !== "0") { + $ERROR('#1: String(+0) === "0". Actual: ' + (String(+0))); +} + +// CHECK#2 +if (String(-0) !== "0") { + $ERROR('#2: String(-0) === "0". Actual: ' + (String(-0))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js new file mode 100644 index 000000000..3945f2279 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If m is less than zero, return the string concatenation of the + * string "-" and ToString(-m) + * + * @path ch09/9.8/9.8.1/S9.8.1_A3.js + * @description -1234567890 convert to String by explicit transformation + */ + +// CHECK#1 +if (String(-1234567890) !== "-1234567890") { + $ERROR('#1: String(-1234567890) === "-1234567890". Actual: ' + (String(-1234567890))); +} + +// CHECK#2 +if ("-"+String(-(-1234567890)) !== "-1234567890") { + $ERROR('#2: "-"+String(-(-1234567890)) === "-1234567890". Actual: ' + ("-"+String(-(-1234567890)))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.js new file mode 100644 index 000000000..f71ac7557 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A4.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. + +/** + * If m is infinity, return the string "Infinity" + * + * @path ch09/9.8/9.8.1/S9.8.1_A4.js + * @description +/-Infinity convert to String by explicit transformation + */ + +// CHECK#1 +if (String(Infinity) !== "Infinity") { + $ERROR('#1: String(Infinity) === "Infinity". Actual: ' + (String(Infinity))); +} + +// CHECK#2 +if (String(Number.POSITIVE_INFINITY) !== "Infinity") { + $ERROR('#2: String(Number.POSITIVE_INFINITY) === "Infinity". Actual: ' + (String(Number.POSITIVE_INFINITY))); +} + +// CHECK#3 +if (String(-Infinity) !== "-Infinity") { + $ERROR('#3: String(-Infinity) === "-Infinity". Actual: ' + (String(-Infinity))); +} + +// CHECK#4 +if (String(Number.NEGATIVE_INFINITY) !== "-Infinity") { + $ERROR('#4: String(Number.NEGATIVE_INFINITY) === "-Infinity". Actual: ' + (String(Number.NEGATIVE_INFINITY))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js new file mode 100644 index 000000000..8b9ddf42e --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A6.js @@ -0,0 +1,93 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If 1 <= s < 1e21 or -1e21 s < -1, return the string + * consisting of the k digits of the decimal representation of s (in order, + * with no leading zeroes), followed by n-k occurrences of the character '0' + * + * @path ch09/9.8/9.8.1/S9.8.1_A6.js + * @description Various integer numbers convert to String by explicit transformation + */ + +// CHECK#1 +if (String(1) !== "1") { + $ERROR('#1: String(1) === "1". Actual: ' + (String(1))); +} + +// CHECK#2 +if (String(10) !== "10") { + $ERROR('#2: String(10) === "10". Actual: ' + (String(10))); +} + +// CHECK#3 +if (String(100) !== "100") { + $ERROR('#3: String(100) === "100". Actual: ' + (String(100))); +} + +// CHECK#4 +if (String(100000000000000000000) !== "100000000000000000000") { + $ERROR('#4: String(100000000000000000000) === "100000000000000000000". Actual: ' + (String(100000000000000000000))); +} + +// CHECK#5 +if (String(1e20) !== "100000000000000000000") { + $ERROR('#5: String(1e20) === "100000000000000000000". Actual: ' + (String(1e20))); +} + +// CHECK#6 +if (String(12345) !== "12345") { + $ERROR('#6: String(12345) === "12345". Actual: ' + (String(12345))); +} + +// CHECK#7 +if (String(12345000) !== "12345000") { + $ERROR('#7: String(12345000) === "12345000". Actual: ' + (String(12345000))); +} + +// CHECK#8 +if (String(-1) !== "-1") { + $ERROR('#8: String(-1) === "-1". Actual: ' + (String(-1))); +} + +// CHECK#9 +if (String(-10) !== "-10") { + $ERROR('#9: String(-10) === "-10". Actual: ' + (String(-10))); +} + +// CHECK#10 +if (String(-100) !== "-100") { + $ERROR('#3: String(-100) === "-100". Actual: ' + (String(-100))); +} + +// CHECK#10 +if (String(-100000000000000000000) !== "-100000000000000000000") { + $ERROR('#10: String(-100000000000000000000) === "-100000000000000000000". Actual: ' + (String(-100000000000000000000))); +} + +// CHECK#11 +if (String(-1e20) !== "-100000000000000000000") { + $ERROR('#11: String(-1e20) === "-100000000000000000000". Actual: ' + (String(-1e20))); +} + +// CHECK#12 +if (String(-12345) !== "-12345") { + $ERROR('#12: String(-12345) === "-12345". Actual: ' + (String(-12345))); +} + +// CHECK#13 +if (String(-12345000) !== "-12345000") { + $ERROR('#13: String(-12345000) === "-12345000". Actual: ' + (String(-12345000))); +} + +// CHECK#14 +if (String(1E20) !== "100000000000000000000") { + $ERROR('#14: String(1E20) === "100000000000000000000". Actual: ' + (String(1E20))); +} + +// CHECK#15 +if (String(-1E20) !== "-100000000000000000000") { + $ERROR('#15: String(-1E20) === "-100000000000000000000". Actual: ' + (String(-1E20))); +} + + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js new file mode 100644 index 000000000..5ad14c25d --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If 1 <= s < 1e21 or -1e21 s < -1 and s has a fractional + * component, return the string consisting of the most significant n digits of + * the decimal representation of s, followed by a decimal point '.', + * followed by the remaining k-n digits of the decimal representation of s + * + * @path ch09/9.8/9.8.1/S9.8.1_A7.js + * @description 1.0000001 and -1.0000001 convert to String by explicit transformation + */ + +// CHECK#1 +if (String(1.0000001) !== "1.0000001") { + $ERROR('#1: String(1.0000001) === "1.0000001". Actual: ' + (String(1.0000001))); +} + +// CHECK#2 +if (String(-1.0000001) !== "-1.0000001") { + $ERROR('#2: String(-1.0000001) === "-1.0000001". Actual: ' + (String(-1.0000001))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.js new file mode 100644 index 000000000..91efe0b52 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A8.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 1 > s > -1, and -6 < n <= 0, return the string consisting of the + * character '0', followed by a decimal point '.', followed by -n occurrences + * of the character '0', followed by the k digits of the decimal + * representation of s + * + * @path ch09/9.8/9.8.1/S9.8.1_A8.js + * @description Various float numbers convert to String by explicit transformation + */ + +// CHECK#1 +if (String(0.1) !== "0.1") { + $ERROR('#1: String(0.1) === "0.1". Actual: ' + (String(0.1))); +} + +// CHECK#2 +if (String(0.000001) !== "0.000001") { + $ERROR('#2: String(0.000001) === "0.000001". Actual: ' + (String(0.000001))); +} + +// CHECK#3 +if (String(1e-6) !== "0.000001") { + $ERROR('#3: String(1e-6) === "0.000001". Actual: ' + (String(1e-6))); +} + +// CHECK#4 +if (String(1E-6) !== "0.000001") { + $ERROR('#4: String(1E-6) === "0.000001". Actual: ' + (String(1E-6))); +} + +// CHECK#5 +if (String(-0.1) !== "-0.1") { + $ERROR('#5: String(-0.1) === "-0.1". Actual: ' + (String(-0.1))); +} + +// CHECK#6 +if (String(-0.000001) !== "-0.000001") { + $ERROR('#6: String(-0.000001) === "-0.000001". Actual: ' + (String(-0.000001))); +} + +// CHECK#7 +if (String(-1e-6) !== "-0.000001") { + $ERROR('#7: String(-1e-6) === "0.000001". Actual: ' + (String(-1e-6))); +} + +// CHECK#8 +if (String(-1E-6) !== "-0.000001") { + $ERROR('#8: String(-1E-6) === "0.000001". Actual: ' + (String(-1E-6))); +} + + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T1.js new file mode 100644 index 000000000..d4614194b --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_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. + +/** + * Return the string consisting of the single digit of s, + * followed by lowercase character 'e', followed by a plus sign '+' or minus + * sign '-' according to whether n-1 is positive or negative, followed by the + * decimal representation of the integer abs(n-1) (with no leading zeros) + * + * @path ch09/9.8/9.8.1/S9.8.1_A9_T1.js + * @description Various big numbers convert to String by explicit transformation + */ + +// CHECK#1 +if (String(1000000000000000000000) !== "1e+21") { + $ERROR('#1: String(1000000000000000000000) === "1e+21". Actual: ' + (String(1000000000000000000000))); +} + +// CHECK#2 +if (String(10000000000000000000000) !== "1e+22") { + $ERROR('#2: String(10000000000000000000000) === "1e+22". Actual: ' + (String(10000000000000000000000))); +} + +// CHECK#3 +if (String(1e21) !== "1e+21") { + $ERROR('#3: String(1e21) === "1e+21". Actual: ' + (String(1e21))); +} + +// CHECK#4 +if (String(1.0e22) !== "1e+22") { + $ERROR('#4: String(1.0e22) === "1e+22". Actual: ' + (String(1.0e22))); +} + +// CHECK#5 +if (String(1E21) !== "1e+21") { + $ERROR('#5: String(1E21) === "1e+21". Actual: ' + (String(1E21))); +} + +// CHECK#6 +if (String(1.0E22) !== "1e+22") { + $ERROR('#6: String(1.0E22) === "1e+22". Actual: ' + (String(1.0E22))); +} + +// CHECK#7 +if (String(-1000000000000000000000) !== "-1e+21") { + $ERROR('#7: String(-1000000000000000000000) === "-1e+21". Actual: ' + (String(-1000000000000000000000))); +} + +// CHECK#8 +if (String(-10000000000000000000000) !== "-1e+22") { + $ERROR('#8: String(-10000000000000000000000) === "-1e+22". Actual: ' + (String(-10000000000000000000000))); +} + +// CHECK#9 +if (String(-1e21) !== "-1e+21") { + $ERROR('#9: String(-1e21) === "-1e+21". Actual: ' + (String(-1e21))); +} + +// CHECK#10 +if (String(-1.0e22) !== "-1e+22") { + $ERROR('#10: String(-1.0e22) === "-1e+22". Actual: ' + (String(-1.0e22))); +} + +// CHECK#11 +if (String(-1E21) !== "-1e+21") { + $ERROR('#11: String(-1E21) === "-1e+21". Actual: ' + (String(-1E21))); +} + +// CHECK#12 +if (String(-1.0E22) !== "-1e+22") { + $ERROR('#12: String(-1.0E22) === "-1e+22". Actual: ' + (String(-1.0E22))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.js new file mode 100644 index 000000000..79ca7873e --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/S9.8.1_A9_T2.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. + +/** + * Return the string consisting of the single digit of s, + * followed by lowercase character 'e', followed by a plus sign '+' or minus + * sign '-' according to whether n-1 is positive or negative, followed by the + * decimal representation of the integer abs(n-1) (with no leading zeros) + * + * @path ch09/9.8/9.8.1/S9.8.1_A9_T2.js + * @description Various float numbers with many zeros convert to String by explicit transformation + */ + +// CHECK#1 +if (String(0.0000001) !== "1e-7") { + $ERROR('#1: String(0.0000001) === "1e-7". Actual: ' + (String(0.0000001))); +} + +// CHECK#2 +if (String(0.000000000100000000000) !== "1e-10") { + $ERROR('#2: String(0.000000000100000000000) === "1e-10". Actual: ' + (String(0.000000000100000000000))); +} + +// CHECK#3 +if (String(1e-7) !== "1e-7") { + $ERROR('#3: String(1e-7) === "1e-7". Actual: ' + (String(1e-7))); +} + +// CHECK#4 +if (String(1.0e-10) !== "1e-10") { + $ERROR('#4: String(1.0e-10) === "1e-10". Actual: ' + (String(1.0e-10))); +} + +// CHECK#5 +if (String(1E-7) !== "1e-7") { + $ERROR('#5: String(1E-7) === "1e-7". Actual: ' + (String(1E-7))); +} + +// CHECK#6 +if (String(1.0E-10) !== "1e-10") { + $ERROR('#6: String(1.0E-10) === "1e-10". Actual: ' + (String(1.0E-10))); +} + +// CHECK#7 +if (String(-0.0000001) !== "-1e-7") { + $ERROR('#7: String(-0.0000001) === "1e-7". Actual: ' + (String(-0.0000001))); +} + +// CHECK#8 +if (String(-0.000000000100000000000) !== "-1e-10") { + $ERROR('#8: String(-0.000000000100000000000) === "1e-10". Actual: ' + (String(-0.000000000100000000000))); +} + +// CHECK#9 +if (String(-1e-7) !== "-1e-7") { + $ERROR('#9: String(-1e-7) === "-1e-7". Actual: ' + (String(-1e-7))); +} + +// CHECK#10 +if (String(-1.0e-10) !== "-1e-10") { + $ERROR('#10: String(-1.0e-10) === "-1e-10". Actual: ' + (String(-1.0e-10))); +} + +// CHECK#11 +if (String(-1E-7) !== "-1e-7") { + $ERROR('#11: String(-1E-7) === "-1e-7". Actual: ' + (String(-1E-7))); +} + +// CHECK#12 +if (String(-1.0E-10) !== "-1e-10") { + $ERROR('#12: String(-1.0E-10) === "-1e-10". Actual: ' + (String(-1.0E-10))); +} + diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/browser.js b/js/src/tests/test262/ch09/9.8/9.8.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/browser.js diff --git a/js/src/tests/test262/ch09/9.8/9.8.1/shell.js b/js/src/tests/test262/ch09/9.8/9.8.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/9.8.1/shell.js diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A1_T1.js b/js/src/tests/test262/ch09/9.8/S9.8_A1_T1.js new file mode 100644 index 000000000..efce3a546 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A1_T1.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. + +/** + * Result of ToString conversion from undefined value is "undefined" + * + * @path ch09/9.8/S9.8_A1_T1.js + * @description Undefined values is undefined, void 0 and eval("var x"). Use explicit transformation + */ + +// CHECK#1 +if (String(undefined) !== "undefined") { + $ERROR('#1: String(undefined) === "undefined". Actual: ' + (String(undefined))); +} + +// CHECK#2 +if (String(void 0) !== "undefined") { + $ERROR('#2: String(void 0) === "undefined". Actual: ' + (String(void 0))); +} + +// CHECK#3 +if (String(eval("var x")) !== "undefined") { + $ERROR('#3: String(eval("var x")) === "undefined" . Actual: ' + (String(eval("var x")))); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A1_T2.js b/js/src/tests/test262/ch09/9.8/S9.8_A1_T2.js new file mode 100644 index 000000000..dd26c11b4 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A1_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. + +/** + * Result of ToString conversion from undefined value is "undefined" + * + * @path ch09/9.8/S9.8_A1_T2.js + * @description Undefined values is undefined, void 0 and eval("var x"). Use implicit transformation + */ + +// CHECK#1 +if (undefined + "" !== "undefined") { + $ERROR('#1: undefined + "" === "undefined". Actual: ' + (undefined + "")); +} + +// CHECK#2 +if (void 0 + "" !== "undefined") { + $ERROR('#2: void 0 + "" === "undefined". Actual: ' + (void 0 + "")); +} + +// CHECK#3 +if (eval("var x") + "" !== "undefined") { + $ERROR('#3: eval("var x") + "" === "undefined". Actual: ' + (eval("var x") + "")); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A2_T1.js b/js/src/tests/test262/ch09/9.8/S9.8_A2_T1.js new file mode 100644 index 000000000..0a1b982b7 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A2_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. + +/** + * Result of ToString conversion from null value is "null" + * + * @path ch09/9.8/S9.8_A2_T1.js + * @description null convert to String by explicit transformation + */ + +// CHECK#1 +if (String(null) !== "null") { + $ERROR('#1: String(null) === "null". Actual: ' + (String(null))); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A2_T2.js b/js/src/tests/test262/ch09/9.8/S9.8_A2_T2.js new file mode 100644 index 000000000..3b760909b --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_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. + +/** + * Result of ToString conversion from null value is "null" + * + * @path ch09/9.8/S9.8_A2_T2.js + * @description null convert to String by implicit transformation + */ + +// CHECK#1 +if (null + "" !== "null") { + $ERROR('#1: null + "" === "null". Actual: ' + (null + "")); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A3_T1.js b/js/src/tests/test262/ch09/9.8/S9.8_A3_T1.js new file mode 100644 index 000000000..cc267edc8 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A3_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of ToString conversion from boolean value is "true" if + * the argument is "true", else is "false" + * + * @path ch09/9.8/S9.8_A3_T1.js + * @description True and false convert to String by explicit transformation + */ + +// CHECK#1 +if (String(false) !== "false") { + $ERROR('#1: String(false) === "false". Actual: ' + (String(false))); +} + +// CHECK#2 +if (String(true) !== "true") { + $ERROR('#2: String(true) === "true". Actual: ' + (String(true))); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A3_T2.js b/js/src/tests/test262/ch09/9.8/S9.8_A3_T2.js new file mode 100644 index 000000000..788bcb58d --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A3_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of ToString conversion from boolean value is "true" if + * the argument is "true", else is "false" + * + * @path ch09/9.8/S9.8_A3_T2.js + * @description True and false convert to String by implicit transformation + */ + +// CHECK#1 +if (false + "" !== "false") { + $ERROR('#1: false + "" === "false". Actual: ' + (false + "")); +} + +// CHECK#2 +if (true + "" !== "true") { + $ERROR('#2: true + "" === "true". Actual: ' + (true + "")); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A4_T1.js b/js/src/tests/test262/ch09/9.8/S9.8_A4_T1.js new file mode 100644 index 000000000..064458461 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of String conversion from string value is the input argument (no conversion) + * + * @path ch09/9.8/S9.8_A4_T1.js + * @description Some strings convert to String with explicit transformation + */ + +// CHECK#1 +var x1 = "abc"; +if (String(x1) !== x1) { + $ERROR('#1: String("abc") === "abc". Actual: ' + (String("abc"))); +} + +// CHECK#2 +var x2 = "abc"; +if (typeof String(x2) !== typeof x2) { + $ERROR('#2: typeof String("abc") === "string". Actual: ' + (typeof String("abc"))); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A4_T2.js b/js/src/tests/test262/ch09/9.8/S9.8_A4_T2.js new file mode 100644 index 000000000..fdde4c38e --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of String conversion from string value is the input argument (no conversion) + * + * @path ch09/9.8/S9.8_A4_T2.js + * @description Some strings convert to String by implicit transformation + */ + +// CHECK#1 +var x1 = "abc"; +if (x1 + "" !== x1) { + $ERROR('#1: "abc" + "" === "abc". Actual: ' + ("abc" + "")); +} + +// CHECK#2 +var x2 = "abc"; +if (typeof x2 + "" !== typeof x2) { + $ERROR('#2: typeof "abc" + "" === "string". Actual: ' + (typeof "abc" + "")); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A5_T1.js b/js/src/tests/test262/ch09/9.8/S9.8_A5_T1.js new file mode 100644 index 000000000..55d88c102 --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A5_T1.js @@ -0,0 +1,93 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of String conversion from Object value is conversion + * from primitive value + * + * @path ch09/9.8/S9.8_A5_T1.js + * @description Some objects convert to String by explicit transformation + */ + +// CHECK#1 +if (String(new Number()) !== "0") { + $ERROR('#1: String(new Number()) === "0". Actual: ' + (String(new Number()))); +} + +// CHECK#2 +if (String(new Number(0)) !== "0") { + $ERROR('#2: String(new Number(0)) === "0". Actual: ' + (String(new Number(0)))); +} + +// CHECK#3 +if (String(new Number(Number.NaN)) !== "NaN") { + $ERROR('#3: String(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (String(new Number(Number.NaN)))); +} + +// CHECK#4 +if (String(new Number(null)) !== "0") { + $ERROR('#4: String(new Number(null)) === "0". Actual: ' + (String(new Number(null)))); +} + +// CHECK#5 +if (String(new Number(void 0)) !== "NaN") { + $ERROR('#5: String(new Number(void 0)) === Not-a-Number. Actual: ' + (String(new Number(void 0)))); +} + +// CHECK#6 +if (String(new Number(true)) !== "1") { + $ERROR('#6: String(new Number(true)) === "1". Actual: ' + (String(new Number(true)))); +} + +// CHECK#7 +if (String(new Number(false)) !== "0") { + $ERROR('#7: String(new Number(false)) === "0". Actual: ' + (String(new Number(false)))); +} + +// CHECK#8 +if (String(new Boolean(true)) !== "true") { + $ERROR('#8: String(new Boolean(true)) === "true". Actual: ' + (String(new Boolean(true)))); +} + +// CHECK#9 +if (String(new Boolean(false)) !== "false") { + $ERROR('#9: Number(new Boolean(false)) === "false". Actual: ' + (Number(new Boolean(false)))); +} + +// CHECK#10 +if (String(new Array(2,4,8,16,32)) !== "2,4,8,16,32") { + $ERROR('#10: String(new Array(2,4,8,16,32)) === "2,4,8,16,32". Actual: ' + (String(new Array(2,4,8,16,32)))); +} + +// CHECK#11 +var myobj1 = { + toNumber : function(){return 12345;}, + toString : function(){return 67890;}, + valueOf : function(){return "[object MyObj]";} + }; + +if (String(myobj1) !== "67890"){ + $ERROR("#11: String(myobj) calls ToPrimitive with hint String"); +} + +// CHECK#12 +var myobj2 = { + toNumber : function(){return 12345;}, + toString : function(){return {}}, + valueOf : function(){return "[object MyObj]";} + }; + +if (String(myobj2) !== "[object MyObj]"){ + $ERROR("#12: String(myobj) calls ToPrimitive with hint String"); +} + +// CHECK#13 +var myobj3 = { + toNumber : function(){return 12345;}, + valueOf : function(){return "[object MyObj]";} + }; + +if (String(myobj3) !== "[object Object]"){ + $ERROR("#13: String(myobj) calls ToPrimitive with hint String"); +} + diff --git a/js/src/tests/test262/ch09/9.8/S9.8_A5_T2.js b/js/src/tests/test262/ch09/9.8/S9.8_A5_T2.js new file mode 100644 index 000000000..7911adaee --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/S9.8_A5_T2.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of String conversion from Object value is conversion + * from primitive value + * + * @path ch09/9.8/S9.8_A5_T2.js + * @description Some objects convert to String by implicit transformation + */ + +// CHECK#1 +if (new Number() + "" !== "0") { + $ERROR('#1: new Number() + "" === "0". Actual: ' + (new Number() + "")); +} + +// CHECK#2 +if (new Number(0) + "" !== "0") { + $ERROR('#2: new Number(0) + "" === "0". Actual: ' + (new Number(0) + "")); +} + +// CHECK#3 +if (new Number(Number.NaN) + "" !== "NaN") { + $ERROR('#3: new Number(Number.NaN) + "" === "NaN". Actual: ' + (new Number(Number.NaN) + "")); +} + +// CHECK#4 +if (new Number(null) + "" !== "0") { + $ERROR('#4: new Number(null) + "" === "0". Actual: ' + (new Number(null) + "")); +} + +// CHECK#5 +if (new Number(void 0) + "" !== "NaN") { + $ERROR('#5: new Number(void 0) + "" === "NaN. Actual: ' + (new Number(void 0) + "")); +} + +// CHECK#6 +if (new Number(true) + "" !== "1") { + $ERROR('#6: new Number(true) + "" === "1". Actual: ' + (new Number(true) + "")); +} + +// CHECK#7 +if (new Number(false) + "" !== "0") { + $ERROR('#7: new Number(false) + "" === "0". Actual: ' + (new Number(false) + "")); +} + +// CHECK#8 +if (new Boolean(true) + "" !== "true") { + $ERROR('#8: new Boolean(true) + "" === "true". Actual: ' + (new Boolean(true) + "")); +} + +// CHECK#9 +if (new Boolean(false) + "" !== "false") { + $ERROR('#9: Number(new Boolean(false)) === "false". Actual: ' + (Number(new Boolean(false)))); +} + +// CHECK#10 +if (new Array(2,4,8,16,32) + "" !== "2,4,8,16,32") { + $ERROR('#10: new Array(2,4,8,16,32) + "" === "2,4,8,16,32". Actual: ' + (new Array(2,4,8,16,32) + "")); +} + +// CHECK#11 +var myobj1 = { + toNumber : function(){return 12345;}, + toString : function(){return 67890;}, + valueOf : function(){return "[object MyObj]";} + }; + +if (myobj1 + "" !== "[object MyObj]"){ + $ERROR('#11: myobj1 + "" calls ToPrimitive with hint Number. Exptected: "[object MyObj]". Actual: ' + (myobj1 + "")); +} + +// CHECK#12 +var myobj2 = { + toNumber : function(){return 12345;}, + toString : function(){return 67890}, + valueOf : function(){return {}} + }; + +if (myobj2 + "" !== "67890"){ + $ERROR('#12: myobj2 + "" calls ToPrimitive with hint Number. Exptected: "67890". Actual: ' + (myobj2 + "")); +} + +// CHECK#13 +var myobj3 = { + toNumber : function(){return 12345;} + }; + +if (myobj3 + "" !== "[object Object]"){ + $ERROR('#13: myobj3 + "" calls ToPrimitive with hint Number. Exptected: "[object Object]". Actual: ' + (myobj3 + "")); +} + diff --git a/js/src/tests/test262/ch09/9.8/browser.js b/js/src/tests/test262/ch09/9.8/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/browser.js diff --git a/js/src/tests/test262/ch09/9.8/shell.js b/js/src/tests/test262/ch09/9.8/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.8/shell.js diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A1.js b/js/src/tests/test262/ch09/9.9/S9.9_A1.js new file mode 100644 index 000000000..a1d36aabd --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A1.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. + +/** + * ToObject conversion from undefined value must throw TypeError + * + * @path ch09/9.9/S9.9_A1.js + * @description Trying to convert undefined to Object + * @noStrict + */ + +// CHECK#1 +try{ + undefined['foo']; + $ERROR('#1.1: undefined[\'foo\'] must throw TypeError. Actual: ' + (undefined['foo'])); +} +catch(e){ + if((e instanceof TypeError) !== true){ + $ERROR('#1.2: undefined[\'foo\'] must throw TypeError. Actual: ' + (e)); + } +} + +// CHECK#2 +try{ + with(undefined) x = 2; + $ERROR('#2.1: with(undefined) x = 2 must throw TypeError. Actual: x === ' + (x)); +} +catch(e){ + if((e instanceof TypeError) !== true){ + $ERROR('#2.2: with(undefined) x = 2 must throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A2.js b/js/src/tests/test262/ch09/9.9/S9.9_A2.js new file mode 100644 index 000000000..42e1980e7 --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A2.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. + +/** + * ToObject conversion from null value must throw TypeError + * + * @path ch09/9.9/S9.9_A2.js + * @description Trying to convert null to Object + * @noStrict + */ + +// CHECK#1 +try{ + null['foo']; + $ERROR('#1.1: null[\'foo\'] throw TypeError. Actual: ' + (null['foo'])); +} +catch(e){ + if((e instanceof TypeError) !== true){ + $ERROR('#1.2: null[\'foo\'] must throw TypeError. Actual: ' + (e)); + } +} + +// CHECK#2 +try{ + with(null) x = 2; + $ERROR('#2.1: with(null) x = 2 must throw TypeError. Actual: x === . Actual: ' + (x)); +} +catch(e){ + if((e instanceof TypeError) !== true){ + $ERROR('#2.2: with(null) x = 2 must throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A3.js b/js/src/tests/test262/ch09/9.9/S9.9_A3.js new file mode 100644 index 000000000..f91cd8e82 --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ToObject conversion from Boolean: create a new Boolean object + * whose [[value]] property is set to the value of the boolean + * + * @path ch09/9.9/S9.9_A3.js + * @description Trying to convert from Boolean to Object + */ + +// CHECK#1 +if (Object(true).valueOf() !== true){ + $ERROR('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf())); +} + +// CHECK#2 +if (typeof Object(true) !== "object"){ + $ERROR('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true))); +} + +// CHECK#3 +if (Object(true).constructor.prototype !== Boolean.prototype){ + $ERROR('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype)); +} + +// CHECK#4 +if (Object(false).valueOf() !== false){ + $ERROR('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf())); +} + +// CHECK#5 +if (typeof Object(false) !== "object"){ + $ERROR('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false))); +} + +// CHECK#6 +if (Object(false).constructor.prototype !== Boolean.prototype){ + $ERROR('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype)); +} + diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A4.js b/js/src/tests/test262/ch09/9.9/S9.9_A4.js new file mode 100644 index 000000000..2f08bf52c --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A4.js @@ -0,0 +1,178 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ToObject conversion from Number: create a new Number object + * whose [[value]] property is set to the value of the number + * + * @path ch09/9.9/S9.9_A4.js + * @description Converting from various numbers to Object + */ + +// CHECK#1 +if (Object(0).valueOf() !== 0){ + $ERROR('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf())); +} + +// CHECK#2 +if (typeof Object(0) !== "object"){ + $ERROR('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0))); +} + +// CHECK#3 +if (Object(0).constructor.prototype !== Number.prototype){ + $ERROR('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype)); +} + +// CHECK#4 +if (Object(-0).valueOf() !== -0){ + $ERROR('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf())); +} else if (1/Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: Object(-0).valueOf() === -0. Actual: +0'); +} + +// CHECK#5 +if (typeof Object(-0) !== "object"){ + $ERROR('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0))); +} + +// CHECK#6 +if (Object(-0).constructor.prototype !== Number.prototype){ + $ERROR('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype)); +} + +// CHECK#7 +if (Object(1).valueOf() !== 1){ + $ERROR('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf())); +} + +// CHECK#8 +if (typeof Object(1) !== "object"){ + $ERROR('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1))); +} + +// CHECK#9 +if (Object(1).constructor.prototype !== Number.prototype){ + $ERROR('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype)); +} + +// CHECK#10 +if (Object(-1).valueOf() !== -1){ + $ERROR('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf())); +} + +// CHECK#11 +if (typeof Object(-1) !== "object"){ + $ERROR('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1))); +} + +// CHECK#12 +if (Object(-1).constructor.prototype !== Number.prototype){ + $ERROR('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype)); +} + +// CHECK#13 +if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE){ + $ERROR('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf())); +} + +// CHECK#14 +if (typeof Object(Number.MIN_VALUE) !== "object"){ + $ERROR('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE))); +} + +// CHECK#15 +if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype){ + $ERROR('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype)); +} + +// CHECK#16 +if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE){ + $ERROR('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf())); +} + +// CHECK#17 +if (typeof Object(Number.MAX_VALUE) !== "object"){ + $ERROR('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE))); +} + +// CHECK#18 +if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype){ + $ERROR('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype)); +} + +// CHECK#19 +if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY){ + $ERROR('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf())); +} + +// CHECK#20 +if (typeof Object(Number.POSITIVE_INFINITY) !== "object"){ + $ERROR('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY))); +} + +// CHECK#21 +if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype){ + $ERROR('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype)); +} + +// CHECK#22 +if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY){ + $ERROR('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf())); +} + +// CHECK#23 +if (typeof Object(Number.NEGATIVE_INFINITY) !== "object"){ + $ERROR('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY))); +} + +// CHECK#24 +if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype){ + $ERROR('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype)); +} + +// CHECK#25 +if (isNaN(Object(Number.NaN).valueOf()) !== true){ + $ERROR('#25: Object(Number.NaN).valueOf() === Not-a-Number. Actual: ' + (Object(Number.NaN).valueOf())); +} + +// CHECK#26 +if (typeof Object(Number.NaN) !== "object"){ + $ERROR('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN))); +} + +// CHECK#27 +if (Object(Number.NaN).constructor.prototype !== Number.prototype){ + $ERROR('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype)); +} + +// CHECK#28 +if (Object(1.2345).valueOf() !== 1.2345){ + $ERROR('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf())); +} + +// CHECK#29 +if (typeof Object(1.2345) !== "object"){ + $ERROR('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345))); +} + +// CHECK#30 +if (Object(1.2345).constructor.prototype !== Number.prototype){ + $ERROR('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype)); +} + +// CHECK#31 +if (Object(-1.2345).valueOf() !== -1.2345){ + $ERROR('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf())); +} + +// CHECK#32 +if (typeof Object(-1.2345) !== "object"){ + $ERROR('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345))); +} + +// CHECK#33 +if (Object(-1.2345).constructor.prototype !== Number.prototype){ + $ERROR('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype)); +} + diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A5.js b/js/src/tests/test262/ch09/9.9/S9.9_A5.js new file mode 100644 index 000000000..2f59c1182 --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A5.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ToObject conversion from String: create a new String object + * whose [[value]] property is set to the value of the string + * + * @path ch09/9.9/S9.9_A5.js + * @description Converting from various strings to Object + */ + +// CHECK#1 +if (Object("some string").valueOf() !== "some string"){ + $ERROR('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf())); +} + +// CHECK#2 +if (typeof Object("some string") !== "object"){ + $ERROR('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string"))); +} + +// CHECK#3 +if (Object("some string").constructor.prototype !== String.prototype){ + $ERROR('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype)); +} + +// CHECK#4 +if (Object("").valueOf() !== ""){ + $ERROR('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf())); +} + +// CHECK#5 +if (typeof Object("") !== "object"){ + $ERROR('#5: typeof Object("") === "object". Actual: ' + (typeof Object(""))); +} + +// CHECK#6 +if (Object("").constructor.prototype !== String.prototype){ + $ERROR('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype)); +} + +// CHECK#7 +if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f"){ + $ERROR('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf())); +} + +// CHECK#8 +if (typeof Object("\r\t\b\n\v\f") !== "object"){ + $ERROR('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f"))); +} + +// CHECK#9 +if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype){ + $ERROR('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype)); +} + +// CHECK#10 +if (Object(String(10)).valueOf() !== "10"){ + $ERROR('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf())); +} + +// CHECK#11 +if (typeof Object(String(10)) !== "object"){ + $ERROR('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10)))); +} + +// CHECK#12 +if (Object(String(10)).constructor.prototype !== String.prototype){ + $ERROR('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype)); +} + diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A6.js b/js/src/tests/test262/ch09/9.9/S9.9_A6.js new file mode 100644 index 000000000..a25679016 --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/S9.9_A6.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ToObject conversion from Object: The result is the input + * argument (no conversion) + * + * @path ch09/9.9/S9.9_A6.js + * @description Converting from Objects to Object + */ + +function MyObject( val ) { + this.value = val; + this.valueOf = function (){ return this.value; } +} + +var x = new MyObject(1); +var y = Object(x); + +// CHECK#1 +if (y.valueOf() !== x.valueOf()){ + $ERROR('#1: Object(obj).valueOf() === obj.valueOf(). Actual: ' + (Object(obj).valueOf())); +} + +// CHECK#2 +if (typeof y !== typeof x){ + $ERROR('#2: typeof Object(obj) === typeof obj. Actual: ' + (typeof Object(obj))); +} + +// CHECK#3 +if (y.constructor.prototype !== x.constructor.prototype){ + $ERROR('#3: Object(obj).constructor.prototype === obj.constructor.prototype. Actual: ' + (Object(obj).constructor.prototype)); +} + + +// CHECK#4 +if (y !== x){ + $ERROR('#4: Object(obj) === obj'); +} + diff --git a/js/src/tests/test262/ch09/9.9/browser.js b/js/src/tests/test262/ch09/9.9/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/browser.js diff --git a/js/src/tests/test262/ch09/9.9/shell.js b/js/src/tests/test262/ch09/9.9/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/9.9/shell.js diff --git a/js/src/tests/test262/ch09/browser.js b/js/src/tests/test262/ch09/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/browser.js diff --git a/js/src/tests/test262/ch09/shell.js b/js/src/tests/test262/ch09/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch09/shell.js |