(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestDirectedDfs(t *testing.T) { |
| 33 | h := graph.NewDirected() |
| 34 | |
| 35 | for i := 0; i < 10; i++ { |
| 36 | v := graph.VertexId(i) |
| 37 | h.AddVertex(v) |
| 38 | } |
| 39 | |
| 40 | for i := 0; i < 9; i++ { |
| 41 | h.AddEdge(graph.VertexId(i), graph.VertexId(i+1), 1) |
| 42 | } |
| 43 | |
| 44 | counter := 0 |
| 45 | DirectedDfs(h, graph.VertexId(3), func(v graph.VertexId) { |
| 46 | counter += int(v) |
| 47 | }) |
| 48 | |
| 49 | if counter != 42 { |
| 50 | fmt.Println(counter) |
| 51 | t.Error() |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected