(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestAddNRemoveEdge(t *testing.T) { |
| 76 | dag := NewDAG() |
| 77 | added := dag.AddEdge(RealEdge(nil, nil)) |
| 78 | if added { |
| 79 | t.Error("should return false if nil edge added") |
| 80 | } |
| 81 | v1, v2 := 3, 5 |
| 82 | e1 := RealEdge(v1, v2) |
| 83 | e2 := RealEdge(v1, v2) |
| 84 | added = dag.AddEdge(e1) |
| 85 | if !added { |
| 86 | t.Errorf("edge %v should be added", e1) |
| 87 | } |
| 88 | added = dag.AddEdge(e2) |
| 89 | if !added { |
| 90 | t.Errorf("edge %v should be added", e2) |
| 91 | } |
| 92 | if len(dag.edges) != 1 { |
| 93 | t.Error("edge add failed") |
| 94 | } |
| 95 | if dag.edges[e1] != e1 { |
| 96 | t.Error("edge add failed") |
| 97 | } |
| 98 | |
| 99 | removed := dag.RemoveEdge(e2) |
| 100 | if !removed { |
| 101 | t.Errorf("remove edge %v failed", e2) |
| 102 | } |
| 103 | if len(dag.edges) != 0 { |
| 104 | t.Errorf("remove edge %v failed", e2) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func TestXConnect(t *testing.T) { |
| 109 | dag := NewDAG() |
nothing calls this directly
no test coverage detected
searching dependent graphs…