test_DominatorTree_04.js (930B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 // Test that we can get the retained sizes of dominator trees. 6 7 function run_test() { 8 const dominatorTree = saveHeapSnapshotAndComputeDominatorTree(); 9 equal( 10 typeof dominatorTree.getRetainedSize, 11 "function", 12 "getRetainedSize should be a function" 13 ); 14 15 const size = dominatorTree.getRetainedSize(dominatorTree.root); 16 ok(size, "should get a size for the root"); 17 equal(typeof size, "number", "retained sizes should be a number"); 18 equal(Math.floor(size), size, "size should be an integer"); 19 Assert.greater(size, 0, "size should be positive"); 20 Assert.lessOrEqual( 21 size, 22 Math.pow(2, 64), 23 "size should be less than or equal to 2^64" 24 ); 25 26 const bad = dominatorTree.getRetainedSize(1); 27 equal(bad, null, "null is returned for unknown node ids"); 28 29 do_test_finished(); 30 }