Test cases for different tree layout algorithms
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
layout_test.js
package.json

README.md

tree-layout-tester

Checks a tree layout produces results consistent with a known tree ordering

Install

npm install tree-layout-tester

Example

var layoutTester = require("tree-layout-tester")

//Your tree layout
var myLayout =  // ...  something

require("tap").test("my layout test", function(t) {

  var T = layoutTester.T
    , testTree = layoutTester.bind({}, t, myLayout)

  //Enforce that tree layout respects this ordering
  testTree(T(0, T(1), T(2))

  t.end()
})

API

require("tree-layout-tester").T(v, left, right)

Creates a tree with index v and the given left/right subtrees

require("tree-layout-tester")(tap, layout, root)

Tests the layout against the tree given by root. tap is a pointer to a tap object.

License

(c) 2013 Mikola Lysenko. MIT License