graph/internal/ordered: replace slice sort types with sort.Slice calls

This commit is contained in:
Dan Kortschak
2021-10-08 20:07:45 +10:30
parent 2ef9ae2cf1
commit 8f6a7707f4
40 changed files with 185 additions and 230 deletions

View File

@@ -7,7 +7,6 @@ package traverse
import (
"fmt"
"reflect"
"sort"
"strings"
"testing"
@@ -172,7 +171,7 @@ func TestBreadthFirst(t *testing.T) {
t.Errorf("unexpected final node for test %d:\ngot: %v\nwant: %v", i, final, test.final)
}
for _, l := range got {
sort.Sort(ordered.Int64s(l))
ordered.Int64s(l)
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("unexpected BFS level structure for test %d:\ngot: %v\nwant: %v", i, got, test.want)
@@ -372,10 +371,10 @@ func TestWalkAll(t *testing.T) {
for k, n := range c {
ids[k] = n.ID()
}
sort.Sort(ordered.Int64s(ids))
ordered.Int64s(ids)
got[j] = ids
}
sort.Sort(ordered.BySliceValues(got))
ordered.BySliceValues(got)
if !reflect.DeepEqual(got, test.want) {
t.Errorf("unexpected connected components for test %d using %T:\ngot: %v\nwant:%v", i, w, got, test.want)
}