mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
Add test function to intervaltree module.
This commit is contained in:
parent
a8c79d192a
commit
ed6417f6db
1 changed files with 28 additions and 0 deletions
28
vendor/intervaltree/core.js
vendored
28
vendor/intervaltree/core.js
vendored
|
@ -323,4 +323,32 @@ goog.scope(function() {
|
|||
// Constructors
|
||||
module.interval = makeInterval;
|
||||
module.create = makeTree;
|
||||
|
||||
|
||||
module.test = function() {
|
||||
// const util = require('util');
|
||||
|
||||
console.time("init");
|
||||
const tree = module.create([
|
||||
[1,5], [-5, 10], [4, 9],
|
||||
[10,14], [-10, 1], [9, 22],
|
||||
]);
|
||||
console.timeEnd("init");
|
||||
|
||||
console.dir(tree, { depth: 5});
|
||||
|
||||
const n = 6;
|
||||
console.time("search")
|
||||
console.log("result to", n, "=>", tree.search(n));
|
||||
console.timeEnd("search")
|
||||
|
||||
console.time("remove");
|
||||
// tree.remove([4,9]);
|
||||
tree.remove([9, 22]);
|
||||
tree.remove([-10, 1]);
|
||||
|
||||
console.dir(tree, { depth: 5});
|
||||
console.timeEnd("remove");
|
||||
};
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue