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