MCPcopy
hub / github.com/purpleidea/mgmt / TestAddEdge1

Function TestAddEdge1

pgraph/pgraph_test.go:90–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestAddEdge1(t *testing.T) {
91 g, _ := NewGraph("g")
92
93 v1 := NV("v1")
94 v2 := NV("v2")
95
96 g.AddVertex(v1)
97 g.AddVertex(v2)
98
99 if i := g.NumEdges(); i != 0 {
100 t.Errorf("should have 0 edges but got %d", i)
101 }
102
103 e1 := NE("e1")
104 g.AddEdge(v1, v2, e1)
105
106 if i := g.NumEdges(); i != 1 {
107 t.Errorf("should have 1 edge but got %d", i)
108 }
109}
110
111func TestDFS1(t *testing.T) {
112 g, _ := NewGraph("g3")

Callers

nothing calls this directly

Calls 6

AddVertexMethod · 0.95
NumEdgesMethod · 0.95
AddEdgeMethod · 0.95
NewGraphFunction · 0.85
NVFunction · 0.85
NEFunction · 0.70

Tested by

no test coverage detected