graph/path: make tests parallel
MODIFY
graph/path/a_star_test.go
graph/path/a_star_test.go
@@ -125,6 +125,7 @@ var aStarTests = []struct {
}
func TestAStar(t *testing.T) {
+ t.Parallel()
for _, test := range aStarTests {
pt, _ := AStar(simple.Node(test.s), simple.Node(test.t), test.g, test.heuristic)
@@ -153,6 +154,7 @@ func TestAStar(t *testing.T) {
}
func TestExhaustiveAStar(t *testing.T) {
+ t.Parallel()
g := simple.NewWeightedUndirectedGraph(0, math.Inf(1))
nodes := []locatedNode{
{id: 1, x: 0, y: 6},
@@ -244,6 +246,7 @@ func isMonotonic(g UndirectedWeightLister, h Heuristic) (ok bool, at graph.Edge,
}
func TestAStarNullHeuristic(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {

MODIFY
graph/path/bellman_ford_moore_test.go
graph/path/bellman_ford_moore_test.go
@@ -14,6 +14,7 @@ import (
)
func TestBellmanFordFrom(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {

MODIFY
graph/path/dijkstra_test.go
graph/path/dijkstra_test.go
@@ -18,6 +18,7 @@ import (
)
func TestDijkstraFrom(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {
@@ -101,6 +102,7 @@ type incremental struct {
}
func TestDijkstraAllPaths(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {
@@ -197,6 +199,7 @@ func TestDijkstraAllPaths(t *testing.T) {
}
func TestAllShortestAbsentNode(t *testing.T) {
+ t.Parallel()
g := simple.NewUndirectedGraph()
g.SetEdge(simple.Edge{F: simple.Node(1), T: simple.Node(2)})
paths := DijkstraAllPaths(g)

MODIFY
graph/path/disjoint_test.go
graph/path/disjoint_test.go
@@ -9,6 +9,7 @@ import (
)
func TestDisjointSetMakeSet(t *testing.T) {
+ t.Parallel()
ds := newDisjointSet()
if ds.master == nil {
t.Fatal("Internal disjoint set map erroneously nil")
@@ -39,6 +40,7 @@ func TestDisjointSetMakeSet(t *testing.T) {
}
func TestDisjointSetFind(t *testing.T) {
+ t.Parallel()
ds := newDisjointSet()
ds.makeSet(3)
@@ -50,6 +52,7 @@ func TestDisjointSetFind(t *testing.T) {
}
func TestUnion(t *testing.T) {
+ t.Parallel()
ds := newDisjointSet()
ds.makeSet(3)

MODIFY
graph/path/dynamic/dstarlite_test.go
graph/path/dynamic/dstarlite_test.go
@@ -26,6 +26,7 @@ var (
)
func TestDStarLiteNullHeuristic(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
// Skip zero-weight cycles.
if strings.HasPrefix(test.Name, "zero-weight") {
@@ -552,6 +553,7 @@ var dynamicDStarLiteTests = []struct {
}
func TestDStarLiteDynamic(t *testing.T) {
+ t.Parallel()
for i, test := range dynamicDStarLiteTests {
for _, remember := range test.remember {
l := &testgraphs.LimitedVisionGrid{

MODIFY
graph/path/floydwarshall_test.go
graph/path/floydwarshall_test.go
@@ -16,6 +16,7 @@ import (
)
func TestFloydWarshall(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {

MODIFY
graph/path/internal/testgraphs/grid_test.go
graph/path/internal/testgraphs/grid_test.go
@@ -24,6 +24,7 @@ type node int64
func (n node) ID() int64 { return int64(n) }
func TestGrid(t *testing.T) {
+ t.Parallel()
g := NewGrid(4, 4, false)
got := g.String()

MODIFY
graph/path/internal/testgraphs/limited_test.go
graph/path/internal/testgraphs/limited_test.go
@@ -1154,6 +1154,7 @@ var limitedVisionTests = []struct {
}
func TestLimitedVisionGrid(t *testing.T) {
+ t.Parallel()
for i, test := range limitedVisionTests {
l := &LimitedVisionGrid{
Grid: test.g,

MODIFY
graph/path/johnson_apsp_test.go
graph/path/johnson_apsp_test.go
@@ -16,6 +16,7 @@ import (
)
func TestJohnsonAllPaths(t *testing.T) {
+ t.Parallel()
for _, test := range testgraphs.ShortestPathTests {
g := test.Graph()
for _, e := range test.Edges {

MODIFY
graph/path/spanning_tree_test.go
graph/path/spanning_tree_test.go
@@ -282,12 +282,14 @@ func testMinumumSpanning(mst func(dst WeightedBuilder, g spanningGraph) float64,
}
func TestKruskal(t *testing.T) {
+ t.Parallel()
testMinumumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
return Kruskal(dst, g)
}, t)
}
func TestPrim(t *testing.T) {
+ t.Parallel()
testMinumumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
return Prim(dst, g)
}, t)

MODIFY
graph/path/yen_ksp_test.go
graph/path/yen_ksp_test.go
@@ -179,6 +179,7 @@ func pathIDs(paths [][]graph.Node) [][]int64 {
}
func TestYenKSP(t *testing.T) {
+ t.Parallel()
for _, test := range yenShortestPathTests {
g := test.graph()
for _, e := range test.edges {

graph/path: make tests parallel