test for balanced trees