MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / TestDijkstra

Function TestDijkstra

graph/dijkstra_test.go:36–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func TestDijkstra(t *testing.T) {
37 for _, tc := range tc_dijkstra {
38 t.Run(tc.name, func(t *testing.T) {
39 var graph Graph
40 for _, edge := range tc.edges {
41 graph.AddWeightedEdge(edge[0], edge[1], edge[2])
42 }
43
44 actual, _ := graph.Dijkstra(tc.node0, tc.node1)
45 if actual != tc.expected {
46 t.Errorf("expected %d, got %d, from node %d to %d, with %v",
47 tc.expected, actual, tc.node0, tc.node1, tc.edges)
48 }
49 })
50 }
51}

Callers

nothing calls this directly

Calls 2

AddWeightedEdgeMethod · 0.95
DijkstraMethod · 0.95

Tested by

no test coverage detected