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/ch11/11.5 | |
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/ch11/11.5')
105 files changed, 3916 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A1.js new file mode 100644 index 000000000..1a9876c01 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A1.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. + +/** + * White Space and Line Terminator between MultiplicativeExpression and "*" or between "*" and UnaryExpression are allowed + * + * @path ch11/11.5/11.5.1/S11.5.1_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("1\u0009*\u00091") !== 1) { + $ERROR('#1: 1\\u0009*\\u00091 === 1'); +} + +//CHECK#2 +if (eval("1\u000B*\u000B1") !== 1) { + $ERROR('#2: 1\\u000B*\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("1\u000C*\u000C1") !== 1) { + $ERROR('#3: 1\\u000C*\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("1\u0020*\u00201") !== 1) { + $ERROR('#4: 1\\u0020*\\u00201 === 1'); +} + +//CHECK#5 +if (eval("1\u00A0*\u00A01") !== 1) { + $ERROR('#5: 1\\u00A0*\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("1\u000A*\u000A1") !== 1) { + $ERROR('#6: 1\\u000A*\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("1\u000D*\u000D1") !== 1) { + $ERROR('#7: 1\\u000D*\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("1\u2028*\u20281") !== 1) { + $ERROR('#8: 1\\u2028*\\u20281 === 1'); +} + +//CHECK#9 +if (eval("1\u2029*\u20291") !== 1) { + $ERROR('#9: 1\\u2029*\\u20291 === 1'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029*\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + $ERROR('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029*\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T1.js new file mode 100644 index 000000000..ed649ace5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x * y uses GetValue + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if (1 * 1 !== 1) { + $ERROR('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +var x = 1; +if (x * 1 !== 1) { + $ERROR('#2: var x = 1; x * 1 === 1. Actual: ' + (x * 1)); +} + +//CHECK#3 +var y = 1; +if (1 * y !== 1) { + $ERROR('#3: var y = 1; 1 * y === 1. Actual: ' + (1 * y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x * y !== 1) { + $ERROR('#4: var x = 1; var y = 1; x * y === 1. Actual: ' + (x * y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop * objecty.prop !== 1) { + $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop * objecty.prop === 1. Actual: ' + (objectx.prop * objecty.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T2.js new file mode 100644 index 000000000..e1f16da9d --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_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. + +/** + * Operator x * y uses GetValue + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x * 1; + $ERROR('#1.1: x * 1 throw ReferenceError. Actual: ' + (x * 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x * 1 throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T3.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T3.js new file mode 100644 index 000000000..22af7df20 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.1_T3.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. + +/** + * Operator x * y uses GetValue + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.1_T3.js + * @description If GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + 1 * y; + $ERROR('#1.1: 1 * y throw ReferenceError. Actual: ' + (1 * y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: 1 * y throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.2_T1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.2_T1.js new file mode 100644 index 000000000..932acabb2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.2_T1.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. + +/** + * Operator x * y uses [[Default Value]] + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +if ({valueOf: function() {return 1}} * 1 !== 1) { + $ERROR('#1: {valueOf: function() {return 1}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}} * 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} * 1 !== 1) { + $ERROR('#2: {valueOf: function() {return 1}, toString: function() {return 0}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} * 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} * 1 !== 1) { + $ERROR('#3: {valueOf: function() {return 1}, toString: function() {return {}}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} * 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 !== 1) { + $ERROR('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} * 1)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 not throw "error"'); + } else { + $ERROR('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 * {toString: function() {return 1}} !== 1) { + $ERROR('#5: 1 * {toString: function() {return 1}} === 1. Actual: ' + (1 * {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 * {valueOf: function() {return {}}, toString: function() {return 1}} !== 1) { + $ERROR('#6: 1 * {valueOf: function() {return {}}, toString: function() {return 1}} === 1. Actual: ' + (1 * {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}}; + $ERROR('#7.1: 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 * {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 * {valueOf: function() {return {}}, toString: function() {return {}}}; + $ERROR('#8.1: 1 * {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 * {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: 1 * {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.3_T1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.3_T1.js new file mode 100644 index 000000000..ba58724a9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.3_T1.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. + +/** + * ToNumber(first expression) is called first, and then ToNumber(second expression) + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.3_T1.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x * y; + $ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x * y throw "x". Actual: ' + (x * y)); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x * y throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T1.js new file mode 100644 index 000000000..504923aee --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.4_T1.js + * @description Checking with "=" + */ + +//CHECK#1 +var x = 0; +if ((x = 1) * x !== 1) { + $ERROR('#1: var x = 0; (x = 1) * x === 1. Actual: ' + ((x = 1) * x)); +} + +//CHECK#2 +var x = 0; +if (x * (x = 1) !== 0) { + $ERROR('#2: var x = 0; x * (x = 1) === 0. Actual: ' + (x * (x = 1))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T2.js new file mode 100644 index 000000000..262f2e7fc --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T2.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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.4_T2.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() * y(); + $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() * y() throw "x". Actual: ' + (x() * y())); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() * y() throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T3.js new file mode 100644 index 000000000..edcb5e006 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.1/S11.5.1_A2.4_T3.js + * @description Checking with undeclarated variables + */ + +//CHECK#1 +try { + x * (x = 1); + $ERROR('#1.1: x * (x = 1) throw ReferenceError. Actual: ' + (x * (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x * (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if ((y = 1) * y !== 1) { + $ERROR('#2: (y = 1) * y === 1. Actual: ' + ((y = 1) * y)); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.1.js new file mode 100644 index 000000000..de1e6dfdb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.1.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T1.1.js + * @description Type(x) and Type(y) vary between primitive boolean and Boolean object + */ + +//CHECK#1 +if (true * true !== 1) { + $ERROR('#1: true * true === 1. Actual: ' + (true * true)); +} + +//CHECK#2 +if (new Boolean(true) * true !== 1) { + $ERROR('#2: new Boolean(true) * true === 1. Actual: ' + (new Boolean(true) * true)); +} + +//CHECK#3 +if (true * new Boolean(true) !== 1) { + $ERROR('#3: true * new Boolean(true) === 1. Actual: ' + (true * new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) * new Boolean(true) !== 1) { + $ERROR('#4: new Boolean(true) * new Boolean(true) === 1. Actual: ' + (new Boolean(true) * new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.2.js new file mode 100644 index 000000000..1e0a49387 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.2.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T1.2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if (1 * 1 !== 1) { + $ERROR('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +if (new Number(1) * 1 !== 1) { + $ERROR('#2: new Number(1) * 1 === 1. Actual: ' + (new Number(1) * 1)); +} + +//CHECK#3 +if (1 * new Number(1) !== 1) { + $ERROR('#3: 1 * new Number(1) === 1. Actual: ' + (1 * new Number(1))); +} + +//CHECK#4 +if (new Number(1) * new Number(1) !== 1) { + $ERROR('#4: new Number(1) * new Number(1) === 1. Actual: ' + (new Number(1) * new Number(1))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.3.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.3.js new file mode 100644 index 000000000..e04ab70ea --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.3.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T1.3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if ("1" * "1" !== 1) { + $ERROR('#1: "1" * "1" === 1. Actual: ' + ("1" * "1")); +} + +//CHECK#2 +if (new String("1") * "1" !== 1) { + $ERROR('#2: new String("1") * "1" === 1. Actual: ' + (new String("1") * "1")); +} + +//CHECK#3 +if ("1" * new String("1") !== 1) { + $ERROR('#3: "1" * new String("1") === 1. Actual: ' + ("1" * new String("1"))); +} + +//CHECK#4 +if (new String("1") * new String("1") !== 1) { + $ERROR('#4: new String("1") * new String("1") === 1. Actual: ' + (new String("1") * new String("1"))); +} + +//CHECK#5 +if (isNaN("x" * "1") !== true) { + $ERROR('#5: "x" * "1" === Not-a-Number. Actual: ' + ("x" * "1")); +} + +//CHECK#6 +if (isNaN("1" * "x") !== true) { + $ERROR('#6: "1" * "x" === Not-a-Number. Actual: ' + ("1" * "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.4.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.4.js new file mode 100644 index 000000000..2dbe84f97 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.4.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T1.4.js + * @description Type(x) and Type(y) vary between Null and Undefined + */ + +//CHECK#1 +if (isNaN(null * undefined) !== true) { + $ERROR('#1: null * undefined === Not-a-Number. Actual: ' + (null * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * null) !== true) { + $ERROR('#2: undefined * null === Not-a-Number. Actual: ' + (undefined * null)); +} + +//CHECK#3 +if (isNaN(undefined * undefined) !== true) { + $ERROR('#3: undefined * undefined === Not-a-Number. Actual: ' + (undefined * undefined)); +} + +//CHECK#4 +if (null * null !== 0) { + $ERROR('#4: null * null === 0. Actual: ' + (null * null)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.5.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.5.js new file mode 100644 index 000000000..061e0ff27 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T1.5.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T1.5.js + * @description Type(x) and Type(y) vary between Object object and Function object + */ + +//CHECK#1 +if (isNaN({} * function(){return 1}) !== true) { + $ERROR('#1: {} * function(){return 1} === Not-a-Number. Actual: ' + ({} * function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} * {}) !== true) { + $ERROR('#2: function(){return 1} * {} === Not-a-Number. Actual: ' + (function(){return 1} * {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} * function(){return 1}) !== true) { + $ERROR('#3: function(){return 1} * function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} * function(){return 1})); +} + +//CHECK#4 +if (isNaN({} * {}) !== true) { + $ERROR('#4: {} * {} === Not-a-Number. Actual: ' + ({} * {})); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.1.js new file mode 100644 index 000000000..08a913b95 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.1.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.1.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Number (primitive and object) + */ + +//CHECK#1 +if (true * 1 !== 1) { + $ERROR('#1: true * 1 === 1. Actual: ' + (true * 1)); +} + +//CHECK#2 +if (1 * true !== 1) { + $ERROR('#2: 1 * true === 1. Actual: ' + (1 * true)); +} + +//CHECK#3 +if (new Boolean(true) * 1 !== 1) { + $ERROR('#3: new Boolean(true) * 1 === 1. Actual: ' + (new Boolean(true) * 1)); +} + +//CHECK#4 +if (1 * new Boolean(true) !== 1) { + $ERROR('#4: 1 * new Boolean(true) === 1. Actual: ' + (1 * new Boolean(true))); +} + +//CHECK#5 +if (true * new Number(1) !== 1) { + $ERROR('#5: true * new Number(1) === 1. Actual: ' + (true * new Number(1))); +} + +//CHECK#6 +if (new Number(1) * true !== 1) { + $ERROR('#6: new Number(1) * true === 1. Actual: ' + (new Number(1) * true)); +} + +//CHECK#7 +if (new Boolean(true) * new Number(1) !== 1) { + $ERROR('#7: new Boolean(true) * new Number(1) === 1. Actual: ' + (new Boolean(true) * new Number(1))); +} + +//CHECK#8 +if (new Number(1) * new Boolean(true) !== 1) { + $ERROR('#8: new Number(1) * new Boolean(true) === 1. Actual: ' + (new Number(1) * new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.2.js new file mode 100644 index 000000000..063c4da9e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.2.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.2.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and String (primitive and object) + */ + +//CHECK#1 +if ("1" * 1 !== 1) { + $ERROR('#1: "1" * 1 === 1. Actual: ' + ("1" * 1)); +} + +//CHECK#2 +if (1 * "1" !== 1) { + $ERROR('#2: 1 * "1" === 1. Actual: ' + (1 * "1")); +} + +//CHECK#3 +if (new String("1") * 1 !== 1) { + $ERROR('#3: new String("1") * 1 === 1. Actual: ' + (new String("1") * 1)); +} + +//CHECK#4 +if (1 * new String("1") !== 1) { + $ERROR('#4: 1 * new String("1") === 1. Actual: ' + (1 * new String("1"))); +} + +//CHECK#5 +if ("1" * new Number(1) !== 1) { + $ERROR('#5: "1" * new Number(1) === 1. Actual: ' + ("1" * new Number(1))); +} + +//CHECK#6 +if (new Number(1) * "1" !== 1) { + $ERROR('#6: new Number(1) * "1" === 1. Actual: ' + (new Number(1) * "1")); +} + +//CHECK#7 +if (new String("1") * new Number(1) !== 1) { + $ERROR('#7: new String("1") * new Number(1) === 1. Actual: ' + (new String("1") * new Number(1))); +} + +//CHECK#8 +if (new Number(1) * new String("1") !== 1) { + $ERROR('#8: new Number(1) * new String("1") === 1. Actual: ' + (new Number(1) * new String("1"))); +} + +//CHECK#9 +if (isNaN("x" * 1) !== true) { + $ERROR('#9: "x" * 1 === Not-a-Number. Actual: ' + ("x" * 1)); +} + +//CHECK#10 +if (isNaN(1 * "x") !== true) { + $ERROR('#10: 1 * "x" === Not-a-Number. Actual: ' + (1 * "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.3.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.3.js new file mode 100644 index 000000000..cfab7ba6b --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.3.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.3.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Null + */ + +//CHECK#1 +if (1 * null !== 0) { + $ERROR('#1: 1 * null === 0. Actual: ' + (1 * null)); +} + +//CHECK#2 +if (null * 1 !== 0) { + $ERROR('#2: null * 1 === 0. Actual: ' + (null * 1)); +} + +//CHECK#3 +if (new Number(1) * null !== 0) { + $ERROR('#3: new Number(1) * null === 0. Actual: ' + (new Number(1) * null)); +} + +//CHECK#4 +if (null * new Number(1) !== 0) { + $ERROR('#4: null * new Number(1) === 0. Actual: ' + (null * new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.4.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.4.js new file mode 100644 index 000000000..0216310cf --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.4.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.4.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(1 * undefined) !== true) { + $ERROR('#1: 1 * undefined === Not-a-Number. Actual: ' + (1 * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * 1) !== true) { + $ERROR('#2: undefined * 1 === Not-a-Number. Actual: ' + (undefined * 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) * undefined) !== true) { + $ERROR('#3: new Number(1) * undefined === Not-a-Number. Actual: ' + (new Number(1) * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new Number(1)) !== true) { + $ERROR('#4: undefined * new Number(1) === Not-a-Number. Actual: ' + (undefined * new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.5.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.5.js new file mode 100644 index 000000000..5d92d9827 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.5.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.5.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Boolean (primitive and object) + */ + +//CHECK#1 +if (true * "1" !== 1) { + $ERROR('#1: true * "1" === 1. Actual: ' + (true * "1")); +} + +//CHECK#2 +if ("1" * true !== 1) { + $ERROR('#2: "1" * true === 1. Actual: ' + ("1" * true)); +} + +//CHECK#3 +if (new Boolean(true) * "1" !== 1) { + $ERROR('#3: new Boolean(true) * "1" === 1. Actual: ' + (new Boolean(true) * "1")); +} + +//CHECK#4 +if ("1" * new Boolean(true) !== 1) { + $ERROR('#4: "1" * new Boolean(true) === 1. Actual: ' + ("1" * new Boolean(true))); +} + +//CHECK#5 +if (true * new String("1") !== 1) { + $ERROR('#5: true * new String("1") === 1. Actual: ' + (true * new String("1"))); +} + +//CHECK#6 +if (new String("1") * true !== 1) { + $ERROR('#6: new String("1") * true === 1. Actual: ' + (new String("1") * true)); +} + +//CHECK#7 +if (new Boolean(true) * new String("1") !== 1) { + $ERROR('#7: new Boolean(true) * new String("1") === 1. Actual: ' + (new Boolean(true) * new String("1"))); +} + +//CHECK#8 +if (new String("1") * new Boolean(true) !== 1) { + $ERROR('#8: new String("1") * new Boolean(true) === 1. Actual: ' + (new String("1") * new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.6.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.6.js new file mode 100644 index 000000000..429683ff2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.6.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.6.js + * @description Type(x) is different from Type(y) and both types vary between primitive String (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN("1" * undefined) !== true) { + $ERROR('#1: "1" * undefined === Not-a-Number. Actual: ' + ("1" * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * "1") !== true) { + $ERROR('#2: undefined * "1" === Not-a-Number. Actual: ' + (undefined * "1")); +} + +//CHECK#3 +if (isNaN(new String("1") * undefined) !== true) { + $ERROR('#3: new String("1") * undefined === Not-a-Number. Actual: ' + (new String("1") * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new String("1")) !== true) { + $ERROR('#4: undefined * new String("1") === Not-a-Number. Actual: ' + (undefined * new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.7.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.7.js new file mode 100644 index 000000000..786f23057 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.7.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.7.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Null + */ + +//CHECK#1 +if ("1" * null !== 0) { + $ERROR('#1: "1" * null === 0. Actual: ' + ("1" * null)); +} + +//CHECK#2 +if (null * "1" !== 0) { + $ERROR('#2: null * "1" === 0. Actual: ' + (null * "1")); +} + +//CHECK#3 +if (new String("1") * null !== 0) { + $ERROR('#3: new String("1") * null === 0. Actual: ' + (new String("1") * null)); +} + +//CHECK#4 +if (null * new String("1") !== 0) { + $ERROR('#4: null * new String("1") === 0. Actual: ' + (null * new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.8.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.8.js new file mode 100644 index 000000000..ef7ae0503 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.8.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.8.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(true * undefined) !== true) { + $ERROR('#1: true * undefined === Not-a-Number. Actual: ' + (true * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * true) !== true) { + $ERROR('#2: undefined * true === Not-a-Number. Actual: ' + (undefined * true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) * undefined) !== true) { + $ERROR('#3: new Boolean(true) * undefined === Not-a-Number. Actual: ' + (new Boolean(true) * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new Boolean(true)) !== true) { + $ERROR('#4: undefined * new Boolean(true) === Not-a-Number. Actual: ' + (undefined * new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.9.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.9.js new file mode 100644 index 000000000..377cb00f0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A3_T2.9.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. + +/** + * Operator x * y returns ToNumber(x) * ToNumber(y) + * + * @path ch11/11.5/11.5.1/S11.5.1_A3_T2.9.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Null + */ + +//CHECK#1 +if (true * null !== 0) { + $ERROR('#1: true * null === 0. Actual: ' + (true * null)); +} + +//CHECK#2 +if (null * true !== 0) { + $ERROR('#2: null * true === 0. Actual: ' + (null * true)); +} + +//CHECK#3 +if (new Boolean(true) * null !== 0) { + $ERROR('#3: new Boolean(true) * null === 0. Actual: ' + (new Boolean(true) * null)); +} + +//CHECK#4 +if (null * new Boolean(true) !== 0) { + $ERROR('#4: null * new Boolean(true) === 0. Actual: ' + (null * new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.1.js new file mode 100644 index 000000000..d3b5006ce --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.1.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 result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T1.1.js + * @description If left operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN * Number.NaN) !== true) { + $ERROR('#1: NaN * NaN === Not-a-Number. Actual: ' + (NaN * NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN * +0) !== true) { + $ERROR('#2: NaN * +0 === Not-a-Number. Actual: ' + (NaN * +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN * -0) !== true) { + $ERROR('#3: NaN * -0 === Not-a-Number. Actual: ' + (NaN * -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN * Number.POSITIVE_INFINITY) !== true) { + $ERROR('#4: NaN * Infinity === Not-a-Number. Actual: ' + (NaN * Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN * Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#5: NaN * -Infinity === Not-a-Number. Actual: ' + (NaN * -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN * Number.MAX_VALUE) !== true) { + $ERROR('#6: NaN * Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN * Number.MIN_VALUE) !== true) { + $ERROR('#7: NaN * Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN * 1) !== true) { + $ERROR('#8: NaN * 1 === Not-a-Number. Actual: ' + (NaN * 1)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.2.js new file mode 100644 index 000000000..2f1d7c1c0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T1.2.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 result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T1.2.js + * @description If right operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN * Number.NaN) !== true) { + $ERROR('#1: NaN * NaN === Not-a-Number. Actual: ' + (NaN * NaN)); +} + +//CHECK#2 +if (isNaN(+0 * Number.NaN) !== true) { + $ERROR('#2: +0 * NaN === Not-a-Number. Actual: ' + (+0 * NaN)); +} + +//CHECK#3 +if (isNaN(-0 * Number.NaN) !== true) { + $ERROR('#3: -0 * NaN === Not-a-Number. Actual: ' + (-0 * NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY * Number.NaN) !== true) { + $ERROR('#4: Infinity * NaN === Not-a-Number. Actual: ' + (Infinity * NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY * Number.NaN) !== true) { + $ERROR('#5: -Infinity * NaN === Not-a-Number. Actual: ' + ( -Infinity * NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE * Number.NaN) !== true) { + $ERROR('#6: Number.MAX_VALUE * NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE * NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE * Number.NaN) !== true) { + $ERROR('#7: Number.MIN_VALUE * NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE * NaN)); +} + +//CHECK#8 +if (isNaN(1 * Number.NaN) !== true) { + $ERROR('#8: 1 * NaN === Not-a-Number. Actual: ' + (1 * NaN)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T2.js new file mode 100644 index 000000000..f6bc87a6f --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T2.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T2.js + * @description The sign of the result is positive if both operands have the same sign, negative if the operands have different signs + */ + +//CHECK#1 +if (1 * 1 !== 1) { + $ERROR('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +if (1 * -1 !== -1) { + $ERROR('#2: 1 * -1 === -1. Actual: ' + (1 * -1)); +} + +//CHECK#3 +if (-1 * 1 !== -1) { + $ERROR('#3: -1 * 1 === -1. Actual: ' + (-1 * 1)); +} + +//CHECK#4 +if (-1 * -1 !== 1) { + $ERROR('#4: -1 * -1 === 1. Actual: ' + (-1 * -1)); +} + +//CHECK#5 +if (0 * 0 !== 0) { + $ERROR('#5.1: 0 * 0 === 0. Actual: ' + (0 * 0)); +} else { + if (1 / (0 * 0) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: 0 * 0 === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 * -0 !== -0) { + $ERROR('#6.1: 0 * -0 === 0. Actual: ' + (0 * -0)); +} else { + if (1 / (0 * -0) !== Number.NEGATIVE_INFINITY) { + $ERROR('#6.2: 0 * -0 === - 0. Actual: +0'); + } +} + +//CHECK#7 +if (-0 * 0 !== -0) { + $ERROR('#7.1: -0 * 0 === 0. Actual: ' + (-0 * 0)); +} else { + if (1 / (-0 * 0) !== Number.NEGATIVE_INFINITY) { + $ERROR('#7.2: -0 * 0 === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 * -0 !== 0) { + $ERROR('#8.1: -0 * -0 === 0. Actual: ' + (-0 * -0)); +} else { + if (1 / (-0 * -0) !== Number.POSITIVE_INFINITY) { + $ERROR('#8.2: 0 * -0 === - 0. Actual: +0'); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T3.js new file mode 100644 index 000000000..6bc264f90 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T3.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T3.js + * @description Multiplication of an infinity by a zero results in NaN + */ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY * 0) !== true) { + $ERROR('#1: Infinity * 0 === Not-a-Number. Actual: ' + (Infinity * 0)); +} + +//CHECK#2 +if (isNaN(-0 * Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#2: -0 * -Infinity === Not-a-Number. Actual: ' + (-0 * -Infinity)); +} + +//CHECK#3 +if (isNaN(Number.POSITIVE_INFINITY * -0) !== true) { + $ERROR('#3: Infinity * -0 === Not-a-Number. Actual: ' + (Infinity * -0)); +} + +//CHECK#4 +if (isNaN(0 * Number.POSITIVE_INFINITY) !== true) { + $ERROR('#4: 0 * Infinity === Not-a-Number. Actual: ' + (0 * Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY * -0) !== true) { + $ERROR('#5: Infinity * -0 === Not-a-Number. Actual: ' + (Infinity * -0)); +} + +//CHECK#6 +if (isNaN(0 * Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#6: 0 * -Infinity === Not-a-Number. Actual: ' + (0 * -Infinity)); +} + +//CHECK#7 +if (isNaN(Number.POSITIVE_INFINITY * 0) !== true) { + $ERROR('#7: Infinity * 0 === Not-a-Number. Actual: ' + (Infinity * 0)); +} + +//CHECK#8 +if (isNaN(-0 * Number.POSITIVE_INFINITY) !== true) { + $ERROR('#8: -0 * Infinity === Not-a-Number. Actual: ' + (-0 * Infinity)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T4.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T4.js new file mode 100644 index 000000000..5603e976e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T4.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 result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T4.js + * @description Multiplication of an infinity by an infinity results in an infinity of appropriate sign + */ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY) { + $ERROR('#1: -Infinity * -Infinity === Infinity. Actual: ' + (-Infinity * -Infinity)); +} + +//CHECK#2 +if (Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY) { + $ERROR('#2: Infinity * Infinity === Infinity. Actual: ' + (Infinity * Infinity)); +} + +//CHECK#3 +if (Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + $ERROR('#3: -Infinity * Infinity === -Infinity. Actual: ' + (-Infinity * Infinity)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + $ERROR('#4: Infinity * -Infinity === -Infinity. Actual: ' + (Infinity * -Infinity)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T5.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T5.js new file mode 100644 index 000000000..e52526d3a --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T5.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 result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T5.js + * @description Multiplication of an infinity by a finite non-zero value results in a signed infinity + */ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY * -1 !== Number.POSITIVE_INFINITY) { + $ERROR('#1: -Infinity * -1 === Infinity. Actual: ' + (-Infinity * -1)); +} + +//CHECK#2 +if (-1 * Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY) { + $ERROR('#2: -1 * -Infinity === Infinity. Actual: ' + (-1 * -Infinity)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY * -1 !== Number.NEGATIVE_INFINITY) { + $ERROR('#3: Infinity * -1 === -Infinity. Actual: ' + (Infinity * -1)); +} + +//CHECK#4 +if (-1 * Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + $ERROR('#4: -1 * Infinity === -Infinity. Actual: ' + (-1 * Infinity)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.POSITIVE_INFINITY) { + $ERROR('#5: Infinity * Number.MAX_VALUE === Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); +} + +//CHECK#6 +if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.MAX_VALUE * Number.POSITIVE_INFINITY) { + $ERROR('#6: Infinity * Number.MAX_VALUE === Number.MAX_VALUE * Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); +} + +//CHECK#7 +if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.NEGATIVE_INFINITY) { + $ERROR('#7: -Infinity * Number.MIN_VALUE === -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); +} + +//CHECK#8 +if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.MIN_VALUE * Number.NEGATIVE_INFINITY) { + $ERROR('#8: -Infinity * Number.MIN_VALUE === Number.MIN_VALUE * -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T6.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T6.js new file mode 100644 index 000000000..7432a3146 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T6.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 result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T6.js + * @description If the magnitude is too large to represent, the result is then an infinity of appropriate sign + */ + +//CHECK#1 +if (Number.MAX_VALUE * 1.1 !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number.MAX_VALUE * 1.1 === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE * 1.1)); +} + +//CHECK#2 +if (-1.1 * Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + $ERROR('#2: -1.1 * Number.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-1.1 * Number.MAX_VALUE)); +} + +//CHECK#3 +if (Number.MAX_VALUE * 1 !== Number.MAX_VALUE) { + $ERROR('#3: Number.MAX_VALUE * 1 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE * 1)); +} + +//CHECK#4 +if (-1 * Number.MAX_VALUE !== -Number.MAX_VALUE) { + $ERROR('#4: -1 * Number.MAX_VALUE === -Number.MAX_VALUE. Actual: ' + (-1 * Number.MAX_VALUE)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T7.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T7.js new file mode 100644 index 000000000..5a8d203e5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T7.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T7.js + * @description If the magnitude is too small to represent, the result is then a zero of appropriate sign + */ + +//CHECK#1 +if (Number.MIN_VALUE * 0.1 !== 0) { + $ERROR('#1: Number.MIN_VALUE * 0.1 === 0. Actual: ' + (Number.MIN_VALUE * 0.1)); +} + +//CHECK#2 +if (-0.1 * Number.MIN_VALUE !== -0) { + $ERROR('#2.1: -0.1 * Number.MIN_VALUE === -0. Actual: ' + (-0.1 * Number.MIN_VALUE)); +} else { + if (1 / (-0.1 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#2.2: -0.1 * Number.MIN_VALUE === -0. Actual: +0'); + } +} + +//CHECK#3 +if (Number.MIN_VALUE * 0.5 !== 0) { + $ERROR('#3: Number.MIN_VALUE * 0.5 === 0. Actual: ' + (Number.MIN_VALUE * 0.5)); +} + +//CHECK#4 +if (-0.5 * Number.MIN_VALUE !== -0) { + $ERROR('#4.1: -0.5 * Number.MIN_VALUE === -0. Actual: ' + (-0.5 * Number.MIN_VALUE)); +} else { + if (1 / (-0.5 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: -0.5 * Number.MIN_VALUE === -0. Actual: +0'); + } +} + +//CHECK#5 +if (Number.MIN_VALUE * 0.51 !== Number.MIN_VALUE) { + $ERROR('#5: Number.MIN_VALUE * 0.51 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.51)); +} + +//CHECK#6 +if (-0.51 * Number.MIN_VALUE !== -Number.MIN_VALUE) { + $ERROR('#6: -0.51 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.51 * Number.MIN_VALUE)); +} + +//CHECK#7 +if (Number.MIN_VALUE * 0.9 !== Number.MIN_VALUE) { + $ERROR('#7: Number.MIN_VALUE * 0.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.9)); +} + +//CHECK#8 +if (-0.9 * Number.MIN_VALUE !== -Number.MIN_VALUE) { + $ERROR('#8: -0.9 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.9 * Number.MIN_VALUE)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T8.js b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T8.js new file mode 100644 index 000000000..0d777e06f --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/S11.5.1_A4_T8.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. + +/** + * The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetics + * + * @path ch11/11.5/11.5.1/S11.5.1_A4_T8.js + * @description Multiplication is not always associative (x * y * z is the same as (x * y) * z, not x * (y * z)) + */ + +//CHECK#1 +if (Number.MAX_VALUE * 1.1 * 0.9 !== (Number.MAX_VALUE * 1.1) * 0.9) { + $ERROR('#1: Number.MAX_VALUE * 1.1 * 0.9 === (Number.MAX_VALUE * 1.1) * 0.9. Actual: ' + (Number.MAX_VALUE * 1.1 * 0.9)); +} + +//CHECK#2 +if ((Number.MAX_VALUE * 1.1) * 0.9 === Number.MAX_VALUE * (1.1 * 0.9)) { + $ERROR('#2: (Number.MAX_VALUE * 1.1) * 0.9 !== Number.MAX_VALUE * (1.1 * 0.9)'); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/browser.js b/js/src/tests/test262/ch11/11.5/11.5.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/browser.js diff --git a/js/src/tests/test262/ch11/11.5/11.5.1/shell.js b/js/src/tests/test262/ch11/11.5/11.5.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.1/shell.js diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A1.js new file mode 100644 index 000000000..0b92880bd --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A1.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. + +/** + * White Space and Line Terminator between MultiplicativeExpression and "/" or between "/" and UnaryExpression are allowed + * + * @path ch11/11.5/11.5.2/S11.5.2_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("1\u0009/\u00091") !== 1) { + $ERROR('#1: 1\\u0009/\\u00091 === 1'); +} + +//CHECK#2 +if (eval("1\u000B/\u000B1") !== 1) { + $ERROR('#2: 1\\u000B/\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("1\u000C/\u000C1") !== 1) { + $ERROR('#3: 1\\u000C/\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("1\u0020/\u00201") !== 1) { + $ERROR('#4: 1\\u0020/\\u00201 === 1'); +} + +//CHECK#5 +if (eval("1\u00A0/\u00A01") !== 1) { + $ERROR('#5: 1\\u00A0/\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("1\u000A/\u000A1") !== 1) { + $ERROR('#6: 1\\u000A/\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("1\u000D/\u000D1") !== 1) { + $ERROR('#7: 1\\u000D/\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("1\u2028/\u20281") !== 1) { + $ERROR('#8: 1\\u2028/\\u20281 === 1'); +} + +//CHECK#9 +if (eval("1\u2029/\u20291") !== 1) { + $ERROR('#9: 1\\u2029/\\u20291 === 1'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029/\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + $ERROR('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029/\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T1.js new file mode 100644 index 000000000..c06d2991c --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x / y uses GetValue + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if (1 / 1 !== 1) { + $ERROR('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +var x = 1; +if (x / 1 !== 1) { + $ERROR('#2: var x = 1; x / 1 === 1. Actual: ' + (x / 1)); +} + +//CHECK#3 +var y = 1; +if (1 / y !== 1) { + $ERROR('#3: var y = 1; 1 / y === 1. Actual: ' + (1 / y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x / y !== 1) { + $ERROR('#4: var x = 1; var y = 1; x / y === 1. Actual: ' + (x / y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop / objecty.prop !== 1) { + $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop / objecty.prop === 1. Actual: ' + (objectx.prop / objecty.prop)); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T2.js new file mode 100644 index 000000000..68396ed54 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_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. + +/** + * Operator x / y uses GetValue + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x / 1; + $ERROR('#1.1: x / 1 throw ReferenceError. Actual: ' + (x / 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x / 1 throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T3.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T3.js new file mode 100644 index 000000000..d0da4868d --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.1_T3.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. + +/** + * Operator x / y uses GetValue + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.1_T3.js + * @description If GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + 1 / y; + $ERROR('#1.1: 1 / y throw ReferenceError. Actual: ' + (1 / y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: 1 / y throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.2_T1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.2_T1.js new file mode 100644 index 000000000..e0d8bc345 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.2_T1.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. + +/** + * Operator x / y uses [[Default Value]] + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +if ({valueOf: function() {return 1}} / 1 !== 1) { + $ERROR('#1: {valueOf: function() {return 1}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}} / 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} / 1 !== 1) { + $ERROR('#2: {valueOf: function() {return 1}, toString: function() {return 0}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} / 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} / 1 !== 1) { + $ERROR('#3: {valueOf: function() {return 1}, toString: function() {return {}}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} / 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 !== 1) { + $ERROR('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} / 1)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 not throw "error"'); + } else { + $ERROR('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 / {toString: function() {return 1}} !== 1) { + $ERROR('#5: 1 / {toString: function() {return 1}} === 1. Actual: ' + (1 / {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 / {valueOf: function() {return {}}, toString: function() {return 1}} !== 1) { + $ERROR('#6: 1 / {valueOf: function() {return {}}, toString: function() {return 1}} === 1. Actual: ' + (1 / {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}}; + $ERROR('#7.1: 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 / {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 / {valueOf: function() {return {}}, toString: function() {return {}}}; + $ERROR('#8.1: 1 / {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 / {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: 1 / {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.3_T1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.3_T1.js new file mode 100644 index 000000000..8c0b9888e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.3_T1.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. + +/** + * ToNumber(first expression) is called first, and then ToNumber(second expression) + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.3_T1.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x / y; + $ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x / y throw "x". Actual: ' + (x / y)); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x / y throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T1.js new file mode 100644 index 000000000..2d2d55efe --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.4_T1.js + * @description Checking with "=" + */ + +//CHECK#1 +var x = 0; +if ((x = 1) / x !== 1) { + $ERROR('#1: var x = 0; (x = 1) / x === 1. Actual: ' + ((x = 1) / x)); +} + +//CHECK#2 +var x = 0; +if (x / (x = 1) !== 0) { + $ERROR('#2: var x = 0; x / (x = 1) === 0. Actual: ' + (x / (x = 1))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T2.js new file mode 100644 index 000000000..44f0f2327 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T2.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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.4_T2.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() / y(); + $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() / y() throw "x". Actual: ' + (x() / y())); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() / y() throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T3.js new file mode 100644 index 000000000..13ffe9ff3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.2/S11.5.2_A2.4_T3.js + * @description Checking with undeclarated variables + */ + +//CHECK#1 +try { + x / (x = 1); + $ERROR('#1.1: x / (x = 1) throw ReferenceError. Actual: ' + (x / (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x / (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if ((y = 1) / y !== 1) { + $ERROR('#2: (y = 1) / y === 1. Actual: ' + ((y = 1) / y)); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.1.js new file mode 100644 index 000000000..5e53abaf2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.1.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T1.1.js + * @description Type(x) and Type(y) vary between primitive boolean and Boolean object + */ + +//CHECK#1 +if (true / true !== 1) { + $ERROR('#1: true / true === 1. Actual: ' + (true / true)); +} + +//CHECK#2 +if (new Boolean(true) / true !== 1) { + $ERROR('#2: new Boolean(true) / true === 1. Actual: ' + (new Boolean(true) / true)); +} + +//CHECK#3 +if (true / new Boolean(true) !== 1) { + $ERROR('#3: true / new Boolean(true) === 1. Actual: ' + (true / new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) / new Boolean(true) !== 1) { + $ERROR('#4: new Boolean(true) / new Boolean(true) === 1. Actual: ' + (new Boolean(true) / new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.2.js new file mode 100644 index 000000000..97bb6036d --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.2.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T1.2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if (1 / 1 !== 1) { + $ERROR('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +if (new Number(1) / 1 !== 1) { + $ERROR('#2: new Number(1) / 1 === 1. Actual: ' + (new Number(1) / 1)); +} + +//CHECK#3 +if (1 / new Number(1) !== 1) { + $ERROR('#3: 1 / new Number(1) === 1. Actual: ' + (1 / new Number(1))); +} + +//CHECK#4 +if (new Number(1) / new Number(1) !== 1) { + $ERROR('#4: new Number(1) / new Number(1) === 1. Actual: ' + (new Number(1) / new Number(1))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.3.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.3.js new file mode 100644 index 000000000..56d1b142c --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.3.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T1.3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if ("1" / "1" !== 1) { + $ERROR('#1: "1" / "1" === 1. Actual: ' + ("1" / "1")); +} + +//CHECK#2 +if (new String("1") / "1" !== 1) { + $ERROR('#2: new String("1") / "1" === 1. Actual: ' + (new String("1") / "1")); +} + +//CHECK#3 +if ("1" / new String("1") !== 1) { + $ERROR('#3: "1" / new String("1") === 1. Actual: ' + ("1" / new String("1"))); +} + +//CHECK#4 +if (new String("1") / new String("1") !== 1) { + $ERROR('#4: new String("1") / new String("1") === 1. Actual: ' + (new String("1") / new String("1"))); +} + +//CHECK#5 +if (isNaN("x" / "1") !== true) { + $ERROR('#5: "x" / "1" === Not-a-Number. Actual: ' + ("x" / "1")); +} + +//CHECK#6 +if (isNaN("1" / "x") !== true) { + $ERROR('#6: "1" / "x" === Not-a-Number. Actual: ' + ("1" / "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.4.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.4.js new file mode 100644 index 000000000..e9269fb45 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.4.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T1.4.js + * @description Type(x) and Type(y) vary between Null and Undefined + */ + +//CHECK#1 +if (isNaN(null / undefined) !== true) { + $ERROR('#1: null / undefined === Not-a-Number. Actual: ' + (null / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / null) !== true) { + $ERROR('#2: undefined / null === Not-a-Number. Actual: ' + (undefined / null)); +} + +//CHECK#3 +if (isNaN(undefined / undefined) !== true) { + $ERROR('#3: undefined / undefined === Not-a-Number. Actual: ' + (undefined / undefined)); +} + +//CHECK#4 +if (isNaN(null / null) !== true) { + $ERROR('#4: null / null === Not-a-Number. Actual: ' + (null / null)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.5.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.5.js new file mode 100644 index 000000000..ec57702be --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T1.5.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T1.5.js + * @description Type(x) and Type(y) vary between Object object and Function object + */ + +//CHECK#1 +if (isNaN({} / function(){return 1}) !== true) { + $ERROR('#1: {} / function(){return 1} === Not-a-Number. Actual: ' + ({} / function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} / {}) !== true) { + $ERROR('#2: function(){return 1} / {} === Not-a-Number. Actual: ' + (function(){return 1} / {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} / function(){return 1}) !== true) { + $ERROR('#3: function(){return 1} / function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} / function(){return 1})); +} + +//CHECK#4 +if (isNaN({} / {}) !== true) { + $ERROR('#4: {} / {} === Not-a-Number. Actual: ' + ({} / {})); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.1.js new file mode 100644 index 000000000..7cd3f7cf6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.1.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.1.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Boolean (primitive and object) + */ + +//CHECK#1 +if (true / 1 !== 1) { + $ERROR('#1: true / 1 === 1. Actual: ' + (true / 1)); +} + +//CHECK#2 +if (1 / true !== 1) { + $ERROR('#2: 1 / true === 1. Actual: ' + (1 / true)); +} + +//CHECK#3 +if (new Boolean(true) / 1 !== 1) { + $ERROR('#3: new Boolean(true) / 1 === 1. Actual: ' + (new Boolean(true) / 1)); +} + +//CHECK#4 +if (1 / new Boolean(true) !== 1) { + $ERROR('#4: 1 / new Boolean(true) === 1. Actual: ' + (1 / new Boolean(true))); +} + +//CHECK#5 +if (true / new Number(1) !== 1) { + $ERROR('#5: true / new Number(1) === 1. Actual: ' + (true / new Number(1))); +} + +//CHECK#6 +if (new Number(1) / true !== 1) { + $ERROR('#6: new Number(1) / true === 1. Actual: ' + (new Number(1) / true)); +} + +//CHECK#7 +if (new Boolean(true) / new Number(1) !== 1) { + $ERROR('#7: new Boolean(true) / new Number(1) === 1. Actual: ' + (new Boolean(true) / new Number(1))); +} + +//CHECK#8 +if (new Number(1) / new Boolean(true) !== 1) { + $ERROR('#8: new Number(1) / new Boolean(true) === 1. Actual: ' + (new Number(1) / new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.2.js new file mode 100644 index 000000000..8678544ad --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.2.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.2.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and String (primitive and object) + */ + +//CHECK#1 +if ("1" / 1 !== 1) { + $ERROR('#1: "1" / 1 === 1. Actual: ' + ("1" / 1)); +} + +//CHECK#2 +if (1 / "1" !== 1) { + $ERROR('#2: 1 / "1" === 1. Actual: ' + (1 / "1")); +} + +//CHECK#3 +if (new String("1") / 1 !== 1) { + $ERROR('#3: new String("1") / 1 === 1. Actual: ' + (new String("1") / 1)); +} + +//CHECK#4 +if (1 / new String("1") !== 1) { + $ERROR('#4: 1 / new String("1") === 1. Actual: ' + (1 / new String("1"))); +} + +//CHECK#5 +if ("1" / new Number(1) !== 1) { + $ERROR('#5: "1" / new Number(1) === 1. Actual: ' + ("1" / new Number(1))); +} + +//CHECK#6 +if (new Number(1) / "1" !== 1) { + $ERROR('#6: new Number(1) / "1" === 1. Actual: ' + (new Number(1) / "1")); +} + +//CHECK#7 +if (new String("1") / new Number(1) !== 1) { + $ERROR('#7: new String("1") / new Number(1) === 1. Actual: ' + (new String("1") / new Number(1))); +} + +//CHECK#8 +if (new Number(1) / new String("1") !== 1) { + $ERROR('#8: new Number(1) / new String("1") === 1. Actual: ' + (new Number(1) / new String("1"))); +} + +//CHECK#9 +if (isNaN("x" / 1) !== true) { + $ERROR('#9: "x" / 1 === Not-a-Number. Actual: ' + ("x" / 1)); +} + +//CHECK#10 +if (isNaN(1 / "x") !== true) { + $ERROR('#10: 1 / "x" === Not-a-Number. Actual: ' + (1 / "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.3.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.3.js new file mode 100644 index 000000000..bd37aaefa --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.3.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.3.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Null + */ + +//CHECK#1 +if (1 / null !== Number.POSITIVE_INFINITY) { + $ERROR('#1: 1 / null === +Infinity. Actual: ' + (1 / null)); +} + +//CHECK#2 +if (null / 1 !== 0) { + $ERROR('#2: null / 1 === 0. Actual: ' + (null / 1)); +} + +//CHECK#3 +if (new Number(1) / null !== Number.POSITIVE_INFINITY) { + $ERROR('#3: new Number(1) / null === +Infinity. Actual: ' + (new Number(1) / null)); +} + +//CHECK#4 +if (null / new Number(1) !== 0) { + $ERROR('#4: null / new Number(1) === 0. Actual: ' + (null / new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.4.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.4.js new file mode 100644 index 000000000..a67647f6b --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.4.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.4.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(1 / undefined) !== true) { + $ERROR('#1: 1 / undefined === Not-a-Number. Actual: ' + (1 / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / 1) !== true) { + $ERROR('#2: undefined / 1 === Not-a-Number. Actual: ' + (undefined / 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) / undefined) !== true) { + $ERROR('#3: new Number(1) / undefined === Not-a-Number. Actual: ' + (new Number(1) / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new Number(1)) !== true) { + $ERROR('#4: undefined / new Number(1) === Not-a-Number. Actual: ' + (undefined / new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.5.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.5.js new file mode 100644 index 000000000..ae723bdae --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.5.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.5.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Boolean (primitive and object) + */ + +//CHECK#1 +if (true / "1" !== 1) { + $ERROR('#1: true / "1" === 1. Actual: ' + (true / "1")); +} + +//CHECK#2 +if ("1" / true !== 1) { + $ERROR('#2: "1" / true === 1. Actual: ' + ("1" / true)); +} + +//CHECK#3 +if (new Boolean(true) / "1" !== 1) { + $ERROR('#3: new Boolean(true) / "1" === 1. Actual: ' + (new Boolean(true) / "1")); +} + +//CHECK#4 +if ("1" / new Boolean(true) !== 1) { + $ERROR('#4: "1" / new Boolean(true) === 1. Actual: ' + ("1" / new Boolean(true))); +} + +//CHECK#5 +if (true / new String("1") !== 1) { + $ERROR('#5: true / new String("1") === 1. Actual: ' + (true / new String("1"))); +} + +//CHECK#6 +if (new String("1") / true !== 1) { + $ERROR('#6: new String("1") / true === 1. Actual: ' + (new String("1") / true)); +} + +//CHECK#7 +if (new Boolean(true) / new String("1") !== 1) { + $ERROR('#7: new Boolean(true) / new String("1") === 1. Actual: ' + (new Boolean(true) / new String("1"))); +} + +//CHECK#8 +if (new String("1") / new Boolean(true) !== 1) { + $ERROR('#8: new String("1") / new Boolean(true) === 1. Actual: ' + (new String("1") / new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.6.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.6.js new file mode 100644 index 000000000..728613ebd --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.6.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.6.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN("1" / undefined) !== true) { + $ERROR('#1: "1" / undefined === Not-a-Number. Actual: ' + ("1" / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / "1") !== true) { + $ERROR('#2: undefined / "1" === Not-a-Number. Actual: ' + (undefined / "1")); +} + +//CHECK#3 +if (isNaN(new String("1") / undefined) !== true) { + $ERROR('#3: new String("1") / undefined === Not-a-Number. Actual: ' + (new String("1") / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new String("1")) !== true) { + $ERROR('#4: undefined / new String("1") === Not-a-Number. Actual: ' + (undefined / new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.7.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.7.js new file mode 100644 index 000000000..9a307dc32 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.7.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.7.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Null + */ + +//CHECK#1 +if ("1" / null !== Number.POSITIVE_INFINITY) { + $ERROR('#1: "1" / null === +Infinity. Actual: ' + ("1" / null)); +} + +//CHECK#2 +if (null / "1" !== 0) { + $ERROR('#2: null / "1" === 0. Actual: ' + (null / "1")); +} + +//CHECK#3 +if (new String("1") / null !== Number.POSITIVE_INFINITY) { + $ERROR('#3: new String("1") / null === +Infinity. Actual: ' + (new String("1") / null)); +} + +//CHECK#4 +if (null / new String("1") !== 0) { + $ERROR('#4: null / new String("1") === 0. Actual: ' + (null / new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.8.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.8.js new file mode 100644 index 000000000..a3fb0e50e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.8.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.8.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(true / undefined) !== true) { + $ERROR('#1: true / undefined === Not-a-Number. Actual: ' + (true / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / true) !== true) { + $ERROR('#2: undefined / true === Not-a-Number. Actual: ' + (undefined / true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) / undefined) !== true) { + $ERROR('#3: new Boolean(true) / undefined === Not-a-Number. Actual: ' + (new Boolean(true) / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new Boolean(true)) !== true) { + $ERROR('#4: undefined / new Boolean(true) === Not-a-Number. Actual: ' + (undefined / new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.9.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.9.js new file mode 100644 index 000000000..5459c4d04 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A3_T2.9.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. + +/** + * Operator x / y returns ToNumber(x) / ToNumber(y) + * + * @path ch11/11.5/11.5.2/S11.5.2_A3_T2.9.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Null + */ + +//CHECK#1 +if (true / null !== Number.POSITIVE_INFINITY) { + $ERROR('#1: true / null === +Infinity. Actual: ' + (true / null)); +} + +//CHECK#2 +if (null / true !== 0) { + $ERROR('#2: null / true === 0. Actual: ' + (null / true)); +} + +//CHECK#3 +if (new Boolean(true) / null !== Number.POSITIVE_INFINITY) { + $ERROR('#3: new Boolean(true) / null === +Infinity. Actual: ' + (new Boolean(true) / null)); +} + +//CHECK#4 +if (null / new Boolean(true) !== 0) { + $ERROR('#4: null / new Boolean(true) === 0. Actual: ' + (null / new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.1.js new file mode 100644 index 000000000..f98c2b58e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.1.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 result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T1.1.js + * @description If left operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN / Number.NaN) !== true) { + $ERROR('#1: NaN / NaN === Not-a-Number. Actual: ' + (NaN / NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN / +0) !== true) { + $ERROR('#2: NaN / +0 === Not-a-Number. Actual: ' + (NaN / +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN / -0) !== true) { + $ERROR('#3: NaN / -0 === Not-a-Number. Actual: ' + (NaN / -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN / Number.POSITIVE_INFINITY) !== true) { + $ERROR('#4: NaN / Infinity === Not-a-Number. Actual: ' + (NaN / Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN / Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#5: NaN / -Infinity === Not-a-Number. Actual: ' + (NaN / -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN / Number.MAX_VALUE) !== true) { + $ERROR('#6: NaN / Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN / Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN / Number.MIN_VALUE) !== true) { + $ERROR('#7: NaN / Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN / Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN / 1) !== true) { + $ERROR('#8: NaN / 1 === Not-a-Number. Actual: ' + (NaN / 1)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.2.js new file mode 100644 index 000000000..57415ff2a --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T1.2.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 result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T1.2.js + * @description If right operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN / Number.NaN) !== true) { + $ERROR('#1: NaN / NaN === Not-a-Number. Actual: ' + (NaN / NaN)); +} + +//CHECK#2 +if (isNaN(+0 / Number.NaN) !== true) { + $ERROR('#2: +0 / NaN === Not-a-Number. Actual: ' + (+0 / NaN)); +} + +//CHECK#3 +if (isNaN(-0 / Number.NaN) !== true) { + $ERROR('#3: -0 / NaN === Not-a-Number. Actual: ' + (-0 / NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY / Number.NaN) !== true) { + $ERROR('#4: Infinity / NaN === Not-a-Number. Actual: ' + (Infinity / NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY / Number.NaN) !== true) { + $ERROR('#5: -Infinity / NaN === Not-a-Number. Actual: ' + ( -Infinity / NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE / Number.NaN) !== true) { + $ERROR('#6: Number.MAX_VALUE / NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE / NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE / Number.NaN) !== true) { + $ERROR('#7: Number.MIN_VALUE / NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE / NaN)); +} + +//CHECK#8 +if (isNaN(1 / Number.NaN) !== true) { + $ERROR('#8: 1 / NaN === Not-a-Number. Actual: ' + (1 / NaN)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T10.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T10.js new file mode 100644 index 000000000..a8a0f25ab --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T10.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T10.js + * @description If both operands are finite and nonzero, the quotient is computed and rounded using IEEE 754 round-to-nearest mode. + * If the magnitude is too small to represent, the result is then a zero of appropriate sign + */ + +//CHECK#1 +if (Number.MIN_VALUE / 2.1 !== 0) { + $ERROR('#1: Number.MIN_VALUE / 2.1 === 0. Actual: ' + (Number.MIN_VALUE / 2.1)); +} + +//CHECK#2 +if (Number.MIN_VALUE / -2.1 !== -0) { + $ERROR('#2.1: Number.MIN_VALUE / -2.1 === 0. Actual: ' + (Number.MIN_VALUE / -2.1)); +} else { + if (1 / (Number.MIN_VALUE / -2.1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#2.2: Number.MIN_VALUE / -2.1 === -0. Actual: +0'); + } +} + +//CHECK#3 +if (Number.MIN_VALUE / 2.0 !== 0) { + $ERROR('#3: Number.MIN_VALUE / 2.0 === 0. Actual: ' + (Number.MIN_VALUE / 2.0)); +} + +//CHECK#4 +if (Number.MIN_VALUE / -2.0 !== -0) { + $ERROR('#4.1: Number.MIN_VALUE / -2.0 === -0. Actual: ' + (Number.MIN_VALUE / -2.0)); +} else { + if (1 / (Number.MIN_VALUE / -2.0) !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: Number.MIN_VALUE / -2.0 === -0. Actual: +0'); + } +} + +//CHECK#5 +if (Number.MIN_VALUE / 1.9 !== Number.MIN_VALUE) { + $ERROR('#5: Number.MIN_VALUE / 1.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.9)); +} + +//CHECK#6 +if (Number.MIN_VALUE / -1.9 !== -Number.MIN_VALUE) { + $ERROR('#6: Number.MIN_VALUE / -1.9 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.9)); +} + +//CHECK#7 +if (Number.MIN_VALUE / 1.1 !== Number.MIN_VALUE) { + $ERROR('#7: Number.MIN_VALUE / 1.1 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.1)); +} + +//CHECK#8 +if (Number.MIN_VALUE / -1.1 !== -Number.MIN_VALUE) { + $ERROR('#8: Number.MIN_VALUE / -1.1 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.1)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T2.js new file mode 100644 index 000000000..4e0143879 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_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. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T2.js + * @description The sign of the result is positive if both operands have the same sign, negative if the operands have different signs + */ + +//CHECK#1 +if (1 / 1 !== 1) { + $ERROR('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +if (1 / -1 !== -1) { + $ERROR('#2: 1 / -1 === -1. Actual: ' + (1 / -1)); +} + +//CHECK#3 +if (-1 / 1 !== -1) { + $ERROR('#3: -1 / 1 === -1. Actual: ' + (-1 / 1)); +} + +//CHECK#4 +if (-1 / -1 !== 1) { + $ERROR('#4: -1 / -1 === 1. Actual: ' + (-1 / -1)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T3.js new file mode 100644 index 000000000..dd67b91f8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T3.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T3.js + * @description Division of an infinity by a zero results in an infinity of appropriate sign + */ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY / 0 !== Number.NEGATIVE_INFINITY) { + $ERROR('#1: Infinity / 0 === Infinity. Actual: ' + (Infinity / 0)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY / -0 !== Number.POSITIVE_INFINITY) { + $ERROR('#2: -Infinity / -0 === Infinity. Actual: ' + (-Infinity / -0)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY / 0 !== Number.POSITIVE_INFINITY) { + $ERROR('#3: Infinity / 0 === Infinity. Actual: ' + (Infinity / 0)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY / -0 !== Number.NEGATIVE_INFINITY) { + $ERROR('#4: Infinity / -0 === -Infinity. Actual: ' + (Infinity / -0)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T4.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T4.js new file mode 100644 index 000000000..14804ad6f --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T4.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 result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T4.js + * @description Division of an infinity by an infinity results in NaN + */ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#1: -Infinity / -Infinity === Not-a-Number. Actual: ' + (-Infinity / -Infinity)); +} + +//CHECK#2 +if (isNaN(Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY) !== true) { + $ERROR('#2: Infinity / Infinity === Not-a-Number. Actual: ' + (Infinity / Infinity)); +} + +//CHECK#3 +if (isNaN(Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY) !== true) { + $ERROR('#3: -Infinity / Infinity === Not-a-Number. Actual: ' + (-Infinity / Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#4: Infinity / -Infinity === Not-a-Number. Actual: ' + (Infinity / -Infinity)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T5.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T5.js new file mode 100644 index 000000000..3f84058ca --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T5.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. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T5.js + * @description Division of an infinity by a finite non-zero value results in a signed infinity + */ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY / 1 !== Number.NEGATIVE_INFINITY) { + $ERROR('#1: -Infinity / 1 === -Infinity. Actual: ' + (-Infinity / 1)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY / -1 !== Number.POSITIVE_INFINITY) { + $ERROR('#2: -Infinity / -1 === Infinity. Actual: ' + (-Infinity / -1)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY / 1 !== Number.POSITIVE_INFINITY) { + $ERROR('#3: Infinity / 1 === Infinity. Actual: ' + (Infinity / 1)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY / -1 !== Number.NEGATIVE_INFINITY) { + $ERROR('#4: Infinity / -1 === -Infinity. Actual: ' + (Infinity / -1)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY / -Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + $ERROR('#5: Infinity / -Number.MAX_VALUE === -Infinity. Actual: ' + (Infinity / -Number.MAX_VALUE)); +} + +//CHECK#6 +if (Number.NEGATIVE_INFINITY / Number.MIN_VALUE !== Number.NEGATIVE_INFINITY) { + $ERROR('#6: -Infinity / Number.MIN_VALUE === -Infinity. Actual: ' + (-Infinity / Number.MIN_VALUE)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T6.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T6.js new file mode 100644 index 000000000..7c013ee31 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T6.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T6.js + * @description Division of a finite value by an infinity results in zero of appropriate sign + */ + +//CHECK#1 +if (1 / Number.NEGATIVE_INFINITY !== -0) { + $ERROR('#1.1: 1 / -Infinity === 0. Actual: ' + (1 / -Infinity)); +} else { + if (1 / (1 / Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: 1 / -Infinity === - 0. Actual: +0'); + } +} + +//CHECK#2 +if (-1 / Number.NEGATIVE_INFINITY !== +0) { + $ERROR('#2.1: -1 / -Infinity === 0. Actual: ' + (-1 / -Infinity)); +} else { + if (1 / (-1 / Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: -1 / -Infinity === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (1 / Number.POSITIVE_INFINITY !== +0) { + $ERROR('#3.1: 1 / Infinity === 0. Actual: ' + (1 / Infinity)); +} else { + if (1 / (1 / Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#3.2: 1 / Infinity === + 0. Actual: -0'); + } +} + +//CHECK#4 +if (-1 / Number.POSITIVE_INFINITY !== -0) { + $ERROR('#4.1: -1 / Infinity === 0. Actual: ' + (-1 / Infinity)); +} else { + if (1 / (-1 / Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: -1 / Infinity === - 0. Actual: +0'); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T7.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T7.js new file mode 100644 index 000000000..df2b59970 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T7.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 result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T7.js + * @description Division of a zero by a zero results in NaN + */ + +//CHECK#1 +if (isNaN(+0 / +0) !== true) { + $ERROR('#1: +0 / +0 === Not-a-Number. Actual: ' + (+0 / +0)); +} + +//CHECK#2 +if (isNaN(-0 / +0) !== true) { + $ERROR('#2: -0 / +0 === Not-a-Number. Actual: ' + (-0 / +0)); +} + +//CHECK#3 +if (isNaN(+0 / -0) !== true) { + $ERROR('#3: +0 / -0 === Not-a-Number. Actual: ' + (+0 / -0)); +} + +//CHECK#4 +if (isNaN(-0 / -0) !== true) { + $ERROR('#4: -0 / -0 === Not-a-Number. Actual: ' + (-0 / -0)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T8.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T8.js new file mode 100644 index 000000000..1984de1f2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T8.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T8.js + * @description Division of a zero by any non-zero finite value -0 results in zero of appropriate sign + */ + +//CHECK#1 +if (-0 / 1 !== -0) { + $ERROR('#1.1: -0 / 1 === 0. Actual: ' + (-0 / 1)); +} else { + if (1 / (-0 / 1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: -0 / 1 === - 0. Actual: +0'); + } +} + +//CHECK#2 +if (-0 / -1 !== +0) { + $ERROR('#2.1: -0 / -1 === 0. Actual: ' + (-0 / -1)); +} else { + if (1 / (-0 / -1) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: -0 / -1 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (+0 / 1 !== +0) { + $ERROR('#3.1: +0 / 1 === 0. Actual: ' + (+0 / 1)); +} else { + if (1 / (+0 / -1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3.2: +0 / -1 === + 0. Actual: -0'); + } +} + +//CHECK#4 +if (+0 / -1 !== -0) { + $ERROR('#4.1: +0 / -1 === 0. Actual: ' + (+0 / -1)); +} else { + if (1 / (+0 / -1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: +0 / -1 === - 0. Actual: +0'); + } +} + +//CHECK#5 +if (+0 / -Number.MAX_VALUE !== -0) { + $ERROR('#5.1: 0 / -Number.MAX_VALUE === 0. Actual: ' + (0 / -Number.MAX_VALUE)); +} else { + if (1 / (+0 / -Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#5.2: +0 / -Number.MAX_VALUE === - 0. Actual: +0'); + } +} + +//CHECK#6 +if (-0 / Number.MIN_VALUE !== -0) { + $ERROR('#6.1: -0 / Number.MIN_VALUE === 0. Actual: ' + (-0 / Number.MIN_VALUE)); +} else { + if (1 / (-0 / Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#6.2: -0 / Number.MIN_VALUE === - 0. Actual: +0'); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T9.js b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T9.js new file mode 100644 index 000000000..9539057d7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/S11.5.2_A4_T9.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of division is determined by the specification of IEEE 754 arithmetics + * + * @path ch11/11.5/11.5.2/S11.5.2_A4_T9.js + * @description If the magnitude is too large to represent, the result is then an infinity of appropriate sign + */ + +//CHECK#1 +if (Number.MAX_VALUE / 0.9 !== Number.POSITIVE_INFINITY) { + $ERROR('#1: Number.MAX_VALUE / 0.9 === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE / 0.9)); +} + +//CHECK#2 +if (Number.MAX_VALUE / -0.9 !== Number.NEGATIVE_INFINITY) { + $ERROR('#2: Number.MAX_VALUE / -0.9 === Number.NEGATIVE_INFINITY. Actual: ' + (Number.MAX_VALUE / -0.9)); +} + +//CHECK#3 +if (Number.MAX_VALUE / 1 !== Number.MAX_VALUE) { + $ERROR('#3: Number.MAX_VALUE / 1 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE / 1)); +} + +//CHECK#4 +if (Number.MAX_VALUE / -1 !== -Number.MAX_VALUE) { + $ERROR('#4: Number.MAX_VALUE / -1 === -Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE / -1)); +} + +//CHECK#5 +if (Number.MAX_VALUE / (Number.MAX_VALUE / 0.9) === (Number.MAX_VALUE / Number.MAX_VALUE) / 0.9) { + $ERROR('#5: Number.MAX_VALUE / (Number.MAX_VALUE / 0.9) !== (Number.MAX_VALUE / Number.MAX_VALUE) / 0.9'); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/browser.js b/js/src/tests/test262/ch11/11.5/11.5.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/browser.js diff --git a/js/src/tests/test262/ch11/11.5/11.5.2/shell.js b/js/src/tests/test262/ch11/11.5/11.5.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.2/shell.js diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A1.js new file mode 100644 index 000000000..c372cc545 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A1.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. + +/** + * White Space and Line Terminator between MultiplicativeExpression and "%" or between "%" and UnaryExpression are allowed + * + * @path ch11/11.5/11.5.3/S11.5.3_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("1\u0009%\u00091") !== 0) { + $ERROR('#1: 1\\u0009%\\u00091 === 0'); +} + +//CHECK#2 +if (eval("1\u000B%\u000B1") !== 0) { + $ERROR('#2: 1\\u000B%\\u000B1 === 0'); +} + +//CHECK#3 +if (eval("1\u000C%\u000C1") !== 0) { + $ERROR('#3: 1\\u000C%\\u000C1 === 0'); +} + +//CHECK#4 +if (eval("1\u0020%\u00201") !== 0) { + $ERROR('#4: 1\\u0020%\\u00201 === 0'); +} + +//CHECK#5 +if (eval("1\u00A0%\u00A01") !== 0) { + $ERROR('#5: 1\\u00A0%\\u00A01 === 0'); +} + +//CHECK#6 +if (eval("1\u000A%\u000A1") !== 0) { + $ERROR('#6: 1\\u000A%\\u000A1 === 0'); +} + +//CHECK#7 +if (eval("1\u000D%\u000D1") !== 0) { + $ERROR('#7: 1\\u000D%\\u000D1 === 0'); +} + +//CHECK#8 +if (eval("1\u2028%\u20281") !== 0) { + $ERROR('#8: 1\\u2028%\\u20281 === 0'); +} + +//CHECK#9 +if (eval("1\u2029%\u20291") !== 0) { + $ERROR('#9: 1\\u2029%\\u20291 === 0'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029%\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 0) { + $ERROR('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029%\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 0'); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T1.js new file mode 100644 index 000000000..b2a973d37 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x % y uses GetValue + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if (1 % 2 !== 1) { + $ERROR('#1: 1 % 2 === 1. Actual: ' + (1 % 2)); +} + +//CHECK#2 +var x = 1; +if (x % 2 !== 1) { + $ERROR('#2: var x = 1; x % 2 === 1. Actual: ' + (x % 2)); +} + +//CHECK#3 +var y = 2; +if (1 % y !== 1) { + $ERROR('#3: var y = 2; 1 % y === 1. Actual: ' + (1 % y)); +} + +//CHECK#4 +var x = 1; +var y = 2; +if (x % y !== 1) { + $ERROR('#4: var x = 1; var y = 2; x % y === 1. Actual: ' + (x % y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 2; +if (objectx.prop % objecty.prop !== 1) { + $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 2; objectx.prop % objecty.prop === 1. Actual: ' + (objectx.prop % objecty.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T2.js new file mode 100644 index 000000000..5da5f3cff --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_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. + +/** + * Operator x % y uses GetValue + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x % 1; + $ERROR('#1.1: x % 1 throw ReferenceError. Actual: ' + (x % 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x % 1 throw ReferenceError. Actual: ' + (e)); + } +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T3.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T3.js new file mode 100644 index 000000000..20b64080e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.1_T3.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. + +/** + * Operator x % y uses GetValue + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.1_T3.js + * @description If GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + 1 % y; + $ERROR('#1.1: 1 % y throw ReferenceError. Actual: ' + (1 % y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: 1 % y throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.2_T1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.2_T1.js new file mode 100644 index 000000000..ab488af50 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.2_T1.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. + +/** + * Operator x % y uses [[Default Value]] + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +if ({valueOf: function() {return 1}} % 2 !== 1) { + $ERROR('#1: {valueOf: function() {return 1}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}} % 2)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} % 2 !== 1) { + $ERROR('#2: {valueOf: function() {return 1}, toString: function() {return 0}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} % 2)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} % 2 !== 1) { + $ERROR('#3: {valueOf: function() {return 1}, toString: function() {return {}}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} % 2)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 !== 1) { + $ERROR('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} % 2)); + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 not throw "error"'); + } else { + $ERROR('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 % {toString: function() {return 2}} !== 1) { + $ERROR('#5: 1 % {toString: function() {return 2}} === 1. Actual: ' + (1 % {toString: function() {return 2}})); +} + +//CHECK#6 +if (1 % {valueOf: function() {return {}}, toString: function() {return 2}} !== 1) { + $ERROR('#6: 1 % {valueOf: function() {return {}}, toString: function() {return 2}} === 1. Actual: ' + (1 % {valueOf: function() {return {}}, toString: function() {return 2}})); +} + +//CHECK#7 +try { + 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}}; + $ERROR('#7.1: 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (1 % {valueOf: function() {throw "error"}, toString: function() {return 2}})); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 % {valueOf: function() {return {}}, toString: function() {return {}}}; + $ERROR('#8.1: 1 % {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 % {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: 1 % {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.3_T1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.3_T1.js new file mode 100644 index 000000000..836a13ff6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.3_T1.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. + +/** + * ToNumber(first expression) is called first, and then ToNumber(second expression) + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.3_T1.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x % y; + $ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x % y throw "x". Actual: ' + (x % y)); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x % y throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T1.js new file mode 100644 index 000000000..7b87a3bf0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.4_T1.js + * @description Checking with "=" + */ + +//CHECK#1 +var x = 0; +if ((x = 1) % x !== 0) { + $ERROR('#1: var x = 0; (x = 1) % x === 0. Actual: ' + ((x = 1) % x)); +} + +//CHECK#2 +var x = 1; +if (x % (x = 2) !== 1) { + $ERROR('#2: var x = 1; x % (x = 2) === 1. Actual: ' + (x % (x = 2))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T2.js new file mode 100644 index 000000000..f3c306ca1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T2.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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.4_T2.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() % y(); + $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() % y() throw "x". Actual: ' + (x() % y())); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() % y() throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T3.js new file mode 100644 index 000000000..a597a95d2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.5/11.5.3/S11.5.3_A2.4_T3.js + * @description Checking with undeclarated variables + */ + +//CHECK#1 +try { + x % (x = 1); + $ERROR('#1.1: x % (x = 1) throw ReferenceError. Actual: ' + (x % (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x % (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if ((y = 1) % y !== 0) { + $ERROR('#2: (y = 1) % y === 0. Actual: ' + ((y = 1) % y)); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.1.js new file mode 100644 index 000000000..816d0efe9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.1.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T1.1.js + * @description Type(x) and Type(y) vary between primitive boolean and Boolean object + */ + +//CHECK#1 +if (true % true !== 0) { + $ERROR('#1: true % true === 0. Actual: ' + (true % true)); +} + +//CHECK#2 +if (new Boolean(true) % true !== 0) { + $ERROR('#2: new Boolean(true) % true === 0. Actual: ' + (new Boolean(true) % true)); +} + +//CHECK#3 +if (true % new Boolean(true) !== 0) { + $ERROR('#3: true % new Boolean(true) === 0. Actual: ' + (true % new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) % new Boolean(true) !== 0) { + $ERROR('#4: new Boolean(true) % new Boolean(true) === 0. Actual: ' + (new Boolean(true) % new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.2.js new file mode 100644 index 000000000..db3ba1d64 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.2.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T1.2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if (1 % 1 !== 0) { + $ERROR('#1: 1 % 1 === 0. Actual: ' + (1 % 1)); +} + +//CHECK#2 +if (new Number(1) % 1 !== 0) { + $ERROR('#2: new Number(1) % 1 === 0. Actual: ' + (new Number(1) % 1)); +} + +//CHECK#3 +if (1 % new Number(1) !== 0) { + $ERROR('#3: 1 % new Number(1) === 0. Actual: ' + (1 % new Number(1))); +} + +//CHECK#4 +if (new Number(1) % new Number(1) !== 0) { + $ERROR('#4: new Number(1) % new Number(1) === 0. Actual: ' + (new Number(1) % new Number(1))); +} + + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.3.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.3.js new file mode 100644 index 000000000..3520ef236 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.3.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T1.3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if ("1" % "1" !== 0) { + $ERROR('#1: "1" % "1" === 0. Actual: ' + ("1" % "1")); +} + +//CHECK#2 +if (new String("1") % "1" !== 0) { + $ERROR('#2: new String("1") % "1" === 0. Actual: ' + (new String("1") % "1")); +} + +//CHECK#3 +if ("1" % new String("1") !== 0) { + $ERROR('#3: "1" % new String("1") === 0. Actual: ' + ("1" % new String("1"))); +} + +//CHECK#4 +if (new String("1") % new String("1") !== 0) { + $ERROR('#4: new String("1") % new String("1") === 0. Actual: ' + (new String("1") % new String("1"))); +} + +//CHECK#5 +if (isNaN("x" % "1") !== true) { + $ERROR('#5: "x" % "1" === Not-a-Number. Actual: ' + ("x" % "1")); +} + +//CHECK#6 +if (isNaN("1" % "x") !== true) { + $ERROR('#6: "1" % "x" === Not-a-Number. Actual: ' + ("1" % "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.4.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.4.js new file mode 100644 index 000000000..0af53ef4e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.4.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T1.4.js + * @description Type(x) and Type(y) vary between Null and Undefined + */ + +//CHECK#1 +if (isNaN(null % undefined) !== true) { + $ERROR('#1: null % undefined === Not-a-Number. Actual: ' + (null % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % null) !== true) { + $ERROR('#2: undefined % null === Not-a-Number. Actual: ' + (undefined % null)); +} + +//CHECK#3 +if (isNaN(undefined % undefined) !== true) { + $ERROR('#3: undefined % undefined === Not-a-Number. Actual: ' + (undefined % undefined)); +} + +//CHECK#4 +if (isNaN(null % null) !== true) { + $ERROR('#4: null % null === Not-a-Number. Actual: ' + (null % null)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.5.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.5.js new file mode 100644 index 000000000..85cbbecf2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T1.5.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T1.5.js + * @description Type(x) and Type(y) vary between Object object and Function object + */ + +//CHECK#1 +if (isNaN({} % function(){return 1}) !== true) { + $ERROR('#1: {} % function(){return 1} === Not-a-Number. Actual: ' + ({} % function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} % {}) !== true) { + $ERROR('#2: function(){return 1} % {} === Not-a-Number. Actual: ' + (function(){return 1} % {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} % function(){return 1}) !== true) { + $ERROR('#3: function(){return 1} % function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} % function(){return 1})); +} + +//CHECK#4 +if (isNaN({} % {}) !== true) { + $ERROR('#4: {} % {} === Not-a-Number. Actual: ' + ({} % {})); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.1.js new file mode 100644 index 000000000..4cde92634 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.1.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.1.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Boolean (primitive and object) + */ + +//CHECK#1 +if (true % 1 !== 0) { + $ERROR('#1: true % 1 === 0. Actual: ' + (true % 1)); +} + +//CHECK#2 +if (1 % true !== 0) { + $ERROR('#2: 1 % true === 0. Actual: ' + (1 % true)); +} + +//CHECK#3 +if (new Boolean(true) % 1 !== 0) { + $ERROR('#3: new Boolean(true) % 1 === 0. Actual: ' + (new Boolean(true) % 1)); +} + +//CHECK#4 +if (1 % new Boolean(true) !== 0) { + $ERROR('#4: 1 % new Boolean(true) === 0. Actual: ' + (1 % new Boolean(true))); +} + +//CHECK#5 +if (true % new Number(1) !== 0) { + $ERROR('#5: true % new Number(1) === 0. Actual: ' + (true % new Number(1))); +} + +//CHECK#6 +if (new Number(1) % true !== 0) { + $ERROR('#6: new Number(1) % true === 0. Actual: ' + (new Number(1) % true)); +} + +//CHECK#7 +if (new Boolean(true) % new Number(1) !== 0) { + $ERROR('#7: new Boolean(true) % new Number(1) === 0. Actual: ' + (new Boolean(true) % new Number(1))); +} + +//CHECK#8 +if (new Number(1) % new Boolean(true) !== 0) { + $ERROR('#8: new Number(1) % new Boolean(true) === 0. Actual: ' + (new Number(1) % new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.2.js new file mode 100644 index 000000000..6196513ce --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.2.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.2.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and String (primitive and object) + */ + +//CHECK#1 +if ("1" % 1 !== 0) { + $ERROR('#1: "1" % 1 === 0. Actual: ' + ("1" % 1)); +} + +//CHECK#2 +if (1 % "1" !== 0) { + $ERROR('#2: 1 % "1" === 0. Actual: ' + (1 % "1")); +} + +//CHECK#3 +if (new String("1") % 1 !== 0) { + $ERROR('#3: new String("1") % 1 === 0. Actual: ' + (new String("1") % 1)); +} + +//CHECK#4 +if (1 % new String("1") !== 0) { + $ERROR('#4: 1 % new String("1") === 0. Actual: ' + (1 % new String("1"))); +} + +//CHECK#5 +if ("1" % new Number(1) !== 0) { + $ERROR('#5: "1" % new Number(1) === 0. Actual: ' + ("1" % new Number(1))); +} + +//CHECK#6 +if (new Number(1) % "1" !== 0) { + $ERROR('#6: new Number(1) % "1" === 0. Actual: ' + (new Number(1) % "1")); +} + +//CHECK#7 +if (new String("1") % new Number(1) !== 0) { + $ERROR('#7: new String("1") % new Number(1) === 0. Actual: ' + (new String("1") % new Number(1))); +} + +//CHECK#8 +if (new Number(1) % new String("1") !== 0) { + $ERROR('#8: new Number(1) % new String("1") === 0. Actual: ' + (new Number(1) % new String("1"))); +} + +//CHECK#9 +if (isNaN("x" % 1) !== true) { + $ERROR('#9: "x" % 1 === Not-a-Number. Actual: ' + ("x" % 1)); +} + +//CHECK#10 +if (isNaN(1 % "x") !== true) { + $ERROR('#10: 1 % "x" === Not-a-Number. Actual: ' + (1 % "x")); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.3.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.3.js new file mode 100644 index 000000000..c6f32f2b4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.3.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.3.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Null + */ + +//CHECK#1 +if (isNaN(1 % null) !== true) { + $ERROR('#1: 1 % null === Not-a-Number. Actual: ' + (1 % null)); +} + +//CHECK#2 +if (null % 1 !== 0) { + $ERROR('#2: null % 1 === 0. Actual: ' + (null % 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) % null) !== true) { + $ERROR('#3: new Number(1) % null === Not-a-Number. Actual: ' + (new Number(1) % null)); +} + +//CHECK#4 +if (null % new Number(1) !== 0) { + $ERROR('#4: null % new Number(1) === 0. Actual: ' + (null % new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.4.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.4.js new file mode 100644 index 000000000..4abfc2c0f --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.4.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.4.js + * @description Type(x) is different from Type(y) and both types vary between Number (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(1 % undefined) !== true) { + $ERROR('#1: 1 % undefined === Not-a-Number. Actual: ' + (1 % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % 1) !== true) { + $ERROR('#2: undefined % 1 === Not-a-Number. Actual: ' + (undefined % 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) % undefined) !== true) { + $ERROR('#3: new Number(1) % undefined === Not-a-Number. Actual: ' + (new Number(1) % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new Number(1)) !== true) { + $ERROR('#4: undefined % new Number(1) === Not-a-Number. Actual: ' + (undefined % new Number(1))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.5.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.5.js new file mode 100644 index 000000000..951f4c68c --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.5.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.5.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Boolean (primitive and object) + */ + +//CHECK#1 +if (true % "1" !== 0) { + $ERROR('#1: true % "1" === 0. Actual: ' + (true % "1")); +} + +//CHECK#2 +if ("1" % true !== 0) { + $ERROR('#2: "1" % true === 0. Actual: ' + ("1" % true)); +} + +//CHECK#3 +if (new Boolean(true) % "1" !== 0) { + $ERROR('#3: new Boolean(true) % "1" === 0. Actual: ' + (new Boolean(true) % "1")); +} + +//CHECK#4 +if ("1" % new Boolean(true) !== 0) { + $ERROR('#4: "1" % new Boolean(true) === 0. Actual: ' + ("1" % new Boolean(true))); +} + +//CHECK#5 +if (true % new String("1") !== 0) { + $ERROR('#5: true % new String("1") === 0. Actual: ' + (true % new String("1"))); +} + +//CHECK#6 +if (new String("1") % true !== 0) { + $ERROR('#6: new String("1") % true === 0. Actual: ' + (new String("1") % true)); +} + +//CHECK#7 +if (new Boolean(true) % new String("1") !== 0) { + $ERROR('#7: new Boolean(true) % new String("1") === 0. Actual: ' + (new Boolean(true) % new String("1"))); +} + +//CHECK#8 +if (new String("1") % new Boolean(true) !== 0) { + $ERROR('#8: new String("1") % new Boolean(true) === 0. Actual: ' + (new String("1") % new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.6.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.6.js new file mode 100644 index 000000000..973fe5263 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.6.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.6.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN("1" % undefined) !== true) { + $ERROR('#1: "1" % undefined === Not-a-Number. Actual: ' + ("1" % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % "1") !== true) { + $ERROR('#2: undefined % "1" === Not-a-Number. Actual: ' + (undefined % "1")); +} + +//CHECK#3 +if (isNaN(new String("1") % undefined) !== true) { + $ERROR('#3: new String("1") % undefined === Not-a-Number. Actual: ' + (new String("1") % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new String("1")) !== true) { + $ERROR('#4: undefined % new String("1") === Not-a-Number. Actual: ' + (undefined % new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.7.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.7.js new file mode 100644 index 000000000..baa8a90e4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.7.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.7.js + * @description Type(x) is different from Type(y) and both types vary between String (primitive or object) and Null + */ + +//CHECK#1 +if (isNaN("1" % null) !== true) { + $ERROR('#1: "1" % null === Not-a-Number. Actual: ' + ("1" % null)); +} + +//CHECK#2 +if (null % "1" !== 0) { + $ERROR('#2: null % "1" === 0. Actual: ' + (null % "1")); +} + +//CHECK#3 +if (isNaN(new String("1") % null) !== true) { + $ERROR('#3: new String("1") % null === Not-a-Number. Actual: ' + (new String("1") % null)); +} + +//CHECK#4 +if (null % new String("1") !== 0) { + $ERROR('#4: null % new String("1") === 0. Actual: ' + (null % new String("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.8.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.8.js new file mode 100644 index 000000000..54e229b09 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.8.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.8.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined + */ + +//CHECK#1 +if (isNaN(true % undefined) !== true) { + $ERROR('#1: true % undefined === Not-a-Number. Actual: ' + (true % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % true) !== true) { + $ERROR('#2: undefined % true === Not-a-Number. Actual: ' + (undefined % true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) % undefined) !== true) { + $ERROR('#3: new Boolean(true) % undefined === Not-a-Number. Actual: ' + (new Boolean(true) % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new Boolean(true)) !== true) { + $ERROR('#4: undefined % new Boolean(true) === Not-a-Number. Actual: ' + (undefined % new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.9.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.9.js new file mode 100644 index 000000000..3ff69f285 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A3_T2.9.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. + +/** + * Operator x % y returns ToNumber(x) % ToNumber(y) + * + * @path ch11/11.5/11.5.3/S11.5.3_A3_T2.9.js + * @description Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Null + */ + +//CHECK#1 +if (isNaN(true % null) !== true) { + $ERROR('#1: true % null === Not-a-Number. Actual: ' + (true % null)); +} + +//CHECK#2 +if (null % true !== 0) { + $ERROR('#2: null % true === 0. Actual: ' + (null % true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) % null) !== true) { + $ERROR('#3: new Boolean(true) % null === Not-a-Number. Actual: ' + (new Boolean(true) % null)); +} + +//CHECK#4 +if (null % new Boolean(true) !== 0) { + $ERROR('#4: null % new Boolean(true) === 0. Actual: ' + (null % new Boolean(true))); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.1.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.1.js new file mode 100644 index 000000000..b2ad39088 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.1.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 result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T1.1.js + * @description If either operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN % Number.NaN) !== true) { + $ERROR('#1: NaN % NaN === Not-a-Number. Actual: ' + (NaN % NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN % +0) !== true) { + $ERROR('#2: NaN % +0 === Not-a-Number. Actual: ' + (NaN % +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN % -0) !== true) { + $ERROR('#3: NaN % -0 === Not-a-Number. Actual: ' + (NaN % -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN % Number.POSITIVE_INFINITY) !== true) { + $ERROR('#4: NaN % Infinity === Not-a-Number. Actual: ' + (NaN % Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN % Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#5: NaN % -Infinity === Not-a-Number. Actual: ' + (NaN % -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN % Number.MAX_VALUE) !== true) { + $ERROR('#6: NaN % Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN % Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN % Number.MIN_VALUE) !== true) { + $ERROR('#7: NaN % Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN % Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN % 1) !== true) { + $ERROR('#8: NaN % 1 === Not-a-Number. Actual: ' + (NaN % 1)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.2.js new file mode 100644 index 000000000..2b7da808e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T1.2.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 result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T1.2.js + * @description If either operand is NaN, the result is NaN + */ + +//CHECK#1 +if (isNaN(Number.NaN % Number.NaN) !== true) { + $ERROR('#1: NaN % NaN === Not-a-Number. Actual: ' + (NaN % NaN)); +} + +//CHECK#2 +if (isNaN(+0 % Number.NaN) !== true) { + $ERROR('#2: +0 % NaN === Not-a-Number. Actual: ' + (+0 % NaN)); +} + +//CHECK#3 +if (isNaN(-0 % Number.NaN) !== true) { + $ERROR('#3: -0 % NaN === Not-a-Number. Actual: ' + (-0 % NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY % Number.NaN) !== true) { + $ERROR('#4: Infinity % NaN === Not-a-Number. Actual: ' + (Infinity % NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY % Number.NaN) !== true) { + $ERROR('#5: -Infinity % NaN === Not-a-Number. Actual: ' + ( -Infinity % NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE % Number.NaN) !== true) { + $ERROR('#6: Number.MAX_VALUE % NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE % NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE % Number.NaN) !== true) { + $ERROR('#7: Number.MIN_VALUE % NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE % NaN)); +} + +//CHECK#8 +if (isNaN(1 % Number.NaN) !== true) { + $ERROR('#8: 1 % NaN === Not-a-Number. Actual: ' + (1 % NaN)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T2.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T2.js new file mode 100644 index 000000000..ce2051688 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T2.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T2.js + * @description The sign of the finite non-zero value result equals the sign of the divided + */ + +//CHECK#1 +if (1 % 1 !== 0) { + $ERROR('#1.1: 1 % 1 === 0. Actual: ' + (1 % 1)); +} else { + if (1 / (1 % 1) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: 1 % 1 === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (-1 % -1 !== -0) { + $ERROR('#2.1: -1 % -1 === 0. Actual: ' + (-1 % -1)); +} else { + if (1 / (-1 % -1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#2.2: -1 % -1 === - 0. Actual: +0'); + } +} + +//CHECK#3 +if (-1 % 1 !== -0) { + $ERROR('#3.1: -1 % 1 === 0. Actual: ' + (-1 % 1)); +} else { + if (1 / (-1 % 1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3.2: -1 % 1 === - 0. Actual: +0'); + } +} + +//CHECK#4 +if (1 % -1 !== 0) { + $ERROR('#4.1: 1 % -1 === 0. Actual: ' + (1 % -1)); +} else { + if (1 / (1 % -1) !== Number.POSITIVE_INFINITY) { + $ERROR('#4.2: 1 % -1 === + 0. Actual: -0'); + } +} + +//CHECK#5 +if (101 % 51 !== 50) { + $ERROR('#5: 101 % 51 === 50. Actual: ' + (101 % 51)); +} + +//CHECK#6 +if (101 % -51 !== 50) { + $ERROR('#6: 101 % -51 === 50. Actual: ' + (101 % -51)); +} + +//CHECK#7 +if (-101 % 51 !== -50) { + $ERROR('#7: -101 % 51 === -50. Actual: ' + (-101 % 51)); +} + +//CHECK#8 +if (-101 % -51 !== -50) { + $ERROR('#8: -101 % -51 === -50. Actual: ' + (-101 % -51)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T3.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T3.js new file mode 100644 index 000000000..5861cf727 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T3.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. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T3.js + * @description If the dividend is an infinity results is NaN + */ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY) !== true) { + $ERROR('#1: -Infinity % Infinity === Not-a-Number. Actual: ' + (-Infinity % Infinity)); +} + +//CHECK#2 +if (isNaN(Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#2: -Infinity % -Infinity === Not-a-Number. Actual: ' + (-Infinity % -Infinity)); +} + +//CHECK#3 +if (isNaN(Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY) !== true) { + $ERROR('#3: Infinity % Infinity === Not-a-Number. Actual: ' + (Infinity % Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY) !== true) { + $ERROR('#4: Infinity % -Infinity === Not-a-Number. Actual: ' + (Infinity % -Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY % 1) !== true) { + $ERROR('#5: Infinity % 1 === Not-a-Number. Actual: ' + (Infinity % 1)); +} + +//CHECK#6 +if (isNaN(Number.NEGATIVE_INFINITY % -1) !== true) { + $ERROR('#6: -Infinity % -1 === Not-a-Number. Actual: ' + (-Infinity % -1)); +} + +//CHECK#7 +if (isNaN(Number.POSITIVE_INFINITY % 1) !== true) { + $ERROR('#7: Infinity % 1 === Not-a-Number. Actual: ' + (Infinity % 1)); +} + +//CHECK#8 +if (isNaN(Number.POSITIVE_INFINITY % -1) !== true) { + $ERROR('#8: Infinity % -1 === Not-a-Number. Actual: ' + (Infinity % -1)); +} + +//CHECK#9 +if (isNaN(Number.NEGATIVE_INFINITY % Number.MAX_VALUE) !== true) { + $ERROR('#9: Infinity % Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % Number.MAX_VALUE)); +} + +//CHECK#10 +if (isNaN(Number.NEGATIVE_INFINITY % -Number.MAX_VALUE) !== true) { + $ERROR('#10: -Infinity % -Number.MAX_VALUE === Not-a-Number. Actual: ' + (-Infinity % -Number.MAX_VALUE)); +} + +//CHECK#11 +if (isNaN(Number.POSITIVE_INFINITY % Number.MAX_VALUE) !== true) { + $ERROR('#11: Infinity % Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % Number.MAX_VALUE)); +} + +//CHECK#12 +if (isNaN(Number.POSITIVE_INFINITY % -Number.MAX_VALUE) !== true) { + $ERROR('#12: Infinity % -Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % -Number.MAX_VALUE)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T4.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T4.js new file mode 100644 index 000000000..cdf3ebd38 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T4.js @@ -0,0 +1,90 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T4.js + * @description If the divisor is zero results is NaN + */ + +//CHECK#1 +if (isNaN(-0 % 0) !== true) { + $ERROR('#1: -0 % 0 === Not-a-Number. Actual: ' + (-0 % 0)); +} + +//CHECK#2 +if (isNaN(-0 % -0) !== true) { + $ERROR('#2: -0 % -0 === Not-a-Number. Actual: ' + (-0 % -0)); +} + +//CHECK#3 +if (isNaN(0 % 0) !== true) { + $ERROR('#3: 0 % 0 === Not-a-Number. Actual: ' + (0 % 0)); +} + +//CHECK#4 +if (isNaN(0 % -0) !== true) { + $ERROR('#4: 0 % -0 === Not-a-Number. Actual: ' + (0 % -0)); +} + +//CHECK#5 +if (isNaN(-1 % 0) !== true) { + $ERROR('#5: 1 % 0 === Not-a-Number. Actual: ' + (1 % 0)); +} + +//CHECK#6 +if (isNaN(-1 % -0) !== true) { + $ERROR('#6: -1 % -0 === Not-a-Number. Actual: ' + (-1 % -0)); +} + +//CHECK#7 +if (isNaN(1 % 0) !== true) { + $ERROR('#7: 1 % 0 === Not-a-Number. Actual: ' + (1 % 0)); +} + +//CHECK#8 +if (isNaN(1 % -0) !== true) { + $ERROR('#8: 1 % -0 === Not-a-Number. Actual: ' + (1 % -0)); +} + +//CHECK#9 +if (isNaN(Number.NEGATIVE_INFINITY % 0) !== true) { + $ERROR('#9: Infinity % 0 === Not-a-Number. Actual: ' + (Infinity % 0)); +} + +//CHECK#10 +if (isNaN(Number.NEGATIVE_INFINITY % -0) !== true) { + $ERROR('#10: -Infinity % -0 === Not-a-Number. Actual: ' + (-Infinity % -0)); +} + +//CHECK#11 +if (isNaN(Number.POSITIVE_INFINITY % 0) !== true) { + $ERROR('#11: Infinity % 0 === Not-a-Number. Actual: ' + (Infinity % 0)); +} + +//CHECK#12 +if (isNaN(Number.POSITIVE_INFINITY % -0) !== true) { + $ERROR('#12: Infinity % -0 === Not-a-Number. Actual: ' + (Infinity % -0)); +} + +//CHECK#13 +if (isNaN(Number.MIN_VALUE % 0) !== true) { + $ERROR('#13: Number.MIN_VALUE % 0 === Not-a-Number. Actual: ' + (Number.MIN_VALUE % 0)); +} + +//CHECK#14 +if (isNaN(Number.MIN_VALUE % -0) !== true) { + $ERROR('#14: -Number.MIN_VALUE % -0 === Not-a-Number. Actual: ' + (-Number.MIN_VALUE % -0)); +} + +//CHECK#15 +if (isNaN(Number.MAX_VALUE % 0) !== true) { + $ERROR('#15: Number.MAX_VALUE % 0 === Not-a-Number. Actual: ' + (Number.MAX_VALUE % 0)); +} + +//CHECK#16 +if (isNaN(Number.MAX_VALUE % -0) !== true) { + $ERROR('#16: Number.MAX_VALUE % -0 === Not-a-Number. Actual: ' + (Number.MAX_VALUE % -0)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T5.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T5.js new file mode 100644 index 000000000..46f9e75da --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T5.js @@ -0,0 +1,104 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T5.js + * @description If dividend is finite and the divisor is an infinity, the result equals the dividend + */ + +//CHECK#1 +if (1 % Number.NEGATIVE_INFINITY !== 1) { + $ERROR('#1: 1 % -Infinity === 1. Actual: ' + (1 % -Infinity)); +} +//CHECK#2 +if (1 % Number.POSITIVE_INFINITY !==1) { + $ERROR('#2: 1 % Infinity === 1. Actual: ' + (1 % Infinity)); +} + +//CHECK#3 +if (-1 % Number.POSITIVE_INFINITY !== -1) { + $ERROR('#3: -1 % Infinity === -1. Actual: ' + (-1 % Infinity)); +} + +//CHECK#4 +if (-1 % Number.NEGATIVE_INFINITY !== -1) { + $ERROR('#4: -1 % -Infinity === -1. Actual: ' + (-1 % -Infinity)); +} + +//CHECK#5 +if (0 % Number.POSITIVE_INFINITY !== 0) { + $ERROR('#5.1: 0 % Infinity === 0. Actual: ' + (0 % Infinity)); +} else { + if (1 / (0 % Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: 0 % Infinity === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 % Number.NEGATIVE_INFINITY !== 0) { + $ERROR('#6.1: 0 % -Infinity === 0. Actual: ' + (0 % -Infinity)); +} else { + if (1 / (0 % Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + $ERROR('#6.2: 0 % -Infinity === + 0. Actual: -0'); + } +} + +//CHECK#7 +if (-0 % Number.POSITIVE_INFINITY !== -0) { + $ERROR('#7.1: -0 % Infinity === 0. Actual: ' + (-0 % Infinity)); +} else { + if (1 / (-0 % Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#7.2: -0 % Infinity === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 % Number.NEGATIVE_INFINITY !== -0) { + $ERROR('#8.1: -0 % -Infinity === 0. Actual: ' + (-0 % -Infinity)); +} else { + if (1 / (-0 % Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + $ERROR('#8.2: -0 % -Infinity === - 0. Actual: +0'); + } +} + +//CHECK#9 +if (Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== Number.MAX_VALUE) { + $ERROR('#9: Number.MAX_VALUE % -Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % -Infinity)); +} + +//CHECK#10 +if (Number.MAX_VALUE % Number.POSITIVE_INFINITY !== Number.MAX_VALUE) { + $ERROR('#10: Number.MAX_VALUE % Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % Infinity)); +} + +//CHECK#11 +if (-Number.MAX_VALUE % Number.POSITIVE_INFINITY !== -Number.MAX_VALUE) { + $ERROR('#11: -Number.MAX_VALUE % Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % Infinity)); +} + +//CHECK#12 +if (-Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== -Number.MAX_VALUE) { + $ERROR('#12: -Number.MAX_VALUE % -Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % -Infinity)); +} + +//CHECK#13 +if (Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== Number.MIN_VALUE) { + $ERROR('#13: Number.MIN_VALUE % -Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % -Infinity)); +} +//CHECK#14 +if (Number.MIN_VALUE % Number.POSITIVE_INFINITY !== Number.MIN_VALUE) { + $ERROR('#14: Number.MIN_VALUE % Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % Infinity)); +} + +//CHECK#15 +if (-Number.MIN_VALUE % Number.POSITIVE_INFINITY !== -Number.MIN_VALUE) { + $ERROR('#15: -Number.MIN_VALUE % Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % Infinity)); +} + +//CHECK#16 +if (-Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== -Number.MIN_VALUE) { + $ERROR('#16: -Number.MIN_VALUE % -Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % -Infinity)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T6.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T6.js new file mode 100644 index 000000000..02373aec7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T6.js @@ -0,0 +1,82 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T6.js + * @description If dividend is a zero and the divisor is nonzero finite, the result equals the dividend + */ + +//CHECK#1 +if (0 % 1 !== 0) { + $ERROR('#1.1: 0 % 1 === 0. Actual: ' + (0 % 1)); +} else { + if (1 / (0 % 1) !== Number.POSITIVE_INFINITY) { + $ERROR('#1.2: 0 % 1 === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (0 % -1 !== 0) { + $ERROR('#2.1: 0 % -1 === 0. Actual: ' + (0 % -1)); +} else { + if (1 / (0 % -1) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: 0 % -1 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (-0 % 1 !== -0) { + $ERROR('#3.1: -0 % 1 === 0. Actual: ' + (-0 % 1)); +} else { + if (1 / (-0 % 1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#3.2: -0 % 1 === - 0. Actual: +0'); + } +} + +//CHECK#4 +if (-0 % -1 !== -0) { + $ERROR('#4.1: -0 % -1 === 0. Actual: ' + (-0 % -1)); +} else { + if (1 / (-0 % -1) !== Number.NEGATIVE_INFINITY) { + $ERROR('#4.2: 0 % -1 === - 0. Actual: +0'); + } +} + +//CHECK#5 +if (0 % Number.MAX_VALUE !== 0) { + $ERROR('#5.1: 0 % Number.MAX_VALUE === 0. Actual: ' + (0 % Number.MAX_VALUE)); +} else { + if (1 / (0 % Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + $ERROR('#5.2: 0 % Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 % Number.MIN_VALUE !== 0) { + $ERROR('#6.1: 0 % Number.MIN_VALUE === 0. Actual: ' + (0 % Number.MIN_VALUE)); +} else { + if (1 / (0 % Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) { + $ERROR('#6.2: 0 % Number.MIN_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#7 +if (-0 % Number.MAX_VALUE !== -0) { + $ERROR('#7.1: -0 % Number.MAX_VALUE === 0. Actual: ' + (-0 % Number.MAX_VALUE)); +} else { + if (1 / (-0 % Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#7.2: -0 % Number.MAX_VALUE === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 % Number.MIN_VALUE !== -0) { + $ERROR('#8.1: -0 % Number.MIN_VALUE === 0. Actual: ' + (-0 % Number.MIN_VALUE)); +} else { + if (1 / (-0 % Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + $ERROR('#8.2: 0 % Number.MIN_VALUE === - 0. Actual: +0'); + } +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T7.js b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T7.js new file mode 100644 index 000000000..54356536e --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/S11.5.3_A4_T7.js @@ -0,0 +1,74 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetics + * + * @path ch11/11.5/11.5.3/S11.5.3_A4_T7.js + * @description If operands neither an infinity, nor a zero, nor NaN, return x - truncate(x / y) * y + */ + +function truncate(x) { + if (x > 0) { + return Math.floor(x); + } else { + return Math.ceil(x); + } +} + +//CHECK#1 +x = 1.3; +y = 1.1; +if (x % y !== 0.19999999999999996) { + $ERROR('#1: x = 1.3; y = 1.1; x % y === 0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#2 +x = -1.3; +y = 1.1; +if (x % y !== -0.19999999999999996) { + $ERROR('#2: x = -1.3; y = 1.1; x % y === -0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#3 +x = 1.3; +y = -1.1; +if (x % y !== 0.19999999999999996) { + $ERROR('#3: x = 1.3; y = -1.1; x % y === 0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#4 +x = -1.3; +y = -1.1; +if (x % y !== -0.19999999999999996) { + $ERROR('#4: x = -1.3; y = -1.1; x % y === -0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#5 +x = 1.3; +y = 1.1; +if (x % y !== x - truncate(x / y) * y) { + $ERROR('#5: x = 1.3; y = 1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#6 +x = -1.3; +y = 1.1; +if (x % y !== x - truncate(x / y) * y) { + $ERROR('#6: x = -1.3; y = 1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#7 +x = 1.3; +y = -1.1; +if (x % y !== x - truncate(x / y) * y) { + $ERROR('#7: x = 1.3; y = -1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#8 +x = -1.3; +y = -1.1; +if (x % y !== x - truncate(x / y) * y) { + $ERROR('#8: x = -1.3; y = -1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/browser.js b/js/src/tests/test262/ch11/11.5/11.5.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/browser.js diff --git a/js/src/tests/test262/ch11/11.5/11.5.3/shell.js b/js/src/tests/test262/ch11/11.5/11.5.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/11.5.3/shell.js diff --git a/js/src/tests/test262/ch11/11.5/browser.js b/js/src/tests/test262/ch11/11.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/browser.js diff --git a/js/src/tests/test262/ch11/11.5/shell.js b/js/src/tests/test262/ch11/11.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.5/shell.js |