gecko-dev/devtools/client/shared/test/browser_flame-graph-utils-hash.js
J. Ryan Stinnett efe328f1b2 Bug 912121 - Rewrite require / import to match source tree. rs=devtools
In a following patch, all DevTools moz.build files will use DevToolsModules to
install JS modules at a path that corresponds directly to their source tree
location.  Here we rewrite all require and import calls to match the new
location that these files are installed to.

--HG--
extra : commitid : F2ItGm8ptRz
extra : rebase_source : b082fe4bf77e22e297e303fc601165ceff1c4cbc
2015-09-21 12:04:18 -05:00

25 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests if (idle) nodes are added when necessary in the flame graph data.
var {FlameGraphUtils} = require("devtools/client/shared/widgets/FlameGraph");
var test = Task.async(function*() {
let hash1 = FlameGraphUtils._getStringHash("abc");
let hash2 = FlameGraphUtils._getStringHash("acb");
let hash3 = FlameGraphUtils._getStringHash(Array.from(Array(100000)).join("a"));
let hash4 = FlameGraphUtils._getStringHash(Array.from(Array(100000)).join("b"));
isnot(hash1, hash2, "The hashes should not be equal (1).");
isnot(hash2, hash3, "The hashes should not be equal (2).");
isnot(hash3, hash4, "The hashes should not be equal (3).");
ok(Number.isInteger(hash1), "The hashes should be integers, not Infinity or NaN (1).");
ok(Number.isInteger(hash2), "The hashes should be integers, not Infinity or NaN (2).");
ok(Number.isInteger(hash3), "The hashes should be integers, not Infinity or NaN (3).");
ok(Number.isInteger(hash4), "The hashes should be integers, not Infinity or NaN (4).");
finish();
});