tor-browser

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

test_census_diff_04.js (951B)


      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 "objectClass".
      6 
      7 const BREAKDOWN = {
      8  by: "objectClass",
      9  then: { by: "count", count: true, bytes: true },
     10  other: { by: "count", count: true, bytes: true },
     11 };
     12 
     13 const REPORT1 = {
     14  Array: {
     15    count: 1,
     16    bytes: 100,
     17  },
     18  Function: {
     19    count: 10,
     20    bytes: 10,
     21  },
     22  other: {
     23    count: 10,
     24    bytes: 100,
     25  },
     26 };
     27 
     28 const REPORT2 = {
     29  Object: {
     30    count: 1,
     31    bytes: 100,
     32  },
     33  Function: {
     34    count: 20,
     35    bytes: 20,
     36  },
     37  other: {
     38    count: 10,
     39    bytes: 100,
     40  },
     41 };
     42 
     43 const EXPECTED = {
     44  Array: {
     45    count: -1,
     46    bytes: -100,
     47  },
     48  Function: {
     49    count: 10,
     50    bytes: 10,
     51  },
     52  other: {
     53    count: 0,
     54    bytes: 0,
     55  },
     56  Object: {
     57    count: 1,
     58    bytes: 100,
     59  },
     60 };
     61 
     62 function run_test() {
     63  assertDiff(BREAKDOWN, REPORT1, REPORT2, EXPECTED);
     64 }