write tests for dfs iterator