Function to test that a tree's height is coherent