tree-layout-tester
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -15,3 +15,3 @@ //Simple tree data structure | ||
var n = root.n | ||
t.equals(layout.root(n), root.v) | ||
t.equals(layout.root(n), root.v, "root " + n) | ||
var ptr = layout.begin(n) | ||
@@ -34,23 +34,20 @@ | ||
function visit(node, parent) { | ||
console.log(node.v, node.h) | ||
t.equals(layout.height(n, node.v), node.h) | ||
t.equals(layout.height(n, node.v), node.h, "height " + n + ", " + node.v) | ||
if(parent) { | ||
t.equals(layout.parent(n, node.v), parent.v) | ||
t.equals(layout.parent(n, node.v), parent.v, "parent " + n + ", " + node.v) | ||
} | ||
if(node.left) { | ||
t.equals(layout.left(n, node.v), node.left.v) | ||
t.equals(layout.left(n, node.v), node.left.v, "left " + n + ", " + node.v) | ||
visit(node.left, node) | ||
} | ||
t.equals(ptr, node.v) | ||
t.equals(ptr, node.v, "next " + n + ", " + node.v) | ||
ptr = layout.next(n, ptr) | ||
if(node.right) { | ||
t.equals(layout.right(n, node.v), node.right.v) | ||
t.equals(layout.right(n, node.v), node.right.v, "right " + n + ", " + node.v) | ||
visit(node.right, node) | ||
} | ||
t.equals(layout.lo(n, node.v), leftAncestor(node)) | ||
t.equals(layout.hi(n, node.v), rightAncestor(node)) | ||
} | ||
visit(root, null) | ||
t.equals(layout.end(n), ptr) | ||
t.equals(layout.end(n), ptr, "end " + n) | ||
@@ -63,3 +60,3 @@ //Do a reverse traversal | ||
ptr = layout.prev(n, ptr) | ||
t.equals(ptr, node.v) | ||
t.equals(ptr, node.v, "prev " + n + ", " + node.v) | ||
if(node.left) { | ||
@@ -70,3 +67,3 @@ rvisit(node.left) | ||
rvisit(root) | ||
t.equals(layout.begin(n), ptr) | ||
t.equals(layout.begin(n), ptr, "begin " + n) | ||
} | ||
@@ -73,0 +70,0 @@ |
{ | ||
"name": "tree-layout-tester", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Tests cases for various tree layout algorithms", | ||
@@ -5,0 +5,0 @@ "main": "layout_test.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3052
60