diff options
Diffstat (limited to 'sort/insertion_test.go')
| -rw-r--r-- | sort/insertion_test.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sort/insertion_test.go b/sort/insertion_test.go index 4b503b8..afec414 100644 --- a/sort/insertion_test.go +++ b/sort/insertion_test.go @@ -5,8 +5,16 @@ import ( "testing" ) -func BenchmarkInsertion1000(b *testing.B) { +func BenchmarkInsertion(b *testing.B) { + benchmark("Insertion", 10, Insertion, b) + benchmark("Insertion", 100, Insertion, b) + benchmark("Insertion", 1000, Insertion, b) +} + +func TestInsertion1000(t *testing.T) { a := ds.RandomIntegers(1000, 1000) - b.ResetTimer() - Insertion(a) + a = Insertion(a) + if !Sorted(a) { + t.Errorf("Array not sorted: %v", a) + } } |
