MCPcopy Create free account
hub / github.com/arnauddri/algorithms / TestDirectedDfs

Function TestDirectedDfs

algorithms/graphs/dfs/dfs_test.go:32–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func 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}

Callers

nothing calls this directly

Calls 3

DirectedDfsFunction · 0.85
AddVertexMethod · 0.80
AddEdgeMethod · 0.80

Tested by

no test coverage detected