Debian Codegraph @

js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.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 and Number values
5 esid: sec-abstract-equality-comparison
6 info: |
7 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt,
8 b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false.
9
10 features: [BigInt]
11 ---*/
12 assert.sameValue(0n != 0, false, 'The result of (0n != 0) is false');
13 assert.sameValue(0 != 0n, false, 'The result of (0 != 0n) is false');
14 assert.sameValue(0n != -0, false, 'The result of (0n != -0) is false');
15 assert.sameValue(-0 != 0n, false, 'The result of (-0 != 0n) is false');
16 assert.sameValue(0n != 0.000000000001, true, 'The result of (0n != 0.000000000001) is true');
17 assert.sameValue(0.000000000001 != 0n, true, 'The result of (0.000000000001 != 0n) is true');
18 assert.sameValue(0n != 1, true, 'The result of (0n != 1) is true');
19 assert.sameValue(1 != 0n, true, 'The result of (1 != 0n) is true');
20 assert.sameValue(1n != 0, true, 'The result of (1n != 0) is true');
21 assert.sameValue(0 != 1n, true, 'The result of (0 != 1n) is true');
22 assert.sameValue(1n != 0.999999999999, true, 'The result of (1n != 0.999999999999) is true');
23 assert.sameValue(0.999999999999 != 1n, true, 'The result of (0.999999999999 != 1n) is true');
24 assert.sameValue(1n != 1, false, 'The result of (1n != 1) is false');
25 assert.sameValue(1 != 1n, false, 'The result of (1 != 1n) is false');
26 assert.sameValue(0n != Number.MIN_VALUE, true, 'The result of (0n != Number.MIN_VALUE) is true');
27 assert.sameValue(Number.MIN_VALUE != 0n, true, 'The result of (Number.MIN_VALUE != 0n) is true');
28 assert.sameValue(0n != -Number.MIN_VALUE, true, 'The result of (0n != -Number.MIN_VALUE) is true');
29 assert.sameValue(-Number.MIN_VALUE != 0n, true, 'The result of (-Number.MIN_VALUE != 0n) is true');
30
31 assert.sameValue(
32 -10n != Number.MIN_VALUE,
33 true,
34 'The result of (-10n != Number.MIN_VALUE) is true'
35 );
36
37 assert.sameValue(
38 Number.MIN_VALUE != -10n,
39 true,
40 'The result of (Number.MIN_VALUE != -10n) is true'
41 );
42
43 reportCompare(0, 0);