Debian Codegraph @

js/src/tests/test262/language/expressions/strict-does-not-equals/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: Strict inequality comparison of BigInt values
5 esid: sec-strict-equality-comparison
6 info: |
7 1. If Type(x) is different from Type(y), return false.
8 2. If Type(x) is Number or BigInt, then
9 a. Return ! Type(x)::equal(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 assert.sameValue(0n !== 0n, false, 'The result of (0n !== 0n) is false');
19 assert.sameValue(1n !== 1n, false, 'The result of (1n !== 1n) is false');
20 assert.sameValue(-1n !== -1n, false, 'The result of (-1n !== -1n) is false');
21 assert.sameValue(0n !== -0n, false, 'The result of (0n !== -0n) is false');
22 assert.sameValue(-0n !== 0n, false, 'The result of (-0n !== 0n) is false');
23 assert.sameValue(0n !== 1n, true, 'The result of (0n !== 1n) is true');
24 assert.sameValue(1n !== 0n, true, 'The result of (1n !== 0n) is true');
25 assert.sameValue(0n !== -1n, true, 'The result of (0n !== -1n) is true');
26 assert.sameValue(-1n !== 0n, true, 'The result of (-1n !== 0n) is true');
27 assert.sameValue(1n !== -1n, true, 'The result of (1n !== -1n) is true');
28 assert.sameValue(-1n !== 1n, true, 'The result of (-1n !== 1n) is true');
29
30 assert.sameValue(
31 0x1fffffffffffff01n !== 0x1fffffffffffff01n,
32 false,
33 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff01n) is false'
34 );
35
36 assert.sameValue(
37 0x1fffffffffffff01n !== 0x1fffffffffffff02n,
38 true,
39 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff02n) is true'
40 );
41
42 assert.sameValue(
43 0x1fffffffffffff02n !== 0x1fffffffffffff01n,
44 true,
45 'The result of (0x1fffffffffffff02n !== 0x1fffffffffffff01n) is true'
46 );
47
48 assert.sameValue(
49 -0x1fffffffffffff01n !== -0x1fffffffffffff01n,
50 false,
51 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff01n) is false'
52 );
53
54 assert.sameValue(
55 -0x1fffffffffffff01n !== -0x1fffffffffffff02n,
56 true,
57 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff02n) is true'
58 );
59
60 assert.sameValue(
61 -0x1fffffffffffff02n !== -0x1fffffffffffff01n,
62 true,
63 'The result of (-0x1fffffffffffff02n !== -0x1fffffffffffff01n) is true'
64 );
65
66 assert.sameValue(
67 0x10000000000000000n !== 0n,
68 true,
69 'The result of (0x10000000000000000n !== 0n) is true'
70 );
71
72 assert.sameValue(
73 0n !== 0x10000000000000000n,
74 true,
75 'The result of (0n !== 0x10000000000000000n) is true'
76 );
77
78 assert.sameValue(
79 0x10000000000000000n !== 1n,
80 true,
81 'The result of (0x10000000000000000n !== 1n) is true'
82 );
83
84 assert.sameValue(
85 1n !== 0x10000000000000000n,
86 true,
87 'The result of (1n !== 0x10000000000000000n) is true'
88 );
89
90 assert.sameValue(
91 0x10000000000000000n !== -1n,
92 true,
93 'The result of (0x10000000000000000n !== -1n) is true'
94 );
95
96 assert.sameValue(
97 -1n !== 0x10000000000000000n,
98 true,
99 'The result of (-1n !== 0x10000000000000000n) is true'
100 );
101
102 assert.sameValue(
103 0x10000000000000001n !== 0n,
104 true,
105 'The result of (0x10000000000000001n !== 0n) is true'
106 );
107
108 assert.sameValue(
109 0n !== 0x10000000000000001n,
110 true,
111 'The result of (0n !== 0x10000000000000001n) is true'
112 );
113
114 assert.sameValue(
115 -0x10000000000000000n !== 0n,
116 true,
117 'The result of (-0x10000000000000000n !== 0n) is true'
118 );
119
120 assert.sameValue(
121 0n !== -0x10000000000000000n,
122 true,
123 'The result of (0n !== -0x10000000000000000n) is true'
124 );
125
126 assert.sameValue(
127 -0x10000000000000000n !== 1n,
128 true,
129 'The result of (-0x10000000000000000n !== 1n) is true'
130 );
131
132 assert.sameValue(
133 1n !== -0x10000000000000000n,
134 true,
135 'The result of (1n !== -0x10000000000000000n) is true'
136 );
137
138 assert.sameValue(
139 -0x10000000000000000n !== -1n,
140 true,
141 'The result of (-0x10000000000000000n !== -1n) is true'
142 );
143
144 assert.sameValue(
145 -1n !== -0x10000000000000000n,
146 true,
147 'The result of (-1n !== -0x10000000000000000n) is true'
148 );
149
150 assert.sameValue(
151 -0x10000000000000001n !== 0n,
152 true,
153 'The result of (-0x10000000000000001n !== 0n) is true'
154 );
155
156 assert.sameValue(
157 0n !== -0x10000000000000001n,
158 true,
159 'The result of (0n !== -0x10000000000000001n) is true'
160 );
161
162 assert.sameValue(
163 0x10000000000000000n !== 0x100000000n,
164 true,
165 'The result of (0x10000000000000000n !== 0x100000000n) is true'
166 );
167
168 assert.sameValue(
169 0x100000000n !== 0x10000000000000000n,
170 true,
171 'The result of (0x100000000n !== 0x10000000000000000n) is true'
172 );
173
174 reportCompare(0, 0);