diff options
| author | Paul Buetow <paul@buetow.org> | 2020-07-14 09:34:50 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2020-07-14 09:34:50 +0100 |
| commit | aee630b03f48a9f528a4a50e9dcb0fdc8ef20aa5 (patch) | |
| tree | 152644259dd29dee9dac930cca9f26e4b9422112 /sort/selection_test.go | |
| parent | 554a7a259f3feefb586374ac5a3b57acc99a4446 (diff) | |
add bench helper
Diffstat (limited to 'sort/selection_test.go')
| -rw-r--r-- | sort/selection_test.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sort/selection_test.go b/sort/selection_test.go index 3881850..c5d6beb 100644 --- a/sort/selection_test.go +++ b/sort/selection_test.go @@ -5,8 +5,16 @@ import ( "testing" ) -func BenchmarkSelection1000(b *testing.B) { +func BenchmarkSelection(b *testing.B) { + benchmark("Selection", 10, Selection, b) + benchmark("Selection", 100, Selection, b) + benchmark("Selection", 1000, Selection, b) +} + +func TestSelection1000(t *testing.T) { a := ds.RandomIntegers(1000, 1000) - b.ResetTimer() - Selection(a) + a = Selection(a) + if !Sorted(a) { + t.Errorf("Array not sorted: %v", a) + } } |
