| 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: Comparisons of BigInt and BigInt values |
| 6 |
esid: sec-abstract-relational-comparison |
| 7 |
info: | |
| 8 |
... |
| 9 |
3. If both px and py are Strings, then |
| 10 |
... |
| 11 |
4. Else, |
| 12 |
a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. |
| 13 |
b. Let ny be ? ToNumeric(py). |
| 14 |
c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). |
| 15 |
|
| 16 |
sec-numeric-types-bigint-lessThan |
| 17 |
BigInt::lessThan (x, y) |
| 18 |
|
| 19 |
The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. |
| 20 |
|
| 21 |
features: [BigInt] |
| 22 |
---*/ |
| 23 |
|
| 24 |
assert.sameValue(0n <= 0n, true, "0n <= 0n"); |
| 25 |
assert.sameValue(1n <= 1n, true, "1n <= 1n"); |
| 26 |
assert.sameValue(-1n <= -1n, true, "-1n <= -1n"); |
| 27 |
assert.sameValue(0n <= -0n, true, "0n <= -0n"); |
| 28 |
assert.sameValue(-0n <= 0n, true, "-0n <= 0n"); |
| 29 |
assert.sameValue(0n <= 1n, true, "0n <= 1n"); |
| 30 |
assert.sameValue(1n <= 0n, false, "1n <= 0n"); |
| 31 |
assert.sameValue(0n <= -1n, false, "0n <= -1n"); |
| 32 |
assert.sameValue(-1n <= 0n, true, "-1n <= 0n"); |
| 33 |
assert.sameValue(1n <= -1n, false, "1n <= -1n"); |
| 34 |
assert.sameValue(-1n <= 1n, true, "-1n <= 1n"); |
| 35 |
assert.sameValue(0x1fffffffffffff01n <= 0x1fffffffffffff02n, true, "0x1fffffffffffff01n <= 0x1fffffffffffff02n"); |
| 36 |
assert.sameValue(0x1fffffffffffff02n <= 0x1fffffffffffff01n, false, "0x1fffffffffffff02n <= 0x1fffffffffffff01n"); |
| 37 |
assert.sameValue(-0x1fffffffffffff01n <= -0x1fffffffffffff02n, false, "-0x1fffffffffffff01n <= -0x1fffffffffffff02n"); |
| 38 |
assert.sameValue(-0x1fffffffffffff02n <= -0x1fffffffffffff01n, true, "-0x1fffffffffffff02n <= -0x1fffffffffffff01n"); |
| 39 |
assert.sameValue(0x10000000000000000n <= 0n, false, "0x10000000000000000n <= 0n"); |
| 40 |
assert.sameValue(0n <= 0x10000000000000000n, true, "0n <= 0x10000000000000000n"); |
| 41 |
assert.sameValue(0x10000000000000000n <= 1n, false, "0x10000000000000000n <= 1n"); |
| 42 |
assert.sameValue(1n <= 0x10000000000000000n, true, "1n <= 0x10000000000000000n"); |
| 43 |
assert.sameValue(0x10000000000000000n <= -1n, false, "0x10000000000000000n <= -1n"); |
| 44 |
assert.sameValue(-1n <= 0x10000000000000000n, true, "-1n <= 0x10000000000000000n"); |
| 45 |
assert.sameValue(0x10000000000000001n <= 0n, false, "0x10000000000000001n <= 0n"); |
| 46 |
assert.sameValue(0n <= 0x10000000000000001n, true, "0n <= 0x10000000000000001n"); |
| 47 |
assert.sameValue(-0x10000000000000000n <= 0n, true, "-0x10000000000000000n <= 0n"); |
| 48 |
assert.sameValue(0n <= -0x10000000000000000n, false, "0n <= -0x10000000000000000n"); |
| 49 |
assert.sameValue(-0x10000000000000000n <= 1n, true, "-0x10000000000000000n <= 1n"); |
| 50 |
assert.sameValue(1n <= -0x10000000000000000n, false, "1n <= -0x10000000000000000n"); |
| 51 |
assert.sameValue(-0x10000000000000000n <= -1n, true, "-0x10000000000000000n <= -1n"); |
| 52 |
assert.sameValue(-1n <= -0x10000000000000000n, false, "-1n <= -0x10000000000000000n"); |
| 53 |
assert.sameValue(-0x10000000000000001n <= 0n, true, "-0x10000000000000001n <= 0n"); |
| 54 |
assert.sameValue(0n <= -0x10000000000000001n, false, "0n <= -0x10000000000000001n"); |
| 55 |
assert.sameValue(0x10000000000000000n <= 0x100000000n, false, "0x10000000000000000n <= 0x100000000n"); |
| 56 |
assert.sameValue(0x100000000n <= 0x10000000000000000n, true, "0x100000000n <= 0x10000000000000000n"); |