tor-browser

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

test_census_diff_01.js (1098B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test diffing census reports of breakdown by "internalType".
      6 
      7 const BREAKDOWN = {
      8  by: "internalType",
      9  then: { by: "count", count: true, bytes: true },
     10 };
     11 
     12 const REPORT1 = {
     13  JSObject: {
     14    count: 10,
     15    bytes: 100,
     16  },
     17  "js::Shape": {
     18    count: 50,
     19    bytes: 500,
     20  },
     21  JSString: {
     22    count: 0,
     23    bytes: 0,
     24  },
     25  "js::LazyScript": {
     26    count: 1,
     27    bytes: 10,
     28  },
     29 };
     30 
     31 const REPORT2 = {
     32  JSObject: {
     33    count: 11,
     34    bytes: 110,
     35  },
     36  "js::Shape": {
     37    count: 51,
     38    bytes: 510,
     39  },
     40  JSString: {
     41    count: 1,
     42    bytes: 1,
     43  },
     44  "js::BaseShape": {
     45    count: 1,
     46    bytes: 42,
     47  },
     48 };
     49 
     50 const EXPECTED = {
     51  JSObject: {
     52    count: 1,
     53    bytes: 10,
     54  },
     55  "js::Shape": {
     56    count: 1,
     57    bytes: 10,
     58  },
     59  JSString: {
     60    count: 1,
     61    bytes: 1,
     62  },
     63  "js::LazyScript": {
     64    count: -1,
     65    bytes: -10,
     66  },
     67  "js::BaseShape": {
     68    count: 1,
     69    bytes: 42,
     70  },
     71 };
     72 
     73 function run_test() {
     74  assertDiff(BREAKDOWN, REPORT1, REPORT2, EXPECTED);
     75 }