| 1 |
// Copyright (C) 2017 Josh Wolfe. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: Non-strict equality comparison of BigInt values |
| 6 |
esid: sec-abstract-equality-comparison |
| 7 |
info: | |
| 8 |
1. If Type(x) is the same as Type(y), then |
| 9 |
a. Return the result of performing Strict Equality Comparison x === y. |
| 10 |
|
| 11 |
sec-numeric-types-bigint-equal |
| 12 |
BigInt::equal (x, y) |
| 13 |
|
| 14 |
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. |
| 15 |
|
| 16 |
features: [BigInt] |
| 17 |
---*/ |
| 18 |
|
| 19 |
assert.sameValue(0n == 0n, true, "0n == 0n"); |
| 20 |
assert.sameValue(1n == 1n, true, "1n == 1n"); |
| 21 |
assert.sameValue(-1n == -1n, true, "-1n == -1n"); |
| 22 |
assert.sameValue(0n == -0n, true, "0n == -0n"); |
| 23 |
assert.sameValue(-0n == 0n, true, "-0n == 0n"); |
| 24 |
assert.sameValue(0n == 1n, false, "0n == 1n"); |
| 25 |
assert.sameValue(1n == 0n, false, "1n == 0n"); |
| 26 |
assert.sameValue(0n == -1n, false, "0n == -1n"); |
| 27 |
assert.sameValue(-1n == 0n, false, "-1n == 0n"); |
| 28 |
assert.sameValue(1n == -1n, false, "1n == -1n"); |
| 29 |
assert.sameValue(-1n == 1n, false, "-1n == 1n"); |
| 30 |
assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff01n, true, "0x1fffffffffffff01n == 0x1fffffffffffff01n"); |
| 31 |
assert.sameValue(0x1fffffffffffff01n == 0x1fffffffffffff02n, false, "0x1fffffffffffff01n == 0x1fffffffffffff02n"); |
| 32 |
assert.sameValue(0x1fffffffffffff02n == 0x1fffffffffffff01n, false, "0x1fffffffffffff02n == 0x1fffffffffffff01n"); |
| 33 |
assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff01n, true, "-0x1fffffffffffff01n == -0x1fffffffffffff01n"); |
| 34 |
assert.sameValue(-0x1fffffffffffff01n == -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n == -0x1fffffffffffff02n"); |
| 35 |
assert.sameValue(-0x1fffffffffffff02n == -0x1fffffffffffff01n, false, "-0x1fffffffffffff02n == -0x1fffffffffffff01n"); |
| 36 |
assert.sameValue(0x10000000000000000n == 0n, false, "0x10000000000000000n == 0n"); |
| 37 |
assert.sameValue(0n == 0x10000000000000000n, false, "0n == 0x10000000000000000n"); |
| 38 |
assert.sameValue(0x10000000000000000n == 1n, false, "0x10000000000000000n == 1n"); |
| 39 |
assert.sameValue(1n == 0x10000000000000000n, false, "1n == 0x10000000000000000n"); |
| 40 |
assert.sameValue(0x10000000000000000n == -1n, false, "0x10000000000000000n == -1n"); |
| 41 |
assert.sameValue(-1n == 0x10000000000000000n, false, "-1n == 0x10000000000000000n"); |
| 42 |
assert.sameValue(0x10000000000000001n == 0n, false, "0x10000000000000001n == 0n"); |
| 43 |
assert.sameValue(0n == 0x10000000000000001n, false, "0n == 0x10000000000000001n"); |
| 44 |
assert.sameValue(-0x10000000000000000n == 0n, false, "-0x10000000000000000n == 0n"); |
| 45 |
assert.sameValue(0n == -0x10000000000000000n, false, "0n == -0x10000000000000000n"); |
| 46 |
assert.sameValue(-0x10000000000000000n == 1n, false, "-0x10000000000000000n == 1n"); |
| 47 |
assert.sameValue(1n == -0x10000000000000000n, false, "1n == -0x10000000000000000n"); |
| 48 |
assert.sameValue(-0x10000000000000000n == -1n, false, "-0x10000000000000000n == -1n"); |
| 49 |
assert.sameValue(-1n == -0x10000000000000000n, false, "-1n == -0x10000000000000000n"); |
| 50 |
assert.sameValue(-0x10000000000000001n == 0n, false, "-0x10000000000000001n == 0n"); |
| 51 |
assert.sameValue(0n == -0x10000000000000001n, false, "0n == -0x10000000000000001n"); |
| 52 |
assert.sameValue(0x10000000000000000n == 0x100000000n, false, "0x10000000000000000n == 0x100000000n"); |
| 53 |
assert.sameValue(0x100000000n == 0x10000000000000000n, false, "0x100000000n == 0x10000000000000000n"); |