Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/less-than/bigint-and-non-finite.js

raw
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 non-finite 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 features: [BigInt]
20 ---*/
21
22 assert.sameValue(1n < Infinity, true, "1n < Infinity");
23 assert.sameValue(Infinity < 1n, false, "Infinity < 1n");
24 assert.sameValue(-1n < Infinity, true, "-1n < Infinity");
25 assert.sameValue(Infinity < -1n, false, "Infinity < -1n");
26 assert.sameValue(1n < -Infinity, false, "1n < -Infinity");
27 assert.sameValue(-Infinity < 1n, true, "-Infinity < 1n");
28 assert.sameValue(-1n < -Infinity, false, "-1n < -Infinity");
29 assert.sameValue(-Infinity < -1n, true, "-Infinity < -1n");
30 assert.sameValue(0n < NaN, false, "0n < NaN");
31 assert.sameValue(NaN < 0n, false, "NaN < 0n");