Add unit tests for compute_visit_tree.

Add unit tests for compute_visit_tree.