Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/equals/bigint-and-boolean.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: Non-strict equality comparison of BigInt and Boolean values
6 esid: sec-abstract-equality-comparison
7 info: |
8 8. If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y.
9 9. If Type(y) is Boolean, return the result of the comparison x == ToNumber(y).
10 ...
11 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt,
12 ...
13 b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false.
14
15 features: [BigInt]
16 ---*/
17
18 assert.sameValue(-1n == false, false, "-1n == false");
19 assert.sameValue(false == -1n, false, "false == -1n");
20 assert.sameValue(-1n == true, false, "-1n == true");
21 assert.sameValue(true == -1n, false, "true == -1n");
22 assert.sameValue(0n == false, true, "0n == false");
23 assert.sameValue(false == 0n, true, "false == 0n");
24 assert.sameValue(0n == true, false, "0n == true");
25 assert.sameValue(true == 0n, false, "true == 0n");
26 assert.sameValue(1n == false, false, "1n == false");
27 assert.sameValue(false == 1n, false, "false == 1n");
28 assert.sameValue(1n == true, true, "1n == true");
29 assert.sameValue(true == 1n, true, "true == 1n");
30 assert.sameValue(2n == false, false, "2n == false");
31 assert.sameValue(false == 2n, false, "false == 2n");
32 assert.sameValue(2n == true, false, "2n == true");
33 assert.sameValue(true == 2n, false, "true == 2n");