Equality comparison tests for bigint (#1257)

This commit is contained in:
Josh Wolfe 2017-10-04 08:54:00 -07:00 committed by Leo Balter
parent b006e1c7c7
commit 6443289089
32 changed files with 1243 additions and 0 deletions

View File

@ -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 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, "0n != 0n");
assert.sameValue(1n != 1n, false, "1n != 1n");
assert.sameValue(-1n != -1n, false, "-1n != -1n");
assert.sameValue(0n != -0n, false, "0n != -0n");
assert.sameValue(-0n != 0n, false, "-0n != 0n");
assert.sameValue(0n != 1n, true, "0n != 1n");
assert.sameValue(1n != 0n, true, "1n != 0n");
assert.sameValue(0n != -1n, true, "0n != -1n");
assert.sameValue(-1n != 0n, true, "-1n != 0n");
assert.sameValue(1n != -1n, true, "1n != -1n");
assert.sameValue(-1n != 1n, true, "-1n != 1n");
assert.sameValue(0x1fffffffffffff01n != 0x1fffffffffffff01n, false, "0x1fffffffffffff01n != 0x1fffffffffffff01n");
assert.sameValue(0x1fffffffffffff01n != 0x1fffffffffffff02n, true, "0x1fffffffffffff01n != 0x1fffffffffffff02n");
assert.sameValue(0x1fffffffffffff02n != 0x1fffffffffffff01n, true, "0x1fffffffffffff02n != 0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n != -0x1fffffffffffff01n, false, "-0x1fffffffffffff01n != -0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n != -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n != -0x1fffffffffffff02n");
assert.sameValue(-0x1fffffffffffff02n != -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n != -0x1fffffffffffff01n");
assert.sameValue(0x10000000000000000n != 0n, true, "0x10000000000000000n != 0n");
assert.sameValue(0n != 0x10000000000000000n, true, "0n != 0x10000000000000000n");
assert.sameValue(0x10000000000000000n != 1n, true, "0x10000000000000000n != 1n");
assert.sameValue(1n != 0x10000000000000000n, true, "1n != 0x10000000000000000n");
assert.sameValue(0x10000000000000000n != -1n, true, "0x10000000000000000n != -1n");
assert.sameValue(-1n != 0x10000000000000000n, true, "-1n != 0x10000000000000000n");
assert.sameValue(0x10000000000000001n != 0n, true, "0x10000000000000001n != 0n");
assert.sameValue(0n != 0x10000000000000001n, true, "0n != 0x10000000000000001n");
assert.sameValue(-0x10000000000000000n != 0n, true, "-0x10000000000000000n != 0n");
assert.sameValue(0n != -0x10000000000000000n, true, "0n != -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n != 1n, true, "-0x10000000000000000n != 1n");
assert.sameValue(1n != -0x10000000000000000n, true, "1n != -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n != -1n, true, "-0x10000000000000000n != -1n");
assert.sameValue(-1n != -0x10000000000000000n, true, "-1n != -0x10000000000000000n");
assert.sameValue(-0x10000000000000001n != 0n, true, "-0x10000000000000001n != 0n");
assert.sameValue(0n != -0x10000000000000001n, true, "0n != -0x10000000000000001n");
assert.sameValue(0x10000000000000000n != 0x100000000n, true, "0x10000000000000000n != 0x100000000n");
assert.sameValue(0x100000000n != 0x10000000000000000n, true, "0x100000000n != 0x10000000000000000n");

View File

@ -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, "-1n != false");
assert.sameValue(false != -1n, true, "false != -1n");
assert.sameValue(-1n != true, true, "-1n != true");
assert.sameValue(true != -1n, true, "true != -1n");
assert.sameValue(0n != false, false, "0n != false");
assert.sameValue(false != 0n, false, "false != 0n");
assert.sameValue(0n != true, true, "0n != true");
assert.sameValue(true != 0n, true, "true != 0n");
assert.sameValue(1n != false, true, "1n != false");
assert.sameValue(false != 1n, true, "false != 1n");
assert.sameValue(1n != true, false, "1n != true");
assert.sameValue(true != 1n, false, "true != 1n");
assert.sameValue(2n != false, true, "2n != false");
assert.sameValue(false != 2n, true, "false != 2n");
assert.sameValue(2n != true, true, "2n != true");
assert.sameValue(true != 2n, true, "true != 2n");

View File

@ -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, "0n != undefined");
assert.sameValue(undefined != 0n, true, "undefined != 0n");
assert.sameValue(1n != undefined, true, "1n != undefined");
assert.sameValue(undefined != 1n, true, "undefined != 1n");
assert.sameValue(0n != null, true, "0n != null");
assert.sameValue(null != 0n, true, "null != 0n");
assert.sameValue(1n != null, true, "1n != null");
assert.sameValue(null != 1n, true, "null != 1n");
assert.sameValue(0n != Symbol("1"), true, "0n != Symbol(\"1\")");
assert.sameValue(Symbol("1") != 0n, true, "Symbol(\"1\") != 0n");
assert.sameValue(1n != Symbol("1"), true, "1n != Symbol(\"1\")");
assert.sameValue(Symbol("1") != 1n, true, "Symbol(\"1\") != 1n");

View File

@ -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, "0n != Infinity");
assert.sameValue(Infinity != 0n, true, "Infinity != 0n");
assert.sameValue(1n != Infinity, true, "1n != Infinity");
assert.sameValue(Infinity != 1n, true, "Infinity != 1n");
assert.sameValue(-1n != Infinity, true, "-1n != Infinity");
assert.sameValue(Infinity != -1n, true, "Infinity != -1n");
assert.sameValue(0n != -Infinity, true, "0n != -Infinity");
assert.sameValue(-Infinity != 0n, true, "-Infinity != 0n");
assert.sameValue(1n != -Infinity, true, "1n != -Infinity");
assert.sameValue(-Infinity != 1n, true, "-Infinity != 1n");
assert.sameValue(-1n != -Infinity, true, "-1n != -Infinity");
assert.sameValue(-Infinity != -1n, true, "-Infinity != -1n");
assert.sameValue(0n != NaN, true, "0n != NaN");
assert.sameValue(NaN != 0n, true, "NaN != 0n");
assert.sameValue(1n != NaN, true, "1n != NaN");
assert.sameValue(NaN != 1n, true, "NaN != 1n");
assert.sameValue(-1n != NaN, true, "-1n != NaN");
assert.sameValue(NaN != -1n, true, "NaN != -1n");

View File

@ -0,0 +1,41 @@
// 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, "1n != Number.MAX_VALUE");
assert.sameValue(Number.MAX_VALUE != 1n, true, "Number.MAX_VALUE != 1n");
assert.sameValue(1n != -Number.MAX_VALUE, true, "1n != -Number.MAX_VALUE");
assert.sameValue(-Number.MAX_VALUE != 1n, true, "-Number.MAX_VALUE != 1n");
assert.sameValue(
0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE,
true,
"0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,
true,
"Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE,
false,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n,
false,
"Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE,
true,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n,
true,
"Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n");

View File

@ -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 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, "0n != 0");
assert.sameValue(0 != 0n, false, "0 != 0n");
assert.sameValue(0n != -0, false, "0n != -0");
assert.sameValue(-0 != 0n, false, "-0 != 0n");
assert.sameValue(0n != 0.000000000001, true, "0n != 0.000000000001");
assert.sameValue(0.000000000001 != 0n, true, "0.000000000001 != 0n");
assert.sameValue(0n != 1, true, "0n != 1");
assert.sameValue(1 != 0n, true, "1 != 0n");
assert.sameValue(1n != 0, true, "1n != 0");
assert.sameValue(0 != 1n, true, "0 != 1n");
assert.sameValue(1n != 0.999999999999, true, "1n != 0.999999999999");
assert.sameValue(0.999999999999 != 1n, true, "0.999999999999 != 1n");
assert.sameValue(1n != 1, false, "1n != 1");
assert.sameValue(1 != 1n, false, "1 != 1n");
assert.sameValue(0n != Number.MIN_VALUE, true, "0n != Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE != 0n, true, "Number.MIN_VALUE != 0n");
assert.sameValue(0n != -Number.MIN_VALUE, true, "0n != -Number.MIN_VALUE");
assert.sameValue(-Number.MIN_VALUE != 0n, true, "-Number.MIN_VALUE != 0n");
assert.sameValue(-10n != Number.MIN_VALUE, true, "-10n != Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE != -10n, true, "Number.MIN_VALUE != -10n");

View File

@ -0,0 +1,56 @@
// 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, "0n != Object(0n)");
assert.sameValue(Object(0n) != 0n, false, "Object(0n) != 0n");
assert.sameValue(0n != Object(1n), true, "0n != Object(1n)");
assert.sameValue(Object(1n) != 0n, true, "Object(1n) != 0n");
assert.sameValue(1n != Object(0n), true, "1n != Object(0n)");
assert.sameValue(Object(0n) != 1n, true, "Object(0n) != 1n");
assert.sameValue(1n != Object(1n), false, "1n != Object(1n)");
assert.sameValue(Object(1n) != 1n, false, "Object(1n) != 1n");
assert.sameValue(2n != Object(0n), true, "2n != Object(0n)");
assert.sameValue(Object(0n) != 2n, true, "Object(0n) != 2n");
assert.sameValue(2n != Object(1n), true, "2n != Object(1n)");
assert.sameValue(Object(1n) != 2n, true, "Object(1n) != 2n");
assert.sameValue(2n != Object(2n), false, "2n != Object(2n)");
assert.sameValue(Object(2n) != 2n, false, "Object(2n) != 2n");
assert.sameValue(0n != {}, true, "0n != {}");
assert.sameValue({} != 0n, true, "{} != 0n");
assert.sameValue(0n != {valueOf: function() { return 0n; }}, false, "0n != {valueOf: function() { return 0n; }}");
assert.sameValue({valueOf: function() { return 0n; }} != 0n, false, "{valueOf: function() { return 0n; }} != 0n");
assert.sameValue(0n != {valueOf: function() { return 1n; }}, true, "0n != {valueOf: function() { return 1n; }}");
assert.sameValue({valueOf: function() { return 1n; }} != 0n, true, "{valueOf: function() { return 1n; }} != 0n");
assert.sameValue(0n != {toString: function() { return "0"; }}, false, "0n != {toString: function() { return \"0\"; }}");
assert.sameValue({toString: function() { return "0"; }} != 0n, false, "{toString: function() { return \"0\"; }} != 0n");
assert.sameValue(0n != {toString: function() { return "1"; }}, true, "0n != {toString: function() { return \"1\"; }}");
assert.sameValue({toString: function() { return "1"; }} != 0n, true, "{toString: function() { return \"1\"; }} != 0n");
assert.sameValue(900719925474099101n != {valueOf: function() { return 900719925474099101n; }}, false, "900719925474099101n != {valueOf: function() { return 900719925474099101n; }}");
assert.sameValue({valueOf: function() { return 900719925474099101n; }} != 900719925474099101n, false, "{valueOf: function() { return 900719925474099101n; }} != 900719925474099101n");
assert.sameValue(900719925474099101n != {valueOf: function() { return 900719925474099102n; }}, true, "900719925474099101n != {valueOf: function() { return 900719925474099102n; }}");
assert.sameValue({valueOf: function() { return 900719925474099102n; }} != 900719925474099101n, true, "{valueOf: function() { return 900719925474099102n; }} != 900719925474099101n");
assert.sameValue(900719925474099101n != {toString: function() { return "900719925474099101"; }}, false, "900719925474099101n != {toString: function() { return \"900719925474099101\"; }}");
assert.sameValue({toString: function() { return "900719925474099101"; }} != 900719925474099101n, false, "{toString: function() { return \"900719925474099101\"; }} != 900719925474099101n");
assert.sameValue(900719925474099101n != {toString: function() { return "900719925474099102"; }}, true, "900719925474099101n != {toString: function() { return \"900719925474099102\"; }}");
assert.sameValue({toString: function() { return "900719925474099102"; }} != 900719925474099101n, true, "{toString: function() { return \"900719925474099102\"; }} != 900719925474099101n");

View File

@ -0,0 +1,48 @@
// 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, "0n != \"\"");
assert.sameValue("" != 0n, false, "\"\" != 0n");
assert.sameValue(0n != "-0", false, "0n != \"-0\"");
assert.sameValue("-0" != 0n, false, "\"-0\" != 0n");
assert.sameValue(0n != "0", false, "0n != \"0\"");
assert.sameValue("0" != 0n, false, "\"0\" != 0n");
assert.sameValue(0n != "-1", true, "0n != \"-1\"");
assert.sameValue("-1" != 0n, true, "\"-1\" != 0n");
assert.sameValue(0n != "1", true, "0n != \"1\"");
assert.sameValue("1" != 0n, true, "\"1\" != 0n");
assert.sameValue(0n != "foo", true, "0n != \"foo\"");
assert.sameValue("foo" != 0n, true, "\"foo\" != 0n");
assert.sameValue(1n != "", true, "1n != \"\"");
assert.sameValue("" != 1n, true, "\"\" != 1n");
assert.sameValue(1n != "-0", true, "1n != \"-0\"");
assert.sameValue("-0" != 1n, true, "\"-0\" != 1n");
assert.sameValue(1n != "0", true, "1n != \"0\"");
assert.sameValue("0" != 1n, true, "\"0\" != 1n");
assert.sameValue(1n != "-1", true, "1n != \"-1\"");
assert.sameValue("-1" != 1n, true, "\"-1\" != 1n");
assert.sameValue(1n != "1", false, "1n != \"1\"");
assert.sameValue("1" != 1n, false, "\"1\" != 1n");
assert.sameValue(1n != "foo", true, "1n != \"foo\"");
assert.sameValue("foo" != 1n, true, "\"foo\" != 1n");
assert.sameValue(-1n != "-", true, "-1n != \"-\"");
assert.sameValue("-" != -1n, true, "\"-\" != -1n");
assert.sameValue(-1n != "-0", true, "-1n != \"-0\"");
assert.sameValue("-0" != -1n, true, "\"-0\" != -1n");
assert.sameValue(-1n != "-1", false, "-1n != \"-1\"");
assert.sameValue("-1" != -1n, false, "\"-1\" != -1n");
assert.sameValue(-1n != "-foo", true, "-1n != \"-foo\"");
assert.sameValue("-foo" != -1n, true, "\"-foo\" != -1n");
assert.sameValue(900719925474099101n != "900719925474099101", false, "900719925474099101n != \"900719925474099101\"");
assert.sameValue("900719925474099101" != 900719925474099101n, false, "\"900719925474099101\" != 900719925474099101n");
assert.sameValue(900719925474099102n != "900719925474099101", true, "900719925474099102n != \"900719925474099101\"");
assert.sameValue("900719925474099101" != 900719925474099102n, true, "\"900719925474099101\" != 900719925474099102n");

View File

@ -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 equality 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, true, "0n == 0n");
assert.sameValue(1n == 1n, true, "1n == 1n");
assert.sameValue(-1n == -1n, true, "-1n == -1n");
assert.sameValue(0n == -0n, true, "0n == -0n");
assert.sameValue(-0n == 0n, true, "-0n == 0n");
assert.sameValue(0n == 1n, false, "0n == 1n");
assert.sameValue(1n == 0n, false, "1n == 0n");
assert.sameValue(0n == -1n, false, "0n == -1n");
assert.sameValue(-1n == 0n, false, "-1n == 0n");
assert.sameValue(1n == -1n, false, "1n == -1n");
assert.sameValue(-1n == 1n, false, "-1n == 1n");
assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff01n, true, "0x1fffffffffffff01n == 0x1fffffffffffff01n");
assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff02n, false, "0x1fffffffffffff01n == 0x1fffffffffffff02n");
assert.sameValue(0x1fffffffffffff02n == 0x1fffffffffffff01n, false, "0x1fffffffffffff02n == 0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff01n, true, "-0x1fffffffffffff01n == -0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n == -0x1fffffffffffff02n");
assert.sameValue(-0x1fffffffffffff02n == -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n == -0x1fffffffffffff01n");
assert.sameValue(0x10000000000000000n == 0n, false, "0x10000000000000000n == 0n");
assert.sameValue(0n == 0x10000000000000000n, false, "0n == 0x10000000000000000n");
assert.sameValue(0x10000000000000000n == 1n, false, "0x10000000000000000n == 1n");
assert.sameValue(1n == 0x10000000000000000n, false, "1n == 0x10000000000000000n");
assert.sameValue(0x10000000000000000n == -1n, false, "0x10000000000000000n == -1n");
assert.sameValue(-1n == 0x10000000000000000n, false, "-1n == 0x10000000000000000n");
assert.sameValue(0x10000000000000001n == 0n, false, "0x10000000000000001n == 0n");
assert.sameValue(0n == 0x10000000000000001n, false, "0n == 0x10000000000000001n");
assert.sameValue(-0x10000000000000000n == 0n, false, "-0x10000000000000000n == 0n");
assert.sameValue(0n == -0x10000000000000000n, false, "0n == -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n == 1n, false, "-0x10000000000000000n == 1n");
assert.sameValue(1n == -0x10000000000000000n, false, "1n == -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n == -1n, false, "-0x10000000000000000n == -1n");
assert.sameValue(-1n == -0x10000000000000000n, false, "-1n == -0x10000000000000000n");
assert.sameValue(-0x10000000000000001n == 0n, false, "-0x10000000000000001n == 0n");
assert.sameValue(0n == -0x10000000000000001n, false, "0n == -0x10000000000000001n");
assert.sameValue(0x10000000000000000n == 0x100000000n, false, "0x10000000000000000n == 0x100000000n");
assert.sameValue(0x100000000n == 0x10000000000000000n, false, "0x100000000n == 0x10000000000000000n");

View File

@ -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 equality 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, false, "-1n == false");
assert.sameValue(false == -1n, false, "false == -1n");
assert.sameValue(-1n == true, false, "-1n == true");
assert.sameValue(true == -1n, false, "true == -1n");
assert.sameValue(0n == false, true, "0n == false");
assert.sameValue(false == 0n, true, "false == 0n");
assert.sameValue(0n == true, false, "0n == true");
assert.sameValue(true == 0n, false, "true == 0n");
assert.sameValue(1n == false, false, "1n == false");
assert.sameValue(false == 1n, false, "false == 1n");
assert.sameValue(1n == true, true, "1n == true");
assert.sameValue(true == 1n, true, "true == 1n");
assert.sameValue(2n == false, false, "2n == false");
assert.sameValue(false == 2n, false, "false == 2n");
assert.sameValue(2n == true, false, "2n == true");
assert.sameValue(true == 2n, false, "true == 2n");

View File

@ -0,0 +1,26 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Non-strict equality 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.
features: [BigInt, Symbol]
---*/
assert.sameValue(0n == undefined, false, "0n == undefined");
assert.sameValue(undefined == 0n, false, "undefined == 0n");
assert.sameValue(1n == undefined, false, "1n == undefined");
assert.sameValue(undefined == 1n, false, "undefined == 1n");
assert.sameValue(0n == null, false, "0n == null");
assert.sameValue(null == 0n, false, "null == 0n");
assert.sameValue(1n == null, false, "1n == null");
assert.sameValue(null == 1n, false, "null == 1n");
assert.sameValue(0n == Symbol("1"), false, "0n == Symbol(\"1\")");
assert.sameValue(Symbol("1") == 0n, false, "Symbol(\"1\") == 0n");
assert.sameValue(1n == Symbol("1"), false, "1n == Symbol(\"1\")");
assert.sameValue(Symbol("1") == 1n, false, "Symbol(\"1\") == 1n");

View File

@ -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 equality 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, false, "0n == Infinity");
assert.sameValue(Infinity == 0n, false, "Infinity == 0n");
assert.sameValue(1n == Infinity, false, "1n == Infinity");
assert.sameValue(Infinity == 1n, false, "Infinity == 1n");
assert.sameValue(-1n == Infinity, false, "-1n == Infinity");
assert.sameValue(Infinity == -1n, false, "Infinity == -1n");
assert.sameValue(0n == -Infinity, false, "0n == -Infinity");
assert.sameValue(-Infinity == 0n, false, "-Infinity == 0n");
assert.sameValue(1n == -Infinity, false, "1n == -Infinity");
assert.sameValue(-Infinity == 1n, false, "-Infinity == 1n");
assert.sameValue(-1n == -Infinity, false, "-1n == -Infinity");
assert.sameValue(-Infinity == -1n, false, "-Infinity == -1n");
assert.sameValue(0n == NaN, false, "0n == NaN");
assert.sameValue(NaN == 0n, false, "NaN == 0n");
assert.sameValue(1n == NaN, false, "1n == NaN");
assert.sameValue(NaN == 1n, false, "NaN == 1n");
assert.sameValue(-1n == NaN, false, "-1n == NaN");
assert.sameValue(NaN == -1n, false, "NaN == -1n");

View File

@ -0,0 +1,41 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Non-strict equality 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, false, "1n == Number.MAX_VALUE");
assert.sameValue(Number.MAX_VALUE == 1n, false, "Number.MAX_VALUE == 1n");
assert.sameValue(1n == -Number.MAX_VALUE, false, "1n == -Number.MAX_VALUE");
assert.sameValue(-Number.MAX_VALUE == 1n, false, "-Number.MAX_VALUE == 1n");
assert.sameValue(
0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE,
false,
"0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,
false,
"Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE,
true,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n,
true,
"Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE,
false,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n,
false,
"Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n");

View File

@ -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 equality 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, true, "0n == 0");
assert.sameValue(0 == 0n, true, "0 == 0n");
assert.sameValue(0n == -0, true, "0n == -0");
assert.sameValue(-0 == 0n, true, "-0 == 0n");
assert.sameValue(0n == 0.000000000001, false, "0n == 0.000000000001");
assert.sameValue(0.000000000001 == 0n, false, "0.000000000001 == 0n");
assert.sameValue(0n == 1, false, "0n == 1");
assert.sameValue(1 == 0n, false, "1 == 0n");
assert.sameValue(1n == 0, false, "1n == 0");
assert.sameValue(0 == 1n, false, "0 == 1n");
assert.sameValue(1n == 0.999999999999, false, "1n == 0.999999999999");
assert.sameValue(0.999999999999 == 1n, false, "0.999999999999 == 1n");
assert.sameValue(1n == 1, true, "1n == 1");
assert.sameValue(1 == 1n, true, "1 == 1n");
assert.sameValue(0n == Number.MIN_VALUE, false, "0n == Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE == 0n, false, "Number.MIN_VALUE == 0n");
assert.sameValue(0n == -Number.MIN_VALUE, false, "0n == -Number.MIN_VALUE");
assert.sameValue(-Number.MIN_VALUE == 0n, false, "-Number.MIN_VALUE == 0n");
assert.sameValue(-10n == Number.MIN_VALUE, false, "-10n == Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE == -10n, false, "Number.MIN_VALUE == -10n");

View File

@ -0,0 +1,56 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Non-strict equality 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), true, "0n == Object(0n)");
assert.sameValue(Object(0n) == 0n, true, "Object(0n) == 0n");
assert.sameValue(0n == Object(1n), false, "0n == Object(1n)");
assert.sameValue(Object(1n) == 0n, false, "Object(1n) == 0n");
assert.sameValue(1n == Object(0n), false, "1n == Object(0n)");
assert.sameValue(Object(0n) == 1n, false, "Object(0n) == 1n");
assert.sameValue(1n == Object(1n), true, "1n == Object(1n)");
assert.sameValue(Object(1n) == 1n, true, "Object(1n) == 1n");
assert.sameValue(2n == Object(0n), false, "2n == Object(0n)");
assert.sameValue(Object(0n) == 2n, false, "Object(0n) == 2n");
assert.sameValue(2n == Object(1n), false, "2n == Object(1n)");
assert.sameValue(Object(1n) == 2n, false, "Object(1n) == 2n");
assert.sameValue(2n == Object(2n), true, "2n == Object(2n)");
assert.sameValue(Object(2n) == 2n, true, "Object(2n) == 2n");
assert.sameValue(0n == {}, false, "0n == {}");
assert.sameValue({} == 0n, false, "{} == 0n");
assert.sameValue(0n == {valueOf: function() { return 0n; }}, true, "0n == {valueOf: function() { return 0n; }}");
assert.sameValue({valueOf: function() { return 0n; }} == 0n, true, "{valueOf: function() { return 0n; }} == 0n");
assert.sameValue(0n == {valueOf: function() { return 1n; }}, false, "0n == {valueOf: function() { return 1n; }}");
assert.sameValue({valueOf: function() { return 1n; }} == 0n, false, "{valueOf: function() { return 1n; }} == 0n");
assert.sameValue(0n == {toString: function() { return "0"; }}, true, "0n == {toString: function() { return \"0\"; }}");
assert.sameValue({toString: function() { return "0"; }} == 0n, true, "{toString: function() { return \"0\"; }} == 0n");
assert.sameValue(0n == {toString: function() { return "1"; }}, false, "0n == {toString: function() { return \"1\"; }}");
assert.sameValue({toString: function() { return "1"; }} == 0n, false, "{toString: function() { return \"1\"; }} == 0n");
assert.sameValue(900719925474099101n == {valueOf: function() { return 900719925474099101n; }}, true, "900719925474099101n == {valueOf: function() { return 900719925474099101n; }}");
assert.sameValue({valueOf: function() { return 900719925474099101n; }} == 900719925474099101n, true, "{valueOf: function() { return 900719925474099101n; }} == 900719925474099101n");
assert.sameValue(900719925474099101n == {valueOf: function() { return 900719925474099102n; }}, false, "900719925474099101n == {valueOf: function() { return 900719925474099102n; }}");
assert.sameValue({valueOf: function() { return 900719925474099102n; }} == 900719925474099101n, false, "{valueOf: function() { return 900719925474099102n; }} == 900719925474099101n");
assert.sameValue(900719925474099101n == {toString: function() { return "900719925474099101"; }}, true, "900719925474099101n == {toString: function() { return \"900719925474099101\"; }}");
assert.sameValue({toString: function() { return "900719925474099101"; }} == 900719925474099101n, true, "{toString: function() { return \"900719925474099101\"; }} == 900719925474099101n");
assert.sameValue(900719925474099101n == {toString: function() { return "900719925474099102"; }}, false, "900719925474099101n == {toString: function() { return \"900719925474099102\"; }}");
assert.sameValue({toString: function() { return "900719925474099102"; }} == 900719925474099101n, false, "{toString: function() { return \"900719925474099102\"; }} == 900719925474099101n");

View File

@ -0,0 +1,48 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Non-strict equality 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 == "", true, "0n == \"\"");
assert.sameValue("" == 0n, true, "\"\" == 0n");
assert.sameValue(0n == "-0", true, "0n == \"-0\"");
assert.sameValue("-0" == 0n, true, "\"-0\" == 0n");
assert.sameValue(0n == "0", true, "0n == \"0\"");
assert.sameValue("0" == 0n, true, "\"0\" == 0n");
assert.sameValue(0n == "-1", false, "0n == \"-1\"");
assert.sameValue("-1" == 0n, false, "\"-1\" == 0n");
assert.sameValue(0n == "1", false, "0n == \"1\"");
assert.sameValue("1" == 0n, false, "\"1\" == 0n");
assert.sameValue(0n == "foo", false, "0n == \"foo\"");
assert.sameValue("foo" == 0n, false, "\"foo\" == 0n");
assert.sameValue(1n == "", false, "1n == \"\"");
assert.sameValue("" == 1n, false, "\"\" == 1n");
assert.sameValue(1n == "-0", false, "1n == \"-0\"");
assert.sameValue("-0" == 1n, false, "\"-0\" == 1n");
assert.sameValue(1n == "0", false, "1n == \"0\"");
assert.sameValue("0" == 1n, false, "\"0\" == 1n");
assert.sameValue(1n == "-1", false, "1n == \"-1\"");
assert.sameValue("-1" == 1n, false, "\"-1\" == 1n");
assert.sameValue(1n == "1", true, "1n == \"1\"");
assert.sameValue("1" == 1n, true, "\"1\" == 1n");
assert.sameValue(1n == "foo", false, "1n == \"foo\"");
assert.sameValue("foo" == 1n, false, "\"foo\" == 1n");
assert.sameValue(-1n == "-", false, "-1n == \"-\"");
assert.sameValue("-" == -1n, false, "\"-\" == -1n");
assert.sameValue(-1n == "-0", false, "-1n == \"-0\"");
assert.sameValue("-0" == -1n, false, "\"-0\" == -1n");
assert.sameValue(-1n == "-1", true, "-1n == \"-1\"");
assert.sameValue("-1" == -1n, true, "\"-1\" == -1n");
assert.sameValue(-1n == "-foo", false, "-1n == \"-foo\"");
assert.sameValue("-foo" == -1n, false, "\"-foo\" == -1n");
assert.sameValue(900719925474099101n == "900719925474099101", true, "900719925474099101n == \"900719925474099101\"");
assert.sameValue("900719925474099101" == 900719925474099101n, true, "\"900719925474099101\" == 900719925474099101n");
assert.sameValue(900719925474099102n == "900719925474099101", false, "900719925474099102n == \"900719925474099101\"");
assert.sameValue("900719925474099101" == 900719925474099102n, false, "\"900719925474099101\" == 900719925474099102n");

View File

@ -0,0 +1,54 @@
// 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, "0n !== 0n");
assert.sameValue(1n !== 1n, false, "1n !== 1n");
assert.sameValue(-1n !== -1n, false, "-1n !== -1n");
assert.sameValue(0n !== -0n, false, "0n !== -0n");
assert.sameValue(-0n !== 0n, false, "-0n !== 0n");
assert.sameValue(0n !== 1n, true, "0n !== 1n");
assert.sameValue(1n !== 0n, true, "1n !== 0n");
assert.sameValue(0n !== -1n, true, "0n !== -1n");
assert.sameValue(-1n !== 0n, true, "-1n !== 0n");
assert.sameValue(1n !== -1n, true, "1n !== -1n");
assert.sameValue(-1n !== 1n, true, "-1n !== 1n");
assert.sameValue(0x1fffffffffffff01n !== 0x1fffffffffffff01n, false, "0x1fffffffffffff01n !== 0x1fffffffffffff01n");
assert.sameValue(0x1fffffffffffff01n !== 0x1fffffffffffff02n, true, "0x1fffffffffffff01n !== 0x1fffffffffffff02n");
assert.sameValue(0x1fffffffffffff02n !== 0x1fffffffffffff01n, true, "0x1fffffffffffff02n !== 0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n !== -0x1fffffffffffff01n, false, "-0x1fffffffffffff01n !== -0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n !== -0x1fffffffffffff02n, true, "-0x1fffffffffffff01n !== -0x1fffffffffffff02n");
assert.sameValue(-0x1fffffffffffff02n !== -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n !== -0x1fffffffffffff01n");
assert.sameValue(0x10000000000000000n !== 0n, true, "0x10000000000000000n !== 0n");
assert.sameValue(0n !== 0x10000000000000000n, true, "0n !== 0x10000000000000000n");
assert.sameValue(0x10000000000000000n !== 1n, true, "0x10000000000000000n !== 1n");
assert.sameValue(1n !== 0x10000000000000000n, true, "1n !== 0x10000000000000000n");
assert.sameValue(0x10000000000000000n !== -1n, true, "0x10000000000000000n !== -1n");
assert.sameValue(-1n !== 0x10000000000000000n, true, "-1n !== 0x10000000000000000n");
assert.sameValue(0x10000000000000001n !== 0n, true, "0x10000000000000001n !== 0n");
assert.sameValue(0n !== 0x10000000000000001n, true, "0n !== 0x10000000000000001n");
assert.sameValue(-0x10000000000000000n !== 0n, true, "-0x10000000000000000n !== 0n");
assert.sameValue(0n !== -0x10000000000000000n, true, "0n !== -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n !== 1n, true, "-0x10000000000000000n !== 1n");
assert.sameValue(1n !== -0x10000000000000000n, true, "1n !== -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n !== -1n, true, "-0x10000000000000000n !== -1n");
assert.sameValue(-1n !== -0x10000000000000000n, true, "-1n !== -0x10000000000000000n");
assert.sameValue(-0x10000000000000001n !== 0n, true, "-0x10000000000000001n !== 0n");
assert.sameValue(0n !== -0x10000000000000001n, true, "0n !== -0x10000000000000001n");
assert.sameValue(0x10000000000000000n !== 0x100000000n, true, "0x10000000000000000n !== 0x100000000n");
assert.sameValue(0x100000000n !== 0x10000000000000000n, true, "0x100000000n !== 0x10000000000000000n");

View File

@ -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, "-1n !== false");
assert.sameValue(false !== -1n, true, "false !== -1n");
assert.sameValue(-1n !== true, true, "-1n !== true");
assert.sameValue(true !== -1n, true, "true !== -1n");
assert.sameValue(0n !== false, true, "0n !== false");
assert.sameValue(false !== 0n, true, "false !== 0n");
assert.sameValue(0n !== true, true, "0n !== true");
assert.sameValue(true !== 0n, true, "true !== 0n");
assert.sameValue(1n !== false, true, "1n !== false");
assert.sameValue(false !== 1n, true, "false !== 1n");
assert.sameValue(1n !== true, true, "1n !== true");
assert.sameValue(true !== 1n, true, "true !== 1n");
assert.sameValue(2n !== false, true, "2n !== false");
assert.sameValue(false !== 2n, true, "false !== 2n");
assert.sameValue(2n !== true, true, "2n !== true");
assert.sameValue(true !== 2n, true, "true !== 2n");

View File

@ -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, "0n !== undefined");
assert.sameValue(undefined !== 0n, true, "undefined !== 0n");
assert.sameValue(1n !== undefined, true, "1n !== undefined");
assert.sameValue(undefined !== 1n, true, "undefined !== 1n");
assert.sameValue(0n !== null, true, "0n !== null");
assert.sameValue(null !== 0n, true, "null !== 0n");
assert.sameValue(1n !== null, true, "1n !== null");
assert.sameValue(null !== 1n, true, "null !== 1n");
assert.sameValue(0n !== Symbol("1"), true, "0n !== Symbol(\"1\")");
assert.sameValue(Symbol("1") !== 0n, true, "Symbol(\"1\") !== 0n");
assert.sameValue(1n !== Symbol("1"), true, "1n !== Symbol(\"1\")");
assert.sameValue(Symbol("1") !== 1n, true, "Symbol(\"1\") !== 1n");

View File

@ -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, "0n !== Infinity");
assert.sameValue(Infinity !== 0n, true, "Infinity !== 0n");
assert.sameValue(1n !== Infinity, true, "1n !== Infinity");
assert.sameValue(Infinity !== 1n, true, "Infinity !== 1n");
assert.sameValue(-1n !== Infinity, true, "-1n !== Infinity");
assert.sameValue(Infinity !== -1n, true, "Infinity !== -1n");
assert.sameValue(0n !== -Infinity, true, "0n !== -Infinity");
assert.sameValue(-Infinity !== 0n, true, "-Infinity !== 0n");
assert.sameValue(1n !== -Infinity, true, "1n !== -Infinity");
assert.sameValue(-Infinity !== 1n, true, "-Infinity !== 1n");
assert.sameValue(-1n !== -Infinity, true, "-1n !== -Infinity");
assert.sameValue(-Infinity !== -1n, true, "-Infinity !== -1n");
assert.sameValue(0n !== NaN, true, "0n !== NaN");
assert.sameValue(NaN !== 0n, true, "NaN !== 0n");
assert.sameValue(1n !== NaN, true, "1n !== NaN");
assert.sameValue(NaN !== 1n, true, "NaN !== 1n");
assert.sameValue(-1n !== NaN, true, "-1n !== NaN");
assert.sameValue(NaN !== -1n, true, "NaN !== -1n");

View File

@ -0,0 +1,40 @@
// 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, "1n !== Number.MAX_VALUE");
assert.sameValue(Number.MAX_VALUE !== 1n, true, "Number.MAX_VALUE !== 1n");
assert.sameValue(1n !== -Number.MAX_VALUE, true, "1n !== -Number.MAX_VALUE");
assert.sameValue(-Number.MAX_VALUE !== 1n, true, "-Number.MAX_VALUE !== 1n");
assert.sameValue(
0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE,
true,
"0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,
true,
"Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE,
true,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n,
true,
"Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE,
true,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n,
true,
"Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n");

View File

@ -0,0 +1,32 @@
// 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, "0n !== 0");
assert.sameValue(0 !== 0n, true, "0 !== 0n");
assert.sameValue(0n !== -0, true, "0n !== -0");
assert.sameValue(-0 !== 0n, true, "-0 !== 0n");
assert.sameValue(0n !== 0.000000000001, true, "0n !== 0.000000000001");
assert.sameValue(0.000000000001 !== 0n, true, "0.000000000001 !== 0n");
assert.sameValue(0n !== 1, true, "0n !== 1");
assert.sameValue(1 !== 0n, true, "1 !== 0n");
assert.sameValue(1n !== 0, true, "1n !== 0");
assert.sameValue(0 !== 1n, true, "0 !== 1n");
assert.sameValue(1n !== 0.999999999999, true, "1n !== 0.999999999999");
assert.sameValue(0.999999999999 !== 1n, true, "0.999999999999 !== 1n");
assert.sameValue(1n !== 1, true, "1n !== 1");
assert.sameValue(1 !== 1n, true, "1 !== 1n");
assert.sameValue(0n !== Number.MIN_VALUE, true, "0n !== Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE !== 0n, true, "Number.MIN_VALUE !== 0n");
assert.sameValue(0n !== -Number.MIN_VALUE, true, "0n !== -Number.MIN_VALUE");
assert.sameValue(-Number.MIN_VALUE !== 0n, true, "-Number.MIN_VALUE !== 0n");
assert.sameValue(-10n !== Number.MIN_VALUE, true, "-10n !== Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE !== -10n, true, "Number.MIN_VALUE !== -10n");

View File

@ -0,0 +1,44 @@
// 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, "0n !== Object(0n)");
assert.sameValue(Object(0n) !== 0n, true, "Object(0n) !== 0n");
assert.sameValue(0n !== Object(1n), true, "0n !== Object(1n)");
assert.sameValue(Object(1n) !== 0n, true, "Object(1n) !== 0n");
assert.sameValue(1n !== Object(0n), true, "1n !== Object(0n)");
assert.sameValue(Object(0n) !== 1n, true, "Object(0n) !== 1n");
assert.sameValue(1n !== Object(1n), true, "1n !== Object(1n)");
assert.sameValue(Object(1n) !== 1n, true, "Object(1n) !== 1n");
assert.sameValue(2n !== Object(0n), true, "2n !== Object(0n)");
assert.sameValue(Object(0n) !== 2n, true, "Object(0n) !== 2n");
assert.sameValue(2n !== Object(1n), true, "2n !== Object(1n)");
assert.sameValue(Object(1n) !== 2n, true, "Object(1n) !== 2n");
assert.sameValue(2n !== Object(2n), true, "2n !== Object(2n)");
assert.sameValue(Object(2n) !== 2n, true, "Object(2n) !== 2n");
assert.sameValue(0n !== {}, true, "0n !== {}");
assert.sameValue({} !== 0n, true, "{} !== 0n");
assert.sameValue(0n !== {valueOf: function() { return 0n; }}, true, "0n !== {valueOf: function() { return 0n; }}");
assert.sameValue({valueOf: function() { return 0n; }} !== 0n, true, "{valueOf: function() { return 0n; }} !== 0n");
assert.sameValue(0n !== {valueOf: function() { return 1n; }}, true, "0n !== {valueOf: function() { return 1n; }}");
assert.sameValue({valueOf: function() { return 1n; }} !== 0n, true, "{valueOf: function() { return 1n; }} !== 0n");
assert.sameValue(0n !== {toString: function() { return "0"; }}, true, "0n !== {toString: function() { return \"0\"; }}");
assert.sameValue({toString: function() { return "0"; }} !== 0n, true, "{toString: function() { return \"0\"; }} !== 0n");
assert.sameValue(0n !== {toString: function() { return "1"; }}, true, "0n !== {toString: function() { return \"1\"; }}");
assert.sameValue({toString: function() { return "1"; }} !== 0n, true, "{toString: function() { return \"1\"; }} !== 0n");
assert.sameValue(900719925474099101n !== {valueOf: function() { return 900719925474099101n; }}, true, "900719925474099101n !== {valueOf: function() { return 900719925474099101n; }}");
assert.sameValue({valueOf: function() { return 900719925474099101n; }} !== 900719925474099101n, true, "{valueOf: function() { return 900719925474099101n; }} !== 900719925474099101n");
assert.sameValue(900719925474099101n !== {valueOf: function() { return 900719925474099102n; }}, true, "900719925474099101n !== {valueOf: function() { return 900719925474099102n; }}");
assert.sameValue({valueOf: function() { return 900719925474099102n; }} !== 900719925474099101n, true, "{valueOf: function() { return 900719925474099102n; }} !== 900719925474099101n");
assert.sameValue(900719925474099101n !== {toString: function() { return "900719925474099101"; }}, true, "900719925474099101n !== {toString: function() { return \"900719925474099101\"; }}");
assert.sameValue({toString: function() { return "900719925474099101"; }} !== 900719925474099101n, true, "{toString: function() { return \"900719925474099101\"; }} !== 900719925474099101n");
assert.sameValue(900719925474099101n !== {toString: function() { return "900719925474099102"; }}, true, "900719925474099101n !== {toString: function() { return \"900719925474099102\"; }}");
assert.sameValue({toString: function() { return "900719925474099102"; }} !== 900719925474099101n, true, "{toString: function() { return \"900719925474099102\"; }} !== 900719925474099101n");

View File

@ -0,0 +1,48 @@
// 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, "0n !== \"\"");
assert.sameValue("" !== 0n, true, "\"\" !== 0n");
assert.sameValue(0n !== "-0", true, "0n !== \"-0\"");
assert.sameValue("-0" !== 0n, true, "\"-0\" !== 0n");
assert.sameValue(0n !== "0", true, "0n !== \"0\"");
assert.sameValue("0" !== 0n, true, "\"0\" !== 0n");
assert.sameValue(0n !== "-1", true, "0n !== \"-1\"");
assert.sameValue("-1" !== 0n, true, "\"-1\" !== 0n");
assert.sameValue(0n !== "1", true, "0n !== \"1\"");
assert.sameValue("1" !== 0n, true, "\"1\" !== 0n");
assert.sameValue(0n !== "foo", true, "0n !== \"foo\"");
assert.sameValue("foo" !== 0n, true, "\"foo\" !== 0n");
assert.sameValue(1n !== "", true, "1n !== \"\"");
assert.sameValue("" !== 1n, true, "\"\" !== 1n");
assert.sameValue(1n !== "-0", true, "1n !== \"-0\"");
assert.sameValue("-0" !== 1n, true, "\"-0\" !== 1n");
assert.sameValue(1n !== "0", true, "1n !== \"0\"");
assert.sameValue("0" !== 1n, true, "\"0\" !== 1n");
assert.sameValue(1n !== "-1", true, "1n !== \"-1\"");
assert.sameValue("-1" !== 1n, true, "\"-1\" !== 1n");
assert.sameValue(1n !== "1", true, "1n !== \"1\"");
assert.sameValue("1" !== 1n, true, "\"1\" !== 1n");
assert.sameValue(1n !== "foo", true, "1n !== \"foo\"");
assert.sameValue("foo" !== 1n, true, "\"foo\" !== 1n");
assert.sameValue(-1n !== "-", true, "-1n !== \"-\"");
assert.sameValue("-" !== -1n, true, "\"-\" !== -1n");
assert.sameValue(-1n !== "-0", true, "-1n !== \"-0\"");
assert.sameValue("-0" !== -1n, true, "\"-0\" !== -1n");
assert.sameValue(-1n !== "-1", true, "-1n !== \"-1\"");
assert.sameValue("-1" !== -1n, true, "\"-1\" !== -1n");
assert.sameValue(-1n !== "-foo", true, "-1n !== \"-foo\"");
assert.sameValue("-foo" !== -1n, true, "\"-foo\" !== -1n");
assert.sameValue(900719925474099101n !== "900719925474099101", true, "900719925474099101n !== \"900719925474099101\"");
assert.sameValue("900719925474099101" !== 900719925474099101n, true, "\"900719925474099101\" !== 900719925474099101n");
assert.sameValue(900719925474099102n !== "900719925474099101", true, "900719925474099102n !== \"900719925474099101\"");
assert.sameValue("900719925474099101" !== 900719925474099102n, true, "\"900719925474099101\" !== 900719925474099102n");

View File

@ -0,0 +1,54 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Strict equality 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, true, "0n === 0n");
assert.sameValue(1n === 1n, true, "1n === 1n");
assert.sameValue(-1n === -1n, true, "-1n === -1n");
assert.sameValue(0n === -0n, true, "0n === -0n");
assert.sameValue(-0n === 0n, true, "-0n === 0n");
assert.sameValue(0n === 1n, false, "0n === 1n");
assert.sameValue(1n === 0n, false, "1n === 0n");
assert.sameValue(0n === -1n, false, "0n === -1n");
assert.sameValue(-1n === 0n, false, "-1n === 0n");
assert.sameValue(1n === -1n, false, "1n === -1n");
assert.sameValue(-1n === 1n, false, "-1n === 1n");
assert.sameValue(0x1fffffffffffff01n === 0x1fffffffffffff01n, true, "0x1fffffffffffff01n === 0x1fffffffffffff01n");
assert.sameValue(0x1fffffffffffff01n === 0x1fffffffffffff02n, false, "0x1fffffffffffff01n === 0x1fffffffffffff02n");
assert.sameValue(0x1fffffffffffff02n === 0x1fffffffffffff01n, false, "0x1fffffffffffff02n === 0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n === -0x1fffffffffffff01n, true, "-0x1fffffffffffff01n === -0x1fffffffffffff01n");
assert.sameValue(-0x1fffffffffffff01n === -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n === -0x1fffffffffffff02n");
assert.sameValue(-0x1fffffffffffff02n === -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n === -0x1fffffffffffff01n");
assert.sameValue(0x10000000000000000n === 0n, false, "0x10000000000000000n === 0n");
assert.sameValue(0n === 0x10000000000000000n, false, "0n === 0x10000000000000000n");
assert.sameValue(0x10000000000000000n === 1n, false, "0x10000000000000000n === 1n");
assert.sameValue(1n === 0x10000000000000000n, false, "1n === 0x10000000000000000n");
assert.sameValue(0x10000000000000000n === -1n, false, "0x10000000000000000n === -1n");
assert.sameValue(-1n === 0x10000000000000000n, false, "-1n === 0x10000000000000000n");
assert.sameValue(0x10000000000000001n === 0n, false, "0x10000000000000001n === 0n");
assert.sameValue(0n === 0x10000000000000001n, false, "0n === 0x10000000000000001n");
assert.sameValue(-0x10000000000000000n === 0n, false, "-0x10000000000000000n === 0n");
assert.sameValue(0n === -0x10000000000000000n, false, "0n === -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n === 1n, false, "-0x10000000000000000n === 1n");
assert.sameValue(1n === -0x10000000000000000n, false, "1n === -0x10000000000000000n");
assert.sameValue(-0x10000000000000000n === -1n, false, "-0x10000000000000000n === -1n");
assert.sameValue(-1n === -0x10000000000000000n, false, "-1n === -0x10000000000000000n");
assert.sameValue(-0x10000000000000001n === 0n, false, "-0x10000000000000001n === 0n");
assert.sameValue(0n === -0x10000000000000001n, false, "0n === -0x10000000000000001n");
assert.sameValue(0x10000000000000000n === 0x100000000n, false, "0x10000000000000000n === 0x100000000n");
assert.sameValue(0x100000000n === 0x10000000000000000n, false, "0x100000000n === 0x10000000000000000n");

View File

@ -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 equality 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, false, "-1n === false");
assert.sameValue(false === -1n, false, "false === -1n");
assert.sameValue(-1n === true, false, "-1n === true");
assert.sameValue(true === -1n, false, "true === -1n");
assert.sameValue(0n === false, false, "0n === false");
assert.sameValue(false === 0n, false, "false === 0n");
assert.sameValue(0n === true, false, "0n === true");
assert.sameValue(true === 0n, false, "true === 0n");
assert.sameValue(1n === false, false, "1n === false");
assert.sameValue(false === 1n, false, "false === 1n");
assert.sameValue(1n === true, false, "1n === true");
assert.sameValue(true === 1n, false, "true === 1n");
assert.sameValue(2n === false, false, "2n === false");
assert.sameValue(false === 2n, false, "false === 2n");
assert.sameValue(2n === true, false, "2n === true");
assert.sameValue(true === 2n, false, "true === 2n");

View File

@ -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 equality 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, false, "0n === undefined");
assert.sameValue(undefined === 0n, false, "undefined === 0n");
assert.sameValue(1n === undefined, false, "1n === undefined");
assert.sameValue(undefined === 1n, false, "undefined === 1n");
assert.sameValue(0n === null, false, "0n === null");
assert.sameValue(null === 0n, false, "null === 0n");
assert.sameValue(1n === null, false, "1n === null");
assert.sameValue(null === 1n, false, "null === 1n");
assert.sameValue(0n === Symbol("1"), false, "0n === Symbol(\"1\")");
assert.sameValue(Symbol("1") === 0n, false, "Symbol(\"1\") === 0n");
assert.sameValue(1n === Symbol("1"), false, "1n === Symbol(\"1\")");
assert.sameValue(Symbol("1") === 1n, false, "Symbol(\"1\") === 1n");

View File

@ -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 equality 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, false, "0n === Infinity");
assert.sameValue(Infinity === 0n, false, "Infinity === 0n");
assert.sameValue(1n === Infinity, false, "1n === Infinity");
assert.sameValue(Infinity === 1n, false, "Infinity === 1n");
assert.sameValue(-1n === Infinity, false, "-1n === Infinity");
assert.sameValue(Infinity === -1n, false, "Infinity === -1n");
assert.sameValue(0n === -Infinity, false, "0n === -Infinity");
assert.sameValue(-Infinity === 0n, false, "-Infinity === 0n");
assert.sameValue(1n === -Infinity, false, "1n === -Infinity");
assert.sameValue(-Infinity === 1n, false, "-Infinity === 1n");
assert.sameValue(-1n === -Infinity, false, "-1n === -Infinity");
assert.sameValue(-Infinity === -1n, false, "-Infinity === -1n");
assert.sameValue(0n === NaN, false, "0n === NaN");
assert.sameValue(NaN === 0n, false, "NaN === 0n");
assert.sameValue(1n === NaN, false, "1n === NaN");
assert.sameValue(NaN === 1n, false, "NaN === 1n");
assert.sameValue(-1n === NaN, false, "-1n === NaN");
assert.sameValue(NaN === -1n, false, "NaN === -1n");

View File

@ -0,0 +1,40 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Strict equality 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, false, "1n === Number.MAX_VALUE");
assert.sameValue(Number.MAX_VALUE === 1n, false, "Number.MAX_VALUE === 1n");
assert.sameValue(1n === -Number.MAX_VALUE, false, "1n === -Number.MAX_VALUE");
assert.sameValue(-Number.MAX_VALUE === 1n, false, "-Number.MAX_VALUE === 1n");
assert.sameValue(
0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE,
false,
"0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn,
false,
"Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE,
false,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n,
false,
"Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n");
assert.sameValue(
0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE,
false,
"0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE");
assert.sameValue(
Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n,
false,
"Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n");

View File

@ -0,0 +1,32 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Strict equality 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, false, "0n === 0");
assert.sameValue(0 === 0n, false, "0 === 0n");
assert.sameValue(0n === -0, false, "0n === -0");
assert.sameValue(-0 === 0n, false, "-0 === 0n");
assert.sameValue(0n === 0.000000000001, false, "0n === 0.000000000001");
assert.sameValue(0.000000000001 === 0n, false, "0.000000000001 === 0n");
assert.sameValue(0n === 1, false, "0n === 1");
assert.sameValue(1 === 0n, false, "1 === 0n");
assert.sameValue(1n === 0, false, "1n === 0");
assert.sameValue(0 === 1n, false, "0 === 1n");
assert.sameValue(1n === 0.999999999999, false, "1n === 0.999999999999");
assert.sameValue(0.999999999999 === 1n, false, "0.999999999999 === 1n");
assert.sameValue(1n === 1, false, "1n === 1");
assert.sameValue(1 === 1n, false, "1 === 1n");
assert.sameValue(0n === Number.MIN_VALUE, false, "0n === Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE === 0n, false, "Number.MIN_VALUE === 0n");
assert.sameValue(0n === -Number.MIN_VALUE, false, "0n === -Number.MIN_VALUE");
assert.sameValue(-Number.MIN_VALUE === 0n, false, "-Number.MIN_VALUE === 0n");
assert.sameValue(-10n === Number.MIN_VALUE, false, "-10n === Number.MIN_VALUE");
assert.sameValue(Number.MIN_VALUE === -10n, false, "Number.MIN_VALUE === -10n");

View File

@ -0,0 +1,44 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Strict equality 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), false, "0n === Object(0n)");
assert.sameValue(Object(0n) === 0n, false, "Object(0n) === 0n");
assert.sameValue(0n === Object(1n), false, "0n === Object(1n)");
assert.sameValue(Object(1n) === 0n, false, "Object(1n) === 0n");
assert.sameValue(1n === Object(0n), false, "1n === Object(0n)");
assert.sameValue(Object(0n) === 1n, false, "Object(0n) === 1n");
assert.sameValue(1n === Object(1n), false, "1n === Object(1n)");
assert.sameValue(Object(1n) === 1n, false, "Object(1n) === 1n");
assert.sameValue(2n === Object(0n), false, "2n === Object(0n)");
assert.sameValue(Object(0n) === 2n, false, "Object(0n) === 2n");
assert.sameValue(2n === Object(1n), false, "2n === Object(1n)");
assert.sameValue(Object(1n) === 2n, false, "Object(1n) === 2n");
assert.sameValue(2n === Object(2n), false, "2n === Object(2n)");
assert.sameValue(Object(2n) === 2n, false, "Object(2n) === 2n");
assert.sameValue(0n === {}, false, "0n === {}");
assert.sameValue({} === 0n, false, "{} === 0n");
assert.sameValue(0n === {valueOf: function() { return 0n; }}, false, "0n === {valueOf: function() { return 0n; }}");
assert.sameValue({valueOf: function() { return 0n; }} === 0n, false, "{valueOf: function() { return 0n; }} === 0n");
assert.sameValue(0n === {valueOf: function() { return 1n; }}, false, "0n === {valueOf: function() { return 1n; }}");
assert.sameValue({valueOf: function() { return 1n; }} === 0n, false, "{valueOf: function() { return 1n; }} === 0n");
assert.sameValue(0n === {toString: function() { return "0"; }}, false, "0n === {toString: function() { return \"0\"; }}");
assert.sameValue({toString: function() { return "0"; }} === 0n, false, "{toString: function() { return \"0\"; }} === 0n");
assert.sameValue(0n === {toString: function() { return "1"; }}, false, "0n === {toString: function() { return \"1\"; }}");
assert.sameValue({toString: function() { return "1"; }} === 0n, false, "{toString: function() { return \"1\"; }} === 0n");
assert.sameValue(900719925474099101n === {valueOf: function() { return 900719925474099101n; }}, false, "900719925474099101n === {valueOf: function() { return 900719925474099101n; }}");
assert.sameValue({valueOf: function() { return 900719925474099101n; }} === 900719925474099101n, false, "{valueOf: function() { return 900719925474099101n; }} === 900719925474099101n");
assert.sameValue(900719925474099101n === {valueOf: function() { return 900719925474099102n; }}, false, "900719925474099101n === {valueOf: function() { return 900719925474099102n; }}");
assert.sameValue({valueOf: function() { return 900719925474099102n; }} === 900719925474099101n, false, "{valueOf: function() { return 900719925474099102n; }} === 900719925474099101n");
assert.sameValue(900719925474099101n === {toString: function() { return "900719925474099101"; }}, false, "900719925474099101n === {toString: function() { return \"900719925474099101\"; }}");
assert.sameValue({toString: function() { return "900719925474099101"; }} === 900719925474099101n, false, "{toString: function() { return \"900719925474099101\"; }} === 900719925474099101n");
assert.sameValue(900719925474099101n === {toString: function() { return "900719925474099102"; }}, false, "900719925474099101n === {toString: function() { return \"900719925474099102\"; }}");
assert.sameValue({toString: function() { return "900719925474099102"; }} === 900719925474099101n, false, "{toString: function() { return \"900719925474099102\"; }} === 900719925474099101n");

View File

@ -0,0 +1,48 @@
// Copyright (C) 2017 Josh Wolfe. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Strict equality 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 === "", false, "0n === \"\"");
assert.sameValue("" === 0n, false, "\"\" === 0n");
assert.sameValue(0n === "-0", false, "0n === \"-0\"");
assert.sameValue("-0" === 0n, false, "\"-0\" === 0n");
assert.sameValue(0n === "0", false, "0n === \"0\"");
assert.sameValue("0" === 0n, false, "\"0\" === 0n");
assert.sameValue(0n === "-1", false, "0n === \"-1\"");
assert.sameValue("-1" === 0n, false, "\"-1\" === 0n");
assert.sameValue(0n === "1", false, "0n === \"1\"");
assert.sameValue("1" === 0n, false, "\"1\" === 0n");
assert.sameValue(0n === "foo", false, "0n === \"foo\"");
assert.sameValue("foo" === 0n, false, "\"foo\" === 0n");
assert.sameValue(1n === "", false, "1n === \"\"");
assert.sameValue("" === 1n, false, "\"\" === 1n");
assert.sameValue(1n === "-0", false, "1n === \"-0\"");
assert.sameValue("-0" === 1n, false, "\"-0\" === 1n");
assert.sameValue(1n === "0", false, "1n === \"0\"");
assert.sameValue("0" === 1n, false, "\"0\" === 1n");
assert.sameValue(1n === "-1", false, "1n === \"-1\"");
assert.sameValue("-1" === 1n, false, "\"-1\" === 1n");
assert.sameValue(1n === "1", false, "1n === \"1\"");
assert.sameValue("1" === 1n, false, "\"1\" === 1n");
assert.sameValue(1n === "foo", false, "1n === \"foo\"");
assert.sameValue("foo" === 1n, false, "\"foo\" === 1n");
assert.sameValue(-1n === "-", false, "-1n === \"-\"");
assert.sameValue("-" === -1n, false, "\"-\" === -1n");
assert.sameValue(-1n === "-0", false, "-1n === \"-0\"");
assert.sameValue("-0" === -1n, false, "\"-0\" === -1n");
assert.sameValue(-1n === "-1", false, "-1n === \"-1\"");
assert.sameValue("-1" === -1n, false, "\"-1\" === -1n");
assert.sameValue(-1n === "-foo", false, "-1n === \"-foo\"");
assert.sameValue("-foo" === -1n, false, "\"-foo\" === -1n");
assert.sameValue(900719925474099101n === "900719925474099101", false, "900719925474099101n === \"900719925474099101\"");
assert.sameValue("900719925474099101" === 900719925474099101n, false, "\"900719925474099101\" === 900719925474099101n");
assert.sameValue(900719925474099102n === "900719925474099101", false, "900719925474099102n === \"900719925474099101\"");
assert.sameValue("900719925474099101" === 900719925474099102n, false, "\"900719925474099101\" === 900719925474099102n");