diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/does-not-equals')
40 files changed, 1688 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js new file mode 100644 index 0000000000..f7d9b7b8da --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("true\u0009!=\u00091") !== false) { + throw new Test262Error('#1: (true\\u0009!=\\u00091) === false'); +} + +//CHECK#2 +if (eval("true\u000B!=\u000B1") !== false) { + throw new Test262Error('#2: (true\\u000B!=\\u000B1) === false'); +} + +//CHECK#3 +if (eval("true\u000C!=\u000C1") !== false) { + throw new Test262Error('#3: (true\\u000C!=\\u000C1) === false'); +} + +//CHECK#4 +if (eval("true\u0020!=\u00201") !== false) { + throw new Test262Error('#4: (true\\u0020!=\\u00201) === false'); +} + +//CHECK#5 +if (eval("true\u00A0!=\u00A01") !== false) { + throw new Test262Error('#5: (true\\u00A0!=\\u00A01) === false'); +} + +//CHECK#6 +if (eval("true\u000A!=\u000A1") !== false) { + throw new Test262Error('#6: (true\\u000A!=\\u000A1) === false'); +} + +//CHECK#7 +if (eval("true\u000D!=\u000D1") !== false) { + throw new Test262Error('#7: (true\\u000D!=\\u000D1) === false'); +} + +//CHECK#8 +if (eval("true\u2028!=\u20281") !== false) { + throw new Test262Error('#8: (true\\u2028!=\\u20281) === false'); +} + +//CHECK#9 +if (eval("true\u2029!=\u20291") !== false) { + throw new Test262Error('#9: (true\\u2029!=\\u20291) === false'); +} + +//CHECK#10 +if (eval("true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029!=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== false) { + throw new Test262Error('#10: (true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029!=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js new file mode 100644 index 0000000000..83cd3fdae0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 != 1) !== false) { + throw new Test262Error('#1: (1 != 1) === false'); +} + +//CHECK#2 +var x = 1; +if ((x != 1) !== false) { + throw new Test262Error('#2: var x = 1; (x != 1) === false'); +} + +//CHECK#3 +var y = 1; +if ((1 != y) !== false) { + throw new Test262Error('#3: var y = 1; (1 != y) === false'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if ((x != y) !== false) { + throw new Test262Error('#4: var x = 1; var y = 1; (x != y) === false'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if ((objectx.prop != objecty.prop) !== false) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop != objecty.prop) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js new file mode 100644 index 0000000000..e50becd278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_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/does-not-equals/S11.9.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T3.js new file mode 100644 index 0000000000..3d5d100b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.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. + +/*--- +info: Operator x != y uses GetValue +es5id: 11.9.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 != y; + throw new Test262Error('#1: 1 != y throw ReferenceError'); +} +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/does-not-equals/S11.9.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T1.js new file mode 100644 index 0000000000..3b5a67dd47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if (((x = 1) != x) !== false) { + throw new Test262Error('#1: var x = 0; ((x = 1) != x) === false'); +} + +//CHECK#2 +var x = 0; +if ((x != (x = 1)) !== true) { + throw new Test262Error('#2: var x = 0; (x != (x = 1)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js new file mode 100644 index 0000000000..e18e52e742 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.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. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.2_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/does-not-equals/S11.9.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T3.js new file mode 100644 index 0000000000..389dfc696e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A2.4_T3 +description: Checking with 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/does-not-equals/S11.9.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T4.js new file mode 100644 index 0000000000..be2b60cd1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if (((y = 1) != y) !== false) { + throw new Test262Error('#1: ((y = 1) != y) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js new file mode 100644 index 0000000000..65a29aa8d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.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: | + Return false, if x and y are both true or both false; otherwise, return + true +es5id: 11.9.2_A3.1 +description: x and y are boolean primitives +---*/ + +//CHECK#1 +if ((true != true) !== false) { + throw new Test262Error('#1: (true != true) === false'); +} + +//CHECK#2 +if ((false != false) !== false) { + throw new Test262Error('#2: (false != false) === false'); +} + +//CHECK#3 +if ((true != false) !== true) { + throw new Test262Error('#3: (true != false) === true'); +} + +//CHECK#4 +if ((false != true) !== true) { + throw new Test262Error('#4: (false != true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js new file mode 100644 index 0000000000..e01b897d11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.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: | + If Type(x) is Boolean and Type(y) is Number, + return the result of comparison ToNumber(x) != y +es5id: 11.9.2_A3.2 +description: x is primitive boolean, y is primitive number +---*/ + +//CHECK#1 +if ((true != 1) !== false) { + throw new Test262Error('#1: (true != 1) === false'); +} + +//CHECK#2 +if ((false != "0") !== false) { + throw new Test262Error('#2: (false != "0") === false'); +} + +//CHECK#3 +if ((true != new Boolean(true)) !== false) { + throw new Test262Error('#3: (true != new Boolean(true)) === false'); +} + +//CHECK#4 +if ((true != {valueOf: function () {return 1}}) !== false) { + throw new Test262Error('#4: (true != {valueOf: function () {return 1}}) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js new file mode 100644 index 0000000000..f8446ea92e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.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: | + If Type(y) is Number and Type(y) is Boolean, + return the result of comparison x != ToNumber(y) +es5id: 11.9.2_A3.3 +description: x is primitive number, y is primitive boolean +---*/ + +//CHECK#1 +if ((0 != false) !== false) { + throw new Test262Error('#1: (0 != false) === false'); +} + +//CHECK#2 +if (("1" != true) !== false) { + throw new Test262Error('#2: ("1" != true) === false'); +} + +//CHECK#3 +if ((new Boolean(false) != false) !== false) { + throw new Test262Error('#3: (new Boolean(false) != false) === false'); +} + +//CHECK#4 +if (({valueOf: function () {return "0"}} != false) !== false) { + throw new Test262Error('#4: ({valueOf: function () {return "0"}} != false) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js new file mode 100644 index 0000000000..bf3ecb1c03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if ((Number.NaN != true) !== true) { + throw new Test262Error('#1: (NaN != true) === true'); +} + +//CHECK#2 +if ((Number.NaN != 1) !== true) { + throw new Test262Error('#2: (NaN != 1) === true'); +} + +//CHECK#3 +if ((Number.NaN != Number.NaN) !== true) { + throw new Test262Error('#3: (NaN != NaN) === true'); +} + +//CHECK#4 +if ((Number.NaN != Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (NaN != +Infinity) === true'); +} + +//CHECK#5 +if ((Number.NaN != Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: (NaN != -Infinity) === true'); +} + +//CHECK#6 +if ((Number.NaN != Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: (NaN != Number.MAX_VALUE) === true'); +} + +//CHECK#7 +if ((Number.NaN != Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: (NaN != Number.MIN_VALUE) === true'); +} + +//CHECK#8 +if ((Number.NaN != "string") !== true) { + throw new Test262Error('#8: (NaN != "string") === true'); +} + +//CHECK#9 +if ((Number.NaN != new Object()) !== true) { + throw new Test262Error('#9: (NaN != new Object()) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js new file mode 100644 index 0000000000..42ea03c030 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if ((true != Number.NaN) !== true) { + throw new Test262Error('#1: (true != NaN) === true'); +} + +//CHECK#2 +if ((-1 != Number.NaN) !== true) { + throw new Test262Error('#2: (-1 != NaN) === true'); +} + +//CHECK#3 +if ((Number.NaN != Number.NaN) !== true) { + throw new Test262Error('#3: (NaN != NaN) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY != Number.NaN) !== true) { + throw new Test262Error('#4: (+Infinity != NaN) === true'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY != Number.NaN) !== true) { + throw new Test262Error('#5: (-Infinity != NaN) === true'); +} + +//CHECK#6 +if ((Number.MAX_VALUE != Number.NaN) !== true) { + throw new Test262Error('#6: (Number.MAX_VALUE != NaN) === true'); +} + +//CHECK#7 +if ((Number.MIN_VALUE != Number.NaN) !== true) { + throw new Test262Error('#7: (Number.MIN_VALUE != NaN) === true'); +} + +//CHECK#8 +if (("string" != Number.NaN) !== true) { + throw new Test262Error('#8: ("string" != NaN) === true'); +} + +//CHECK#9 +if ((new Object() != Number.NaN) !== true) { + throw new Test262Error('#9: (new Object() != NaN) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js new file mode 100644 index 0000000000..3c421659f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_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.2_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((+0 != -0) !== false) { + throw new Test262Error('#1: (+0 != -0) === false'); +} + +//CHECK#2 +if ((-0 != +0) !== false) { + throw new Test262Error('#2: (-0 != +0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js new file mode 100644 index 0000000000..4c867fb43b --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.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 Number-s minus NaN, +0, -0. + Return false, if x is the same number value as y; otherwise, return true +es5id: 11.9.2_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: (+Infinity != +Infinity) === false'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#2: (-Infinity != -Infinity) === false'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY != -Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#3: (+Infinity != -(-Infinity)) === false'); +} + +//CHECK#4 +if ((1 != 0.999999999999) !== true) { + throw new Test262Error('#4: (1 != 0.999999999999) === true'); +} + +//CHECK#5 +if ((1.0 != 1) !== false) { + throw new Test262Error('#5: (1.0 != 1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js new file mode 100644 index 0000000000..69ac924ba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js @@ -0,0 +1,47 @@ +// 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 true, if x and y are exactly the same sequence of characters; otherwise, return false +es5id: 11.9.2_A5.1 +description: x and y are primitive strings +---*/ + +//CHECK#1 +if (("" != "") !== false) { + throw new Test262Error('#1: ("" != "") === false'); +} + +//CHECK#2 +if ((" " != " ") !== false) { + throw new Test262Error('#2: " (" != " ") === false'); +} + +//CHECK#3 +if ((" " != "") !== true) { + throw new Test262Error('#3: " (" != "") === true'); +} + +//CHECK#4 +if (("string" != "string") !== false) { + throw new Test262Error('#4: ("string" != "string") === false'); +} + +//CHECK#5 +if ((" string" != "string ") !== true) { + throw new Test262Error('#5: (" string" != "string ") === true'); +} + +//CHECK#6 +if (("1.0" != "1") !== true) { + throw new Test262Error('#6: ("1.0" != "1") === true'); +} + +//CHECK#7 +if (("0xff" != "255") !== true) { + throw new Test262Error('#7: ("0xff" != "255") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js new file mode 100644 index 0000000000..2628bf504a --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.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: | + If Type(x) is Number and Type(y) is String, + return the result of comparison x != ToNumber(y) +es5id: 11.9.2_A5.2 +description: x is primitive number, y is primitive string +---*/ + +//CHECK#1 +if ((1 != "1") !== false) { + throw new Test262Error('#1: (1 != "1") === false'); +} + +//CHECK#2 +if ((1.100 != "+1.10") !== false) { + throw new Test262Error('#2: (1.100 != "+1.10") === false'); +} + +//CHECK#3 +if ((1 != "true") !== true) { + throw new Test262Error('#3: (1 != "true") === true'); +} + +//CHECK#4 +if ((255 != "0xff") !== false) { + throw new Test262Error('#4: (255 != "0xff") === false'); +} + +//CHECK#5 +if ((0 != "") !== false) { + throw new Test262Error('#5: (0 != "") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js new file mode 100644 index 0000000000..2c9d3a33fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.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: | + If Type(x) is String and Type(y) is Number, + return the result of comparison ToNumber(x) != y +es5id: 11.9.2_A5.3 +description: x is primitive string, y is primitive number +---*/ + +//CHECK#1 +if (("-1" != -1) !== false) { + throw new Test262Error('#1: ("-1" != -1) === false'); +} + +//CHECK#2 +if (("-1.100" != -1.10) !== false) { + throw new Test262Error('#2: ("-1.100" != -1.10) === false'); +} + +//CHECK#3 +if (("false" != 0) !== true) { + throw new Test262Error('#3: ("false" != 0) === true'); +} + +//CHECK#4 +if (("5e-324" != 5e-324) !== false) { + throw new Test262Error('#4: ("5e-324" != 5e-324) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js new file mode 100644 index 0000000000..bda4c962e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) as well as Type(y) is Undefined or Null, return true +es5id: 11.9.2_A6.1 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((undefined != undefined) !== false) { + throw new Test262Error('#1: (undefined != undefined) === false'); +} + +//CHECK#2 +if ((void 0 != undefined) !== false) { + throw new Test262Error('#2: (void 0 != undefined) === false'); +} + +//CHECK#3 +if ((undefined != eval("var x")) !== false) { + throw new Test262Error('#3: (undefined != eval("var x")) === false'); +} + +//CHECK#4 +if ((undefined != null) !== false) { + throw new Test262Error('#4: (undefined != null) === false'); +} + +//CHECK#5 +if ((null != void 0) !== false) { + throw new Test262Error('#5: (null != void 0) === false'); +} + +//CHECK#6 +if ((null != null) !== false) { + throw new Test262Error('#6: (null != null) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js new file mode 100644 index 0000000000..16f9e70b00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.2_A6.2_T1 +description: x is null or undefined, y is not +---*/ + +//CHECK#1 +if ((undefined != true) !== true) { + throw new Test262Error('#1: (undefined != true) === true'); +} + +//CHECK#2 +if ((undefined != 0) !== true) { + throw new Test262Error('#2: (undefined != 0) === true'); +} + +//CHECK#3 +if ((undefined != "undefined") !== true) { + throw new Test262Error('#3: (undefined != "undefined") === true'); +} + +//CHECK#4 +if ((undefined != {}) !== true) { + throw new Test262Error('#4: (undefined != {}) === true'); +} + +//CHECK#5 +if ((null != false) !== true) { + throw new Test262Error('#5: (null != false) === true'); +} + +//CHECK#6 +if ((null != 0) !== true) { + throw new Test262Error('#6: (null != 0) === true'); +} + +//CHECK#7 +if ((null != "null") !== true) { + throw new Test262Error('#7: (null != "null") === true'); +} + +//CHECK#8 +if ((null != {}) !== true) { + throw new Test262Error('#8: (null != {}) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js new file mode 100644 index 0000000000..563edcb2ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.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. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.2_A6.2_T2 +description: y is null or undefined, x is not +---*/ + +//CHECK#1 +if ((false != undefined) !== true) { + throw new Test262Error('#1: (false != undefined) === true'); +} + +//CHECK#2 +if ((Number.NaN != undefined) !== true) { + throw new Test262Error('#2: (Number.NaN != undefined) === true'); +} + +//CHECK#3 +if (("undefined" != undefined) !== true) { + throw new Test262Error('#3: ("undefined" != undefined) === true'); +} + +//CHECK#4 +if (({} != undefined) !== true) { + throw new Test262Error('#4: ({} != undefined) === true'); +} + +//CHECK#5 +if ((false != null) !== true) { + throw new Test262Error('#5: (false != null) === true'); +} + +//CHECK#6 +if ((0 != null) !== true) { + throw new Test262Error('#6: (0 != null) === true'); +} + +//CHECK#7 +if (("null" != null) !== true) { + throw new Test262Error('#7: ("null" != null) === true'); +} + +//CHECK#8 +if (({} != null) !== true) { + throw new Test262Error('#8: ({} != null) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js new file mode 100644 index 0000000000..5a71fe993d --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.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 true, if x and y are references to the same Object; otherwise, return false +es5id: 11.9.2_A7.1 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if ((new Boolean(true) != new Boolean(true)) !== true) { + throw new Test262Error('#1: (new Boolean(true) != new Boolean(true)) === true'); +} + +//CHECK#2 +if ((new Number(1) != new Number(1)) !== true) { + throw new Test262Error('#2: (new Number(1) != new Number(1)) === true'); +} + +//CHECK#3 +if ((new String("x") != new String("x")) !== true) { + throw new Test262Error('#3: (new String("x") != new String("x")) === true'); +} + +//CHECK#4 +if ((new Object() != new Object()) !== true) { + throw new Test262Error('#4: (new Object() != new Object()) === true'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if ((x != y) !== false) { + throw new Test262Error('#5: x = {}; y = x; (x != y) === false'); +} + +//CHECK#6 +if ((new Boolean(true) != new Number(1)) !== true) { + throw new Test262Error('#6 (new Boolean(true) != new Number(1)) === true'); +} + +//CHECK#7 +if ((new Number(1) != new String("1")) !== true) { + throw new Test262Error('#7: (new Number(1) != new String("1")) === true'); +} + +//CHECK#8 +if ((new String("1") != new Boolean(true)) !== true) { + throw new Test262Error('#8: (new String("x") != new Boolean(true)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js new file mode 100644 index 0000000000..59f12daec2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is Boolean, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.2 +description: x is object, y is primitive boolean +---*/ + +//CHECK#1 +if ((new Boolean(true) != true) !== false) { + throw new Test262Error('#1: (new Boolean(true) != true) === false'); +} + +//CHECK#2 +if ((new Number(1) != true) !== false) { + throw new Test262Error('#2: (new Number(1) != true) === false'); +} + +//CHECK#3 +if ((new String("1") != true) !== false) { + throw new Test262Error('#3: (new String("1") != true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js new file mode 100644 index 0000000000..7c7f876f5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.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. + +/*--- +info: | + If Type(x) is Boolean and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.3 +description: y is object, x is primitive boolean +---*/ + +//CHECK#1 +if ((true != new Boolean(true)) !== false) { + throw new Test262Error('#1: (true != new Boolean(true)) === false'); +} + +//CHECK#2 +if ((true != new Number(1)) !== false) { + throw new Test262Error('#2: (true != new Number(1)) === false'); +} + +//CHECK#3 +if ((true != new String("+1")) !== false) { + throw new Test262Error('#3: (true != new String("+1")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js new file mode 100644 index 0000000000..1f330ca59e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.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. + +/*--- +info: | + If Type(x) is Object and Type(y) is Number, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.4 +description: x is object, y is primitive number +---*/ + +//CHECK#1 +if ((new Boolean(true) != 1) !== false) { + throw new Test262Error('#1: (new Boolean(true) != 1) === false'); +} + +//CHECK#2 +if ((new Number(-1) != -1) !== false) { + throw new Test262Error('#2: (new Number(-1) != -1) === false'); +} + +//CHECK#3 +if ((new String("-1") != -1) !== false) { + throw new Test262Error('#3: (new String("-1") != -1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js new file mode 100644 index 0000000000..769c4df786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Number and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.5 +description: y is object, x is primitive number +---*/ + +//CHECK#1 +if ((1 != new Boolean(true)) !== false) { + throw new Test262Error('#1: (1 != new Boolean(true)) === false'); +} + +//CHECK#2 +if ((-1 != new Number(-1)) !== false) { + throw new Test262Error('#2: (-1 != new Number(-1)) === false'); +} + +//CHECK#3 +if ((-1 != new String("-1")) !== false) { + throw new Test262Error('#3: (-1 != new String("-1")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js new file mode 100644 index 0000000000..e7a9173c35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.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. + +/*--- +info: | + If Type(x) is Object and Type(y) is String, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.6 +description: x is object, y is primitive string +---*/ + +//CHECK#1 +if ((new Boolean(true) != "1") !== false) { + throw new Test262Error('#1: (new Boolean(true) != "1") === false'); +} + +//CHECK#2 +if ((new Number(-1) != "-1") !== false) { + throw new Test262Error('#2: (new Number(-1) != "-1") === false'); +} + +//CHECK#3 +if ((new String("x") != "x") !== false) { + throw new Test262Error('#3: (new String("x") != "x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js new file mode 100644 index 0000000000..ed94e09700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.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. + +/*--- +info: | + If Type(x) is String and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.7 +description: y is object, x is primitive string +---*/ + +//CHECK#1 +if (("1" != new Boolean(true)) !== false) { + throw new Test262Error('#1: ("1" != new Boolean(true)) === false'); +} + +//CHECK#2 +if (("-1" != new Number(-1)) !== false) { + throw new Test262Error('#2: ("-1" != new Number(-1)) === false'); +} + +//CHECK#3 +if (("x" != new String("x")) !== false) { + throw new Test262Error('#3: ("x" != new String("x")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js new file mode 100644 index 0000000000..307604cf20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is primitive type, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.8 +description: x is object, y is primtitive +---*/ + +//CHECK#1 +if ((true != {valueOf: function() {return 1}}) !== false) { + throw new Test262Error('#1: (true != {valueOf: function() {return 1}}) === false'); +} + +//CHECK#2 +if ((1 != {valueOf: function() {return 1}, toString: function() {return 0}}) !== false) { + throw new Test262Error('#2: (1 != {valueOf: function() {return 1}, toString: function() {return 0}}) === false'); +} + +//CHECK#3 +if (("+1" != {valueOf: function() {return 1}, toString: function() {return {}}}) !== false) { + throw new Test262Error('#3: ("+1" != {valueOf: function() {return 1}, toString: function() {return {}}}) === false'); +} + +//CHECK#4 +try { + if ((true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) !== false) { + throw new Test262Error('#4.1: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) === false'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw "error"'); + } else { + throw new Test262Error('#4.3: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((1 != {toString: function() {return "+1"}}) !== false) { + throw new Test262Error('#5: (1 != {toString: function() {return "+1"}}) === false'); +} + +//CHECK#6 +if (("1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== true) { + throw new Test262Error('#6.1: ("1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) === true'); +} else { + if (("+1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== false) { + throw new Test262Error('#6.2: ("+1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) === false'); + } +} + +//CHECK#7 +try { + (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}); + throw new Test262Error('#7: (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error"'); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7: (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error"'); + } +} + +//CHECK#8 +try { + (1 != {valueOf: function() {return {}}, toString: function() {return {}}}); + throw new Test262Error('#8: (1 != {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8: (1 != {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js new file mode 100644 index 0000000000..7d5d9a2fa8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is primitive type and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.9 +description: y is object, x is primtitive +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} != true) !== false) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} != true) === false'); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} != 1) !== false) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} != 1) === false'); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} != "+1") !== false) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} != "+1") === false'); +} + +//CHECK#4 +try { + if (({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) !== false) { + throw new Test262Error('#4.1: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) === false'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (({toString: function() {return "+1"}} != 1) !== false) { + throw new Test262Error('#5: ({toString: function() {return "+1"}} != 1) === false'); +} + +//CHECK#6 +if (({valueOf: function() {return {}}, toString: function() {return "+1"}} != "1") !== true) { + throw new Test262Error('#6.1: ({valueOf: function() {return {}}, toString: function() {return "+1"}} != "1") === true'); +} else { + if (({valueOf: function() {return {}}, toString: function() {return "+1"}} != "+1") !== false) { + throw new Test262Error('#6.2: ({valueOf: function() {return {}}, toString: function() {return "+1"}} != "+1") === false'); + } +} + +//CHECK#7 +try { + ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1); + throw new Test262Error('#7.1: ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1) throw "error". Actual: ' + (({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + ({valueOf: function() {return {}}, toString: function() {return {}}} != 1); + throw new Test262Error('#8.1: ({valueOf: function() {return {}}, toString: function() {return {}}} != 1) throw TypeError. Actual: ' + (({valueOf: function() {return {}}, toString: function() {return {}}} != 1))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: ({valueOf: function() {return {}}, toString: function() {return {}}} != 1) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js new file mode 100644 index 0000000000..6d247f6a2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js @@ -0,0 +1,173 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison 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/does-not-equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js new file mode 100644 index 0000000000..56074998a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and Boolean values +esid: sec-abstract-equality-comparison +info: | + 8. If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y. + 9. If Type(y) is Boolean, return the result of the comparison x == ToNumber(y). + ... + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + ... + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise 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, false, 'The result of (0n != false) is false'); +assert.sameValue(false != 0n, false, 'The result of (false != 0n) is false'); +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, false, 'The result of (1n != true) is false'); +assert.sameValue(true != 1n, false, 'The result of (true != 1n) is false'); +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/does-not-equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..d042ba53f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and miscellaneous primitive values +esid: sec-equality-operators-runtime-semantics-evaluation +info: | + EqualityExpression : EqualityExpression != RelationalExpression + ... + 5. Return the result of performing Abstract Equality Comparison rval == lval. + 6. If r is true, return false. Otherwise, return true. + +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/does-not-equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..fece08b149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and non-finite Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + a. If x or y are any of NaN, +∞, or -∞, 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/does-not-equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..471b66fb69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js @@ -0,0 +1,53 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and large Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise 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, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + false, + 'The result of (Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is false' +); + +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/does-not-equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js new file mode 100644 index 0000000000..5c6a12bf8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js @@ -0,0 +1,43 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(0n != 0, false, 'The result of (0n != 0) is false'); +assert.sameValue(0 != 0n, false, 'The result of (0 != 0n) is false'); +assert.sameValue(0n != -0, false, 'The result of (0n != -0) is false'); +assert.sameValue(-0 != 0n, false, 'The result of (-0 != 0n) is false'); +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, false, 'The result of (1n != 1) is false'); +assert.sameValue(1 != 1n, false, 'The result of (1 != 1n) is false'); +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/does-not-equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js new file mode 100644 index 0000000000..8f75671b76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js @@ -0,0 +1,136 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt values and non-primitive objects +esid: sec-abstract-equality-comparison +info: | + 10. If Type(x) is either String, Number, BigInt, or Symbol and Type(y) is Object, return the result of the comparison x == ? ToPrimitive(y). + 11. If Type(x) is Object and Type(y) is either String, Number, BigInt, or Symbol, return the result of the comparison ? ToPrimitive(x) == y. + + then after the recursion: + + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison x === y. + ... + 6. If Type(x) is BigInt and Type(y) is String, + a. Let n be StringToBigInt(y). + b. If n is NaN, return false. + c. Return the result of x == n. + 7. If Type(x) is String and Type(y) is BigInt, return the result of y == x. + +features: [BigInt] +---*/ +assert.sameValue(0n != Object(0n), false, 'The result of (0n != Object(0n)) is false'); +assert.sameValue(Object(0n) != 0n, false, 'The result of (Object(0n) != 0n) is false'); +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), false, 'The result of (1n != Object(1n)) is false'); +assert.sameValue(Object(1n) != 1n, false, 'The result of (Object(1n) != 1n) is false'); +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), false, 'The result of (2n != Object(2n)) is false'); +assert.sameValue(Object(2n) != 2n, false, 'The result of (Object(2n) != 2n) is false'); +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; + } +}, false, 'The result of (0n != {valueOf: function() {return 0n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} != 0n, false, 'The result of (({valueOf: function() {return 0n;}}) != 0n) is false'); + +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'; + } +}, false, 'The result of (0n != {toString: function() {return "0";}}) is false'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} != 0n, false, 'The result of (({toString: function() {return "0";}}) != 0n) is false'); + +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; + } +}, false, 'The result of (900719925474099101n != {valueOf: function() {return 900719925474099101n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} != 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) != 900719925474099101n) is false'); + +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'; + } +}, false, 'The result of (900719925474099101n != {toString: function() {return "900719925474099101";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} != 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) != 900719925474099101n) is false'); + +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/does-not-equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-string.js new file mode 100644 index 0000000000..a16d382ae7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/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: Non-strict inequality comparison of BigInt and String values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n != '', false, 'The result of (0n != "") is false'); +assert.sameValue('' != 0n, false, 'The result of ("" != 0n) is false'); +assert.sameValue(0n != '-0', false, 'The result of (0n != "-0") is false'); +assert.sameValue('-0' != 0n, false, 'The result of ("-0" != 0n) is false'); +assert.sameValue(0n != '0', false, 'The result of (0n != "0") is false'); +assert.sameValue('0' != 0n, false, 'The result of ("0" != 0n) is false'); +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', false, 'The result of (1n != "1") is false'); +assert.sameValue('1' != 1n, false, 'The result of ("1" != 1n) is false'); +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', false, 'The result of (-1n != "-1") is false'); +assert.sameValue('-1' != -1n, false, 'The result of ("-1" != -1n) is false'); +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', + false, + 'The result of (900719925474099101n != "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' != 900719925474099101n, + false, + 'The result of ("900719925474099101" != 900719925474099101n) is false' +); + +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/does-not-equals/browser.js b/js/src/tests/test262/language/expressions/does-not-equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/browser.js diff --git a/js/src/tests/test262/language/expressions/does-not-equals/shell.js b/js/src/tests/test262/language/expressions/does-not-equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/shell.js |