tor-browser

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

test_census_diff_05.js (867B)


      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 "allocationStack".
      6 
      7 const BREAKDOWN = {
      8  by: "allocationStack",
      9  then: { by: "count", count: true, bytes: true },
     10  noStack: { by: "count", count: true, bytes: true },
     11 };
     12 
     13 const stack1 = saveStack();
     14 const stack2 = saveStack();
     15 const stack3 = saveStack();
     16 
     17 const REPORT1 = new Map([
     18  [stack1, { count: 10, bytes: 100 }],
     19  [stack2, { count: 1, bytes: 10 }],
     20 ]);
     21 
     22 const REPORT2 = new Map([
     23  [stack2, { count: 10, bytes: 100 }],
     24  [stack3, { count: 1, bytes: 10 }],
     25 ]);
     26 
     27 const EXPECTED = new Map([
     28  [stack1, { count: -10, bytes: -100 }],
     29  [stack2, { count: 9, bytes: 90 }],
     30  [stack3, { count: 1, bytes: 10 }],
     31 ]);
     32 
     33 function run_test() {
     34  assertDiff(BREAKDOWN, REPORT1, REPORT2, EXPECTED);
     35 }