0
Fork 0
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:
Andrey Antukh 2016-06-08 21:21:06 +03:00
parent a8c79d192a
commit ed6417f6db
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -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");
};
});