using intsaresorted

pull/24/head
decanus 4 years ago
parent ddaf7f7c38
commit aa7200a1f1
No known key found for this signature in database
GPG Key ID: E95B8C69228FF5B4

@ -1,6 +1,7 @@
package main
import (
"sort"
"testing"
utils "github.com/0xAX/go-algorithms"
@ -29,7 +30,7 @@ func TestSort(t *testing.T) {
tt.f(arr)
if !isSorted(arr) {
if !sort.IntsAreSorted(arr) {
t.Errorf("%v is not sorted", arr)
}
})
@ -51,13 +52,3 @@ func BenchmarkSort(b *testing.B) {
})
}
}
func isSorted(arr []int) bool {
for i := 0; i < len(arr) - 1; i++ {
if arr[i] > arr[i + 1] {
return false
}
}
return true
}

Loading…
Cancel
Save