diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/strict-does-not-equals')
32 files changed, 1452 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js new file mode 100644 index 0000000000..32d6948769 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between EqualityExpression and "!==" or + between "!==" and RelationalExpression are allowed +es5id: 11.9.5_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009!==\u00091")) { + throw new Test262Error('#1: 1\\u0009!==\\u00091'); +} + +//CHECK#2 +if (eval("1\u000B!==\u000B1")) { + throw new Test262Error('#2: 1\\u000B!==\\u000B1'); +} + +//CHECK#3 +if (eval("1\u000C!==\u000C1")) { + throw new Test262Error('#3: 1\\u000C!==\\u000C1'); +} + +//CHECK#4 +if (eval("1\u0020!==\u00201")) { + throw new Test262Error('#4: 1\\u0020!==\\u00201'); +} + +//CHECK#5 +if (eval("1\u00A0!==\u00A01")) { + throw new Test262Error('#5: 1\\u00A0!==\\u00A01'); +} + +//CHECK#6 +if (eval("1\u000A!==\u000A1")) { + throw new Test262Error('#6: 1\\u000A!==\\u000A1'); +} + +//CHECK#7 +if (eval("1\u000D!==\u000D1")) { + throw new Test262Error('#7: 1\\u000D!==\\u000D1'); +} + +//CHECK#8 +if (eval("1\u2028!==\u20281")) { + throw new Test262Error('#8: 1\\u2028!==\\u20281'); +} + +//CHECK#9 +if (eval("1\u2029!==\u20291")) { + throw new Test262Error('#9: 1\\u2029!==\\u20291'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029!==\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029!==\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js new file mode 100644 index 0000000000..9d674f6251 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_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. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 !== 1) { + throw new Test262Error('#1: 1 === 1'); +} + +//CHECK#2 +var x = 1; +if (x !== 1) { + throw new Test262Error('#2: var x = 1; x === 1'); +} + +//CHECK#3 +var y = 1; +if (1 !== y) { + throw new Test262Error('#3: var y = 1; 1 === y'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x !== y) { + throw new Test262Error('#4: var x = 1; var y = 1; x === y'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop !== objecty.prop) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop === objecty.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js new file mode 100644 index 0000000000..9b4ef38fc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x !== 1; + throw new Test262Error('#1.1: x !== 1 throw ReferenceError. Actual: ' + (x !== 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x !== 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js new file mode 100644 index 0000000000..0adf4326da --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_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. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 !== y; + throw new Test262Error('#1.1: 1 !== y throw ReferenceError. Actual: ' + (1 !== y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 !== y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js new file mode 100644 index 0000000000..d0f71c4bae --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) !== x) { + throw new Test262Error('#1: var x = 0; (x = 1) === x'); +} + +//CHECK#2 +var x = 0; +if (!(x !== (x = 1))) { + throw new Test262Error('#2: var x = 0; x !== (x = 1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js new file mode 100644 index 0000000000..7b96d6d698 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() !== y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() !== y() throw "x". Actual: ' + (x() !== y())); +} catch (e) { + if (!(e !== "y")) { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() !== y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js new file mode 100644 index 0000000000..9481cd25bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T3 +description: Checking undeclarated variables +---*/ + +//CHECK#1 +try { + x !== (x = 1); + throw new Test262Error('#1.1: x !== (x = 1) throw ReferenceError. Actual: ' + (x !== (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x !== (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js new file mode 100644 index 0000000000..4e57a9b5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T4 +description: Checking undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) !== y) { + throw new Test262Error('#1: (y = 1) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js new file mode 100644 index 0000000000..f1e7a1cc4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Boolean-s. + Return false, if x and y are both true or both false; otherwise, return true +es5id: 11.9.5_A3 +description: x and y are primitive booleans +---*/ + +//CHECK#1 +if (true !== true) { + throw new Test262Error('#1: true === true'); +} + +//CHECK#2 +if (false !== false) { + throw new Test262Error('#2: false === false'); +} + +//CHECK#3 +if (!(true !== false)) { + throw new Test262Error('#3: true !== false'); +} + +//CHECK#4 +if (!(false !== true)) { + throw new Test262Error('#4: false !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js new file mode 100644 index 0000000000..b8e5038443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.5_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if (!(Number.NaN !== true)) { + throw new Test262Error('#1: NaN !== true'); +} + +//CHECK#2 +if (!(Number.NaN !== 1)) { + throw new Test262Error('#2: NaN !== 1'); +} + +//CHECK#3 +if (!(Number.NaN !== Number.NaN)) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (!(Number.NaN !== Number.POSITIVE_INFINITY)) { + throw new Test262Error('#4: NaN !== +Infinity'); +} + +//CHECK#5 +if (!(Number.NaN !== Number.NEGATIVE_INFINITY)) { + throw new Test262Error('#5: NaN !== -Infinity'); +} + +//CHECK#6 +if (!(Number.NaN !== Number.MAX_VALUE)) { + throw new Test262Error('#6: NaN !== Number.MAX_VALUE'); +} + +//CHECK#7 +if (!(Number.NaN !== Number.MIN_VALUE)) { + throw new Test262Error('#7: NaN !== Number.MIN_VALUE'); +} + +//CHECK#8 +if (!(Number.NaN !== "string")) { + throw new Test262Error('#8: NaN !== "string"'); +} + +//CHECK#9 +if (!(Number.NaN !== new Object())) { + throw new Test262Error('#9: NaN !== new Object()'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js new file mode 100644 index 0000000000..6e989f4d5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.5_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if (!(true !== Number.NaN)) { + throw new Test262Error('#1: true !== NaN'); +} + +//CHECK#2 +if (!(-1 !== Number.NaN)) { + throw new Test262Error('#2: -1 !== NaN'); +} + +//CHECK#3 +if (!(Number.NaN !== Number.NaN)) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (!(Number.POSITIVE_INFINITY !== Number.NaN)) { + throw new Test262Error('#4: +Infinity !== NaN'); +} + +//CHECK#5 +if (!(Number.NEGATIVE_INFINITY !== Number.NaN)) { + throw new Test262Error('#5: -Infinity !== NaN'); +} + +//CHECK#6 +if (!(Number.MAX_VALUE !== Number.NaN)) { + throw new Test262Error('#6: Number.MAX_VALUE !== NaN'); +} + +//CHECK#7 +if (!(Number.MIN_VALUE !== Number.NaN)) { + throw new Test262Error('#7: Number.MIN_VALUE !== NaN'); +} + +//CHECK#8 +if (!("string" !== Number.NaN)) { + throw new Test262Error('#8: "string" !== NaN'); +} + +//CHECK#9 +if (!(new Object() !== Number.NaN)) { + throw new Test262Error('#9: new Object() !== NaN'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js new file mode 100644 index 0000000000..93dc5bd2b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.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. + +/*--- +info: If x is +0(-0) and y is -0(+0), return false +es5id: 11.9.5_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if (+0 !== -0) { + throw new Test262Error('#1: +0 === -0'); +} + +//CHECK#2 +if (-0 !== +0) { + throw new Test262Error('#2: -0 === +0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js new file mode 100644 index 0000000000..27109a7967 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Number-s minus NaN, +0, -0. + Return false, if x is the same number value as y; otherwise, return true +es5id: 11.9.5_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: +Infinity === +Infinity'); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: -Infinity === -Infinity'); +} + +//CHECK#3 +if (13 !== 13) { + throw new Test262Error('#3: 13 === 13'); +} + +//CHECK#4 +if (-13 !== -13) { + throw new Test262Error('#4: -13 === -13'); +} + +//CHECK#5 +if (1.3 !== 1.3) { + throw new Test262Error('#5: 1.3 === 1.3'); +} + +//CHECK#6 +if (-1.3 !== -1.3) { + throw new Test262Error('#6: -1.3 === -1.3'); +} + +//CHECK#7 +if (Number.POSITIVE_INFINITY !== -Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7: +Infinity === -(-Infinity)'); +} + +//CHECK#8 +if (!(1 !== 0.999999999999)) { + throw new Test262Error('#8: 1 !== 0.999999999999'); +} + +//CHECK#9 +if (1.0 !== 1) { + throw new Test262Error('#9: 1.0 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js new file mode 100644 index 0000000000..9a2dfe6971 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are String-s. + Return false, if x and y are exactly the same sequence of characters; otherwise, return true +es5id: 11.9.5_A5 +description: x and y are primitive strings +---*/ + +//CHECK#1 +if ("" !== "") { + throw new Test262Error('#1: "" === ""'); +} + +//CHECK#2 +if (" " !== " ") { + throw new Test262Error('#2: " " === " "'); +} + +//CHECK#3 +if ("string" !== "string") { + throw new Test262Error('#3: "string" === "string"'); +} + +//CHECK#4 +if (!(" string" !== "string ")) { + throw new Test262Error('#4: " string" !== "string "'); +} + +//CHECK#5 +if (!("1.0" !== "1")) { + throw new Test262Error('#5: "1.0" !== "1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js new file mode 100644 index 0000000000..5e8de33750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Undefined-s, return false +es5id: 11.9.5_A6.1 +description: void 0, eval("var x") is undefined +---*/ + +//CHECK#1 +if (undefined !== undefined) { + throw new Test262Error('#1: undefined === undefined'); +} + +//CHECK#2 +if (void 0 !== undefined) { + throw new Test262Error('#2: void 0 === undefined'); +} + +//CHECK#3 +if (undefined !== eval("var x")) { + throw new Test262Error('#3: undefined === eval("var x")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js new file mode 100644 index 0000000000..853b7a007e --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Null-s, return false +es5id: 11.9.5_A6.2 +description: null === null +---*/ + +//CHECK#1 +if (null !== null) { + throw new Test262Error('#1: null === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js new file mode 100644 index 0000000000..6e208ee023 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Object-s. + Return false, if x and y are references to the same Object; otherwise, return true +es5id: 11.9.5_A7 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if (!(new Object() !== new Object())) { + throw new Test262Error('#1: new Object() !== new Object()'); +} + +//CHECK#2 +if (!(new Object(true) !== new Object(true))) { + throw new Test262Error('#2: new Object() !== new Object()'); +} + +//CHECK#3 +if (!(new Object(false) !== new Object(false))) { + throw new Test262Error('#3: new Object() !== new Object()'); +} + +//CHECK#4 +if (!(new Object(+0) !== new Object(-0))) { + throw new Test262Error('#4: new Object(+0) !== new Object(-0)'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if (x !== y) { + throw new Test262Error('#5: x = {}; y = x; x === y'); +} + +//CHECK#6 +if (!(new Boolean(true) !== new Number(1))) { + throw new Test262Error('#6 new Boolean(true) !== new Number(1)'); +} + +//CHECK#7 +if (!(new Number(1) !== new String("1"))) { + throw new Test262Error('#7: new Number(1) !== new String("1")'); +} + +//CHECK#8 +if (!(new String("1") !== new Boolean(true))) { + throw new Test262Error('#8: new String("x") !== new Boolean(true)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js new file mode 100644 index 0000000000..925350c668 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T1 +description: x or y is primitive boolean +---*/ + +//CHECK#1 +if (!(true !== new Boolean(true))) { + throw new Test262Error('#1: true !== new Number(true)'); +} + +//CHECK#2 +if (!(true !== 1)) { + throw new Test262Error('#2: true !== 1'); +} + +//CHECK#3 +if (!(true !== new Number(true))) { + throw new Test262Error('#3: true !== new Number(true)'); +} + +//CHECK#4 +if (!(true !== "1")) { + throw new Test262Error('#4: true !== "1"'); +} + +//CHECK#5 +if (!(true !== new String(true))) { + throw new Test262Error('#5: true !== new String(true)'); +} + +//CHECK#6 +if (!(new Boolean(false) !== false)) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (!(0 !== false)) { + throw new Test262Error('#7: 0 !== false'); +} + +//CHECK#8 +if (!(new Number(false) !== false)) { + throw new Test262Error('#8: new Number(false) !== false'); +} + +//CHECK#9 +if (!("0" !== false)) { + throw new Test262Error('#9: "0" !== false'); +} + +//CHECK#10 +if (!(false !== new String(false))) { + throw new Test262Error('#10: false !== new String(false)'); +} + +//CHECK#11 +if (!(true !== {valueOf: function () {return true}})) { + throw new Test262Error('#11: true !== {valueOf: function () {return true}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js new file mode 100644 index 0000000000..f2e7ac3cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T2 +description: x or y is primitive number +---*/ + +//CHECK#1 +if (!(1 !== new Number(1))) { + throw new Test262Error('#1: 1 !== new Number(1)'); +} + +//CHECK#2 +if (!(1 !== true)) { + throw new Test262Error('#2: 1 !== true'); +} + +//CHECK#3 +if (!(1 !== new Boolean(1))) { + throw new Test262Error('#3: 1 !== new Boolean(1)'); +} + +//CHECK#4 +if (!(1 !== "1")) { + throw new Test262Error('#4: 1 !== "1"'); +} + +//CHECK#5 +if (!(1 !== new String(1))) { + throw new Test262Error('#5: 1 !== new String(1)'); +} + +//CHECK#6 +if (!(new Number(0) !== 0)) { + throw new Test262Error('#6: new Number(0) !== 0'); +} + +//CHECK#7 +if (!(false !== 0)) { + throw new Test262Error('#7: false !== 0'); +} + +//CHECK#8 +if (!(new Boolean(0) !== 0)) { + throw new Test262Error('#8: new Boolean(0) !== 0'); +} + +//CHECK#9 +if (!("0" !== 0)) { + throw new Test262Error('#9: "0" !== 0'); +} + +//CHECK#10 +if (!(new String(0) !== 0)) { + throw new Test262Error('#10: new String(0) !== 0'); +} + +//CHECK#11 +if (!(1 !== {valueOf: function () {return 1}})) { + throw new Test262Error('#11: 1 !== {valueOf: function () {return 1}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js new file mode 100644 index 0000000000..fd84fe711f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T3 +description: x or y is primitive string +---*/ + +//CHECK#1 +if (!("1" !== new String("1"))) { + throw new Test262Error('#1: "1" !== new String("1")'); +} + +//CHECK#2 +if (!("1" !== true)) { + throw new Test262Error('#2: "1" !== true'); +} + +//CHECK#3 +if (!("1" !== new Boolean("1"))) { + throw new Test262Error('#3: "1" !== new Boolean("1")'); +} + +//CHECK#4 +if (!("1" !== 1)) { + throw new Test262Error('#4: "1" === 1'); +} + +//CHECK#5 +if (!("1" !== new Number("1"))) { + throw new Test262Error('#5: "1" === new Number("1")'); +} + +//CHECK#6 +if (!(new String(false) !== false)) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (!(false !== "0")) { + throw new Test262Error('#7: false !== "0"'); +} + +//CHECK#8 +if (!("0" !== new Boolean("0"))) { + throw new Test262Error('#8: "0" !== new Boolean("0")'); +} + +//CHECK#9 +if (!(false !== 0)) { + throw new Test262Error('#9: false !== 0'); +} + +//CHECK#10 +if (!(false !== new Number(false))) { + throw new Test262Error('#10: false !== new Number(false)'); +} + +//CHECK#11 +if (!("1" !== {valueOf: function () {return "1"}})) { + throw new Test262Error('#11: "1" !== {valueOf: function () {return "1"}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js new file mode 100644 index 0000000000..ccfb0fa966 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T4 +description: x or y is null or undefined +---*/ + +//CHECK#1 +if (!(undefined !== null)) { + throw new Test262Error('#1: undefined !== null'); +} + +//CHECK#2 +if (!(null !== undefined)) { + throw new Test262Error('#2: null !== undefined'); +} + +//CHECK#3 +if (!(null !== 0)) { + throw new Test262Error('#3: null !== 0'); +} + +//CHECK#4 +if (!(0 !== null)) { + throw new Test262Error('#4: 0 !== null'); +} + +//CHECK#5 +if (!(null !== false)) { + throw new Test262Error('#5: null !== false'); +} + +//CHECK#6 +if (!(false !== null)) { + throw new Test262Error('#6: false !== null'); +} + +//CHECK#7 +if (!(undefined !== false)) { + throw new Test262Error('#7: undefined !== false'); +} + +//CHECK#8 +if (!(false !== undefined)) { + throw new Test262Error('#8: false !== undefined'); +} + +//CHECK#9 +if (!(null !== new Object())) { + throw new Test262Error('#9: null !== new Object()'); +} + +//CHECK#10 +if (!(new Object() !== null)) { + throw new Test262Error('#10: new Object() !== null'); +} + +//CHECK#11 +if (!(null !== "null")) { + throw new Test262Error('#11: null !== "null"'); +} + +//CHECK#12 +if (!("null" !== null)) { + throw new Test262Error('#12: "null" !== null'); +} + +//CHECK#13 +if (!(undefined !== "undefined")) { + throw new Test262Error('#13: undefined !== "undefined"'); +} + +//CHECK#14 +if (!("undefined" !== undefined)) { + throw new Test262Error('#14: "undefined" !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js new file mode 100644 index 0000000000..4f5dd4f96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.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. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T5 +description: > + Checking such x and y that either x or y is primitive string and + the other is primitive number +---*/ + +//CHECK#1 +try { + throw 1; +} catch(e) { + if (!(e !== "1")) { + throw new Test262Error('#1: throw 1 !== "1"'); + } +} + +//CHECK#2 +try { + throw "1"; +} catch(e) { + if (!(1 !== e)) { + throw new Test262Error('#2: 1 !== throw "1"'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js new file mode 100644 index 0000000000..7aad2a21d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js @@ -0,0 +1,174 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + 2. If Type(x) is Number or BigInt, then + a. Return ! Type(x)::equal(x, y). + + sec-numeric-types-bigint-equal + BigInt::equal (x, y) + + The abstract operation BigInt::equal with two arguments x and y of BigInt type returns true if x and y have the same mathematical integer value and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n !== 0n, false, 'The result of (0n !== 0n) is false'); +assert.sameValue(1n !== 1n, false, 'The result of (1n !== 1n) is false'); +assert.sameValue(-1n !== -1n, false, 'The result of (-1n !== -1n) is false'); +assert.sameValue(0n !== -0n, false, 'The result of (0n !== -0n) is false'); +assert.sameValue(-0n !== 0n, false, 'The result of (-0n !== 0n) is false'); +assert.sameValue(0n !== 1n, true, 'The result of (0n !== 1n) is true'); +assert.sameValue(1n !== 0n, true, 'The result of (1n !== 0n) is true'); +assert.sameValue(0n !== -1n, true, 'The result of (0n !== -1n) is true'); +assert.sameValue(-1n !== 0n, true, 'The result of (-1n !== 0n) is true'); +assert.sameValue(1n !== -1n, true, 'The result of (1n !== -1n) is true'); +assert.sameValue(-1n !== 1n, true, 'The result of (-1n !== 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n !== 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n !== 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n !== -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n !== -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0n, + true, + 'The result of (0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000000n, + true, + 'The result of (0n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 1n, + true, + 'The result of (0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== 0x10000000000000000n, + true, + 'The result of (1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== -1n, + true, + 'The result of (0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== 0x10000000000000000n, + true, + 'The result of (-1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n !== 0n, + true, + 'The result of (0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000001n, + true, + 'The result of (0n !== 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 0n, + true, + 'The result of (-0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000000n, + true, + 'The result of (0n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 1n, + true, + 'The result of (-0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== -0x10000000000000000n, + true, + 'The result of (1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== -1n, + true, + 'The result of (-0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== -0x10000000000000000n, + true, + 'The result of (-1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n !== 0n, + true, + 'The result of (-0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000001n, + true, + 'The result of (0n !== -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0x100000000n, + true, + 'The result of (0x10000000000000000n !== 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n !== 0x10000000000000000n, + true, + 'The result of (0x100000000n !== 0x10000000000000000n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js new file mode 100644 index 0000000000..ff251f8e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and Boolean values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(-1n !== false, true, 'The result of (-1n !== false) is true'); +assert.sameValue(false !== -1n, true, 'The result of (false !== -1n) is true'); +assert.sameValue(-1n !== true, true, 'The result of (-1n !== true) is true'); +assert.sameValue(true !== -1n, true, 'The result of (true !== -1n) is true'); +assert.sameValue(0n !== false, true, 'The result of (0n !== false) is true'); +assert.sameValue(false !== 0n, true, 'The result of (false !== 0n) is true'); +assert.sameValue(0n !== true, true, 'The result of (0n !== true) is true'); +assert.sameValue(true !== 0n, true, 'The result of (true !== 0n) is true'); +assert.sameValue(1n !== false, true, 'The result of (1n !== false) is true'); +assert.sameValue(false !== 1n, true, 'The result of (false !== 1n) is true'); +assert.sameValue(1n !== true, true, 'The result of (1n !== true) is true'); +assert.sameValue(true !== 1n, true, 'The result of (true !== 1n) is true'); +assert.sameValue(2n !== false, true, 'The result of (2n !== false) is true'); +assert.sameValue(false !== 2n, true, 'The result of (false !== 2n) is true'); +assert.sameValue(2n !== true, true, 'The result of (2n !== true) is true'); +assert.sameValue(true !== 2n, true, 'The result of (true !== 2n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..12f2b4cdd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and miscellaneous primitive values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt, Symbol] +---*/ +assert.sameValue(0n !== undefined, true, 'The result of (0n !== undefined) is true'); +assert.sameValue(undefined !== 0n, true, 'The result of (undefined !== 0n) is true'); +assert.sameValue(1n !== undefined, true, 'The result of (1n !== undefined) is true'); +assert.sameValue(undefined !== 1n, true, 'The result of (undefined !== 1n) is true'); +assert.sameValue(0n !== null, true, 'The result of (0n !== null) is true'); +assert.sameValue(null !== 0n, true, 'The result of (null !== 0n) is true'); +assert.sameValue(1n !== null, true, 'The result of (1n !== null) is true'); +assert.sameValue(null !== 1n, true, 'The result of (null !== 1n) is true'); +assert.sameValue(0n !== Symbol('1'), true, 'The result of (0n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 0n, true, 'The result of (Symbol("1") !== 0n) is true'); +assert.sameValue(1n !== Symbol('1'), true, 'The result of (1n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 1n, true, 'The result of (Symbol("1") !== 1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..4822a94f7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and non-finite Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== Infinity, true, 'The result of (0n !== Infinity) is true'); +assert.sameValue(Infinity !== 0n, true, 'The result of (Infinity !== 0n) is true'); +assert.sameValue(1n !== Infinity, true, 'The result of (1n !== Infinity) is true'); +assert.sameValue(Infinity !== 1n, true, 'The result of (Infinity !== 1n) is true'); +assert.sameValue(-1n !== Infinity, true, 'The result of (-1n !== Infinity) is true'); +assert.sameValue(Infinity !== -1n, true, 'The result of (Infinity !== -1n) is true'); +assert.sameValue(0n !== -Infinity, true, 'The result of (0n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 0n, true, 'The result of (-Infinity !== 0n) is true'); +assert.sameValue(1n !== -Infinity, true, 'The result of (1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 1n, true, 'The result of (-Infinity !== 1n) is true'); +assert.sameValue(-1n !== -Infinity, true, 'The result of (-1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== -1n, true, 'The result of (-Infinity !== -1n) is true'); +assert.sameValue(0n !== NaN, true, 'The result of (0n !== NaN) is true'); +assert.sameValue(NaN !== 0n, true, 'The result of (NaN !== 0n) is true'); +assert.sameValue(1n !== NaN, true, 'The result of (1n !== NaN) is true'); +assert.sameValue(NaN !== 1n, true, 'The result of (NaN !== 1n) is true'); +assert.sameValue(-1n !== NaN, true, 'The result of (-1n !== NaN) is true'); +assert.sameValue(NaN !== -1n, true, 'The result of (NaN !== -1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..5fc465a5f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js @@ -0,0 +1,62 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and large Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(1n !== Number.MAX_VALUE, true, 'The result of (1n !== Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE !== 1n, true, 'The result of (Number.MAX_VALUE !== 1n) is true'); + +assert.sameValue( + 1n !== -Number.MAX_VALUE, + true, + 'The result of (1n !== -Number.MAX_VALUE) is true' +); + +assert.sameValue( + -Number.MAX_VALUE !== 1n, + true, + 'The result of (-Number.MAX_VALUE !== 1n) is true' +); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js new file mode 100644 index 0000000000..48c2979a7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js @@ -0,0 +1,52 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== 0, true, 'The result of (0n !== 0) is true'); +assert.sameValue(0 !== 0n, true, 'The result of (0 !== 0n) is true'); +assert.sameValue(0n !== -0, true, 'The result of (0n !== -0) is true'); +assert.sameValue(-0 !== 0n, true, 'The result of (-0 !== 0n) is true'); +assert.sameValue(0n !== 0.000000000001, true, 'The result of (0n !== 0.000000000001) is true'); +assert.sameValue(0.000000000001 !== 0n, true, 'The result of (0.000000000001 !== 0n) is true'); +assert.sameValue(0n !== 1, true, 'The result of (0n !== 1) is true'); +assert.sameValue(1 !== 0n, true, 'The result of (1 !== 0n) is true'); +assert.sameValue(1n !== 0, true, 'The result of (1n !== 0) is true'); +assert.sameValue(0 !== 1n, true, 'The result of (0 !== 1n) is true'); +assert.sameValue(1n !== 0.999999999999, true, 'The result of (1n !== 0.999999999999) is true'); +assert.sameValue(0.999999999999 !== 1n, true, 'The result of (0.999999999999 !== 1n) is true'); +assert.sameValue(1n !== 1, true, 'The result of (1n !== 1) is true'); +assert.sameValue(1 !== 1n, true, 'The result of (1 !== 1n) is true'); +assert.sameValue(0n !== Number.MIN_VALUE, true, 'The result of (0n !== Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE !== 0n, true, 'The result of (Number.MIN_VALUE !== 0n) is true'); + +assert.sameValue( + 0n !== -Number.MIN_VALUE, + true, + 'The result of (0n !== -Number.MIN_VALUE) is true' +); + +assert.sameValue( + -Number.MIN_VALUE !== 0n, + true, + 'The result of (-Number.MIN_VALUE !== 0n) is true' +); + +assert.sameValue( + -10n !== Number.MIN_VALUE, + true, + 'The result of (-10n !== Number.MIN_VALUE) is true' +); + +assert.sameValue( + Number.MIN_VALUE !== -10n, + true, + 'The result of (Number.MIN_VALUE !== -10n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js new file mode 100644 index 0000000000..e273cc7d7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js @@ -0,0 +1,124 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt values and non-primitive objects +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== Object(0n), true, 'The result of (0n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 0n, true, 'The result of (Object(0n) !== 0n) is true'); +assert.sameValue(0n !== Object(1n), true, 'The result of (0n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 0n, true, 'The result of (Object(1n) !== 0n) is true'); +assert.sameValue(1n !== Object(0n), true, 'The result of (1n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 1n, true, 'The result of (Object(0n) !== 1n) is true'); +assert.sameValue(1n !== Object(1n), true, 'The result of (1n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 1n, true, 'The result of (Object(1n) !== 1n) is true'); +assert.sameValue(2n !== Object(0n), true, 'The result of (2n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 2n, true, 'The result of (Object(0n) !== 2n) is true'); +assert.sameValue(2n !== Object(1n), true, 'The result of (2n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 2n, true, 'The result of (Object(1n) !== 2n) is true'); +assert.sameValue(2n !== Object(2n), true, 'The result of (2n !== Object(2n)) is true'); +assert.sameValue(Object(2n) !== 2n, true, 'The result of (Object(2n) !== 2n) is true'); +assert.sameValue(0n !== {}, true, 'The result of (0n !== {}) is true'); +assert.sameValue({} !== 0n, true, 'The result of (({}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 0n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 0n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 0n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 1n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 1n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 1n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '0'; + } +}, true, 'The result of (0n !== {toString: function() {return "0";}}) is true'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} !== 0n, true, 'The result of (({toString: function() {return "0";}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '1'; + } +}, true, 'The result of (0n !== {toString: function() {return "1";}}) is true'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} !== 0n, true, 'The result of (({toString: function() {return "1";}}) !== 0n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099101n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099101n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099101n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099102n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099102n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099102n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099101'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099101";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099101";}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099102'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099102";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099102";}}) !== 900719925474099101n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js new file mode 100644 index 0000000000..d2562ff7a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js @@ -0,0 +1,68 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and String values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== '', true, 'The result of (0n !== "") is true'); +assert.sameValue('' !== 0n, true, 'The result of ("" !== 0n) is true'); +assert.sameValue(0n !== '-0', true, 'The result of (0n !== "-0") is true'); +assert.sameValue('-0' !== 0n, true, 'The result of ("-0" !== 0n) is true'); +assert.sameValue(0n !== '0', true, 'The result of (0n !== "0") is true'); +assert.sameValue('0' !== 0n, true, 'The result of ("0" !== 0n) is true'); +assert.sameValue(0n !== '-1', true, 'The result of (0n !== "-1") is true'); +assert.sameValue('-1' !== 0n, true, 'The result of ("-1" !== 0n) is true'); +assert.sameValue(0n !== '1', true, 'The result of (0n !== "1") is true'); +assert.sameValue('1' !== 0n, true, 'The result of ("1" !== 0n) is true'); +assert.sameValue(0n !== 'foo', true, 'The result of (0n !== "foo") is true'); +assert.sameValue('foo' !== 0n, true, 'The result of ("foo" !== 0n) is true'); +assert.sameValue(1n !== '', true, 'The result of (1n !== "") is true'); +assert.sameValue('' !== 1n, true, 'The result of ("" !== 1n) is true'); +assert.sameValue(1n !== '-0', true, 'The result of (1n !== "-0") is true'); +assert.sameValue('-0' !== 1n, true, 'The result of ("-0" !== 1n) is true'); +assert.sameValue(1n !== '0', true, 'The result of (1n !== "0") is true'); +assert.sameValue('0' !== 1n, true, 'The result of ("0" !== 1n) is true'); +assert.sameValue(1n !== '-1', true, 'The result of (1n !== "-1") is true'); +assert.sameValue('-1' !== 1n, true, 'The result of ("-1" !== 1n) is true'); +assert.sameValue(1n !== '1', true, 'The result of (1n !== "1") is true'); +assert.sameValue('1' !== 1n, true, 'The result of ("1" !== 1n) is true'); +assert.sameValue(1n !== 'foo', true, 'The result of (1n !== "foo") is true'); +assert.sameValue('foo' !== 1n, true, 'The result of ("foo" !== 1n) is true'); +assert.sameValue(-1n !== '-', true, 'The result of (-1n !== "-") is true'); +assert.sameValue('-' !== -1n, true, 'The result of ("-" !== -1n) is true'); +assert.sameValue(-1n !== '-0', true, 'The result of (-1n !== "-0") is true'); +assert.sameValue('-0' !== -1n, true, 'The result of ("-0" !== -1n) is true'); +assert.sameValue(-1n !== '-1', true, 'The result of (-1n !== "-1") is true'); +assert.sameValue('-1' !== -1n, true, 'The result of ("-1" !== -1n) is true'); +assert.sameValue(-1n !== '-foo', true, 'The result of (-1n !== "-foo") is true'); +assert.sameValue('-foo' !== -1n, true, 'The result of ("-foo" !== -1n) is true'); + +assert.sameValue( + 900719925474099101n !== '900719925474099101', + true, + 'The result of (900719925474099101n !== "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' !== 900719925474099101n, + true, + 'The result of ("900719925474099101" !== 900719925474099101n) is true' +); + +assert.sameValue( + 900719925474099102n !== '900719925474099101', + true, + 'The result of (900719925474099102n !== "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' !== 900719925474099102n, + true, + 'The result of ("900719925474099101" !== 900719925474099102n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js |