tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bigint-and-boolean.js (1923B)


      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 equality 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, false, 'The result of (-1n == false) is false');
     17 assert.sameValue(false == -1n, false, 'The result of (false == -1n) is false');
     18 assert.sameValue(-1n == true, false, 'The result of (-1n == true) is false');
     19 assert.sameValue(true == -1n, false, 'The result of (true == -1n) is false');
     20 assert.sameValue(0n == false, true, 'The result of (0n == false) is true');
     21 assert.sameValue(false == 0n, true, 'The result of (false == 0n) is true');
     22 assert.sameValue(0n == true, false, 'The result of (0n == true) is false');
     23 assert.sameValue(true == 0n, false, 'The result of (true == 0n) is false');
     24 assert.sameValue(1n == false, false, 'The result of (1n == false) is false');
     25 assert.sameValue(false == 1n, false, 'The result of (false == 1n) is false');
     26 assert.sameValue(1n == true, true, 'The result of (1n == true) is true');
     27 assert.sameValue(true == 1n, true, 'The result of (true == 1n) is true');
     28 assert.sameValue(2n == false, false, 'The result of (2n == false) is false');
     29 assert.sameValue(false == 2n, false, 'The result of (false == 2n) is false');
     30 assert.sameValue(2n == true, false, 'The result of (2n == true) is false');
     31 assert.sameValue(true == 2n, false, 'The result of (true == 2n) is false');
     32 
     33 reportCompare(0, 0);