unit test for tree