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