Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/less-than-or-equal/bigint-and-number.js

raw
1 // Copyright (C) 2017 Robin Templeton. 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 Number 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 d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt.
16 e. If x or y are any of NaN, return undefined.
17 f. If x is -∞, or y is +∞, return true.
18 g. If x is +∞, or y is -∞, return false.
19 h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false.
20 features: [BigInt]
21 ---*/
22
23 assert.sameValue(0n <= 0, true, "0n <= 0");
24 assert.sameValue(0 <= 0n, true, "0 <= 0n");
25 assert.sameValue(0n <= -0, true, "0n <= -0");
26 assert.sameValue(-0 <= 0n, true, "-0 <= 0n");
27 assert.sameValue(0n <= 0.000000000001, true, "0n <= 0.000000000001");
28 assert.sameValue(0.000000000001 <= 0n, false, "0.000000000001 <= 0n");
29 assert.sameValue(0n <= 1, true, "0n <= 1");
30 assert.sameValue(1 <= 0n, false, "1 <= 0n");
31 assert.sameValue(1n <= 0, false, "1n <= 0");
32 assert.sameValue(0 <= 1n, true, "0 <= 1n");
33 assert.sameValue(1n <= 0.999999999999, false, "1n <= 0.999999999999");
34 assert.sameValue(0.999999999999 <= 1n, true, "0.999999999999 <= 1n");
35 assert.sameValue(1n <= 1, true, "1n <= 1");
36 assert.sameValue(1 <= 1n, true, "1 <= 1n");
37 assert.sameValue(0n <= Number.MIN_VALUE, true, "0n <= Number.MIN_VALUE");
38 assert.sameValue(Number.MIN_VALUE <= 0n, false, "Number.MIN_VALUE <= 0n");
39 assert.sameValue(0n <= -Number.MIN_VALUE, false, "0n <= -Number.MIN_VALUE");
40 assert.sameValue(-Number.MIN_VALUE <= 0n, true, "-Number.MIN_VALUE <= 0n");
41 assert.sameValue(-10n <= Number.MIN_VALUE, true, "-10n <= Number.MIN_VALUE");
42 assert.sameValue(Number.MIN_VALUE <= -10n, false, "Number.MIN_VALUE <= -10n");