Debian Codegraph @

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