summaryrefslogtreecommitdiff
path: root/sort/selection_test.go
blob: c5d6beba0e42613150ddcc6ab0c594e20efd6d09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package sort

import (
	"algorithms/ds"
	"testing"
)

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)
	a = Selection(a)
	if !Sorted(a) {
		t.Errorf("Array not sorted: %v", a)
	}
}