Debian Codegraph @

js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-bigint.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 description: Comparisons of BigInt and BigInt values
5 esid: sec-abstract-relational-comparison
6 info: |
7 ...
8 3. If both px and py are Strings, then
9 ...
10 4. Else,
11 a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important.
12 b. Let ny be ? ToNumeric(py).
13 c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny).
14
15 sec-numeric-types-bigint-lessThan
16 BigInt::lessThan (x, y)
17
18 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.
19
20 features: [BigInt]
21 ---*/
22 assert.sameValue(0n >= 0n, true, 'The result of (0n >= 0n) is true');
23 assert.sameValue(1n >= 1n, true, 'The result of (1n >= 1n) is true');
24 assert.sameValue(-1n >= -1n, true, 'The result of (-1n >= -1n) is true');
25 assert.sameValue(0n >= -0n, true, 'The result of (0n >= -0n) is true');
26 assert.sameValue(-0n >= 0n, true, 'The result of (-0n >= 0n) is true');
27 assert.sameValue(0n >= 1n, false, 'The result of (0n >= 1n) is false');
28 assert.sameValue(1n >= 0n, true, 'The result of (1n >= 0n) is true');
29 assert.sameValue(0n >= -1n, true, 'The result of (0n >= -1n) is true');
30 assert.sameValue(-1n >= 0n, false, 'The result of (-1n >= 0n) is false');
31 assert.sameValue(1n >= -1n, true, 'The result of (1n >= -1n) is true');
32 assert.sameValue(-1n >= 1n, false, 'The result of (-1n >= 1n) is false');
33
34 assert.sameValue(
35 0x1fffffffffffff01n >= 0x1fffffffffffff02n,
36 false,
37 'The result of (0x1fffffffffffff01n >= 0x1fffffffffffff02n) is false'
38 );
39
40 assert.sameValue(
41 0x1fffffffffffff02n >= 0x1fffffffffffff01n,
42 true,
43 'The result of (0x1fffffffffffff02n >= 0x1fffffffffffff01n) is true'
44 );
45
46 assert.sameValue(
47 -0x1fffffffffffff01n >= -0x1fffffffffffff02n,
48 true,
49 'The result of (-0x1fffffffffffff01n >= -0x1fffffffffffff02n) is true'
50 );
51
52 assert.sameValue(
53 -0x1fffffffffffff02n >= -0x1fffffffffffff01n,
54 false,
55 'The result of (-0x1fffffffffffff02n >= -0x1fffffffffffff01n) is false'
56 );
57
58 assert.sameValue(
59 0x10000000000000000n >= 0n,
60 true,
61 'The result of (0x10000000000000000n >= 0n) is true'
62 );
63
64 assert.sameValue(
65 0n >= 0x10000000000000000n,
66 false,
67 'The result of (0n >= 0x10000000000000000n) is false'
68 );
69
70 assert.sameValue(
71 0x10000000000000000n >= 1n,
72 true,
73 'The result of (0x10000000000000000n >= 1n) is true'
74 );
75
76 assert.sameValue(
77 1n >= 0x10000000000000000n,
78 false,
79 'The result of (1n >= 0x10000000000000000n) is false'
80 );
81
82 assert.sameValue(
83 0x10000000000000000n >= -1n,
84 true,
85 'The result of (0x10000000000000000n >= -1n) is true'
86 );
87
88 assert.sameValue(
89 -1n >= 0x10000000000000000n,
90 false,
91 'The result of (-1n >= 0x10000000000000000n) is false'
92 );
93
94 assert.sameValue(
95 0x10000000000000001n >= 0n,
96 true,
97 'The result of (0x10000000000000001n >= 0n) is true'
98 );
99
100 assert.sameValue(
101 0n >= 0x10000000000000001n,
102 false,
103 'The result of (0n >= 0x10000000000000001n) is false'
104 );
105
106 assert.sameValue(
107 -0x10000000000000000n >= 0n,
108 false,
109 'The result of (-0x10000000000000000n >= 0n) is false'
110 );
111
112 assert.sameValue(
113 0n >= -0x10000000000000000n,
114 true,
115 'The result of (0n >= -0x10000000000000000n) is true'
116 );
117
118 assert.sameValue(
119 -0x10000000000000000n >= 1n,
120 false,
121 'The result of (-0x10000000000000000n >= 1n) is false'
122 );
123
124 assert.sameValue(
125 1n >= -0x10000000000000000n,
126 true,
127 'The result of (1n >= -0x10000000000000000n) is true'
128 );
129
130 assert.sameValue(
131 -0x10000000000000000n >= -1n,
132 false,
133 'The result of (-0x10000000000000000n >= -1n) is false'
134 );
135
136 assert.sameValue(
137 -1n >= -0x10000000000000000n,
138 true,
139 'The result of (-1n >= -0x10000000000000000n) is true'
140 );
141
142 assert.sameValue(
143 -0x10000000000000001n >= 0n,
144 false,
145 'The result of (-0x10000000000000001n >= 0n) is false'
146 );
147
148 assert.sameValue(
149 0n >= -0x10000000000000001n,
150 true,
151 'The result of (0n >= -0x10000000000000001n) is true'
152 );
153
154 assert.sameValue(
155 0x10000000000000000n >= 0x100000000n,
156 true,
157 'The result of (0x10000000000000000n >= 0x100000000n) is true'
158 );
159
160 assert.sameValue(
161 0x100000000n >= 0x10000000000000000n,
162 false,
163 'The result of (0x100000000n >= 0x10000000000000000n) is false'
164 );
165
166 reportCompare(0, 0);