split util/slice
This commit is contained in:
@@ -68,14 +68,3 @@ func ContainsString(slice []string, s string, modifier func(s string) string) bo
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Int64Slice attaches the methods of Interface to []int64,
|
||||
// sorting in increasing order.
|
||||
type Int64Slice []int64
|
||||
|
||||
func (p Int64Slice) Len() int { return len(p) }
|
||||
func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] }
|
||||
func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
|
||||
// Sorts []int64 in increasing order
|
||||
func SortInts64(a []int64) { sort.Sort(Int64Slice(a)) }
|
||||
|
@@ -89,12 +89,3 @@ func TestShuffleStrings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSortInts64(t *testing.T) {
|
||||
src := []int64{10, 1, 2, 3, 4, 5, 6}
|
||||
expected := []int64{1, 2, 3, 4, 5, 6, 10}
|
||||
SortInts64(src)
|
||||
if !reflect.DeepEqual(src, expected) {
|
||||
t.Errorf("func Ints64 didnt sort correctly, %v !- %v", src, expected)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user