tor-browser

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

bigint-and-object.js (4721B)


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