function test(functor, expected) {
var result;
try {
result = functor();
} catch(e) {
console.error(functorFunction.prototype.toString.call(functor), e, expected);
}
// Object comparison hack
if (JSON.stringify(result) !== JSON.stringify(expected)) {
console.error(functorFunction.prototype.toString.call(functor), result, expected);
}
}
// O(N^2)
test(function (){return heightSlow([4, -1, 4, 1, 1])}, 3);
test(function (){return heightSlow([-1, 0, 4, 0, 3])}, 4);
// Theta(N)
test(function (){return heightFast([4, -1, 4, 1, 1])}, 3);
test(function (){return heightFast([-1, 0, 4, 0, 3])}, 4);