From aa7200a1f1e78b859ebb00ceb0cbf3fa960ed363 Mon Sep 17 00:00:00 2001 From: decanus Date: Sun, 16 Feb 2020 18:03:44 +0100 Subject: [PATCH] using intsaresorted --- sorting/sort_test.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/sorting/sort_test.go b/sorting/sort_test.go index 3388347..0d51e6a 100644 --- a/sorting/sort_test.go +++ b/sorting/sort_test.go @@ -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 -}