tor-browser

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

bigint-and-object.js (4783B)


      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: Strict equality comparison of BigInt values and non-primitive objects
      5 esid: sec-strict-equality-comparison
      6 info: |
      7  1. If Type(x) is different from Type(y), return false.
      8 
      9 features: [BigInt]
     10 ---*/
     11 assert.sameValue(0n === Object(0n), false, 'The result of (0n === Object(0n)) is false');
     12 assert.sameValue(Object(0n) === 0n, false, 'The result of (Object(0n) === 0n) is false');
     13 assert.sameValue(0n === Object(1n), false, 'The result of (0n === Object(1n)) is false');
     14 assert.sameValue(Object(1n) === 0n, false, 'The result of (Object(1n) === 0n) is false');
     15 assert.sameValue(1n === Object(0n), false, 'The result of (1n === Object(0n)) is false');
     16 assert.sameValue(Object(0n) === 1n, false, 'The result of (Object(0n) === 1n) is false');
     17 assert.sameValue(1n === Object(1n), false, 'The result of (1n === Object(1n)) is false');
     18 assert.sameValue(Object(1n) === 1n, false, 'The result of (Object(1n) === 1n) is false');
     19 assert.sameValue(2n === Object(0n), false, 'The result of (2n === Object(0n)) is false');
     20 assert.sameValue(Object(0n) === 2n, false, 'The result of (Object(0n) === 2n) is false');
     21 assert.sameValue(2n === Object(1n), false, 'The result of (2n === Object(1n)) is false');
     22 assert.sameValue(Object(1n) === 2n, false, 'The result of (Object(1n) === 2n) is false');
     23 assert.sameValue(2n === Object(2n), false, 'The result of (2n === Object(2n)) is false');
     24 assert.sameValue(Object(2n) === 2n, false, 'The result of (Object(2n) === 2n) is false');
     25 assert.sameValue(0n === {}, false, 'The result of (0n === {}) is false');
     26 assert.sameValue({} === 0n, false, 'The result of (({}) === 0n) is false');
     27 
     28 assert.sameValue(0n === {
     29  valueOf: function() {
     30    return 0n;
     31  }
     32 }, false, 'The result of (0n === {valueOf: function() {return 0n;}}) is false');
     33 
     34 assert.sameValue({
     35  valueOf: function() {
     36    return 0n;
     37  }
     38 } === 0n, false, 'The result of (({valueOf: function() {return 0n;}}) === 0n) is false');
     39 
     40 assert.sameValue(0n === {
     41  valueOf: function() {
     42    return 1n;
     43  }
     44 }, false, 'The result of (0n === {valueOf: function() {return 1n;}}) is false');
     45 
     46 assert.sameValue({
     47  valueOf: function() {
     48    return 1n;
     49  }
     50 } === 0n, false, 'The result of (({valueOf: function() {return 1n;}}) === 0n) is false');
     51 
     52 assert.sameValue(0n === {
     53  toString: function() {
     54    return '0';
     55  }
     56 }, false, 'The result of (0n === {toString: function() {return "0";}}) is false');
     57 
     58 assert.sameValue({
     59  toString: function() {
     60    return '0';
     61  }
     62 } === 0n, false, 'The result of (({toString: function() {return "0";}}) === 0n) is false');
     63 
     64 assert.sameValue(0n === {
     65  toString: function() {
     66    return '1';
     67  }
     68 }, false, 'The result of (0n === {toString: function() {return "1";}}) is false');
     69 
     70 assert.sameValue({
     71  toString: function() {
     72    return '1';
     73  }
     74 } === 0n, false, 'The result of (({toString: function() {return "1";}}) === 0n) is false');
     75 
     76 assert.sameValue(900719925474099101n === {
     77  valueOf: function() {
     78    return 900719925474099101n;
     79  }
     80 }, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099101n;}}) is false');
     81 
     82 assert.sameValue({
     83  valueOf: function() {
     84    return 900719925474099101n;
     85  }
     86 } === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) === 900719925474099101n) is false');
     87 
     88 assert.sameValue(900719925474099101n === {
     89  valueOf: function() {
     90    return 900719925474099102n;
     91  }
     92 }, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099102n;}}) is false');
     93 
     94 assert.sameValue({
     95  valueOf: function() {
     96    return 900719925474099102n;
     97  }
     98 } === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099102n;}}) === 900719925474099101n) is false');
     99 
    100 assert.sameValue(900719925474099101n === {
    101  toString: function() {
    102    return '900719925474099101';
    103  }
    104 }, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099101";}}) is false');
    105 
    106 assert.sameValue({
    107  toString: function() {
    108    return '900719925474099101';
    109  }
    110 } === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) === 900719925474099101n) is false');
    111 
    112 assert.sameValue(900719925474099101n === {
    113  toString: function() {
    114    return '900719925474099102';
    115  }
    116 }, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099102";}}) is false');
    117 
    118 assert.sameValue({
    119  toString: function() {
    120    return '900719925474099102';
    121  }
    122 } === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099102";}}) === 900719925474099101n) is false');
    123 
    124 reportCompare(0, 0);