2021-12-06 08:01:25 +02:00
|
|
|
package sorting
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2021-12-16 17:46:10 +02:00
|
|
|
func TestSelectionSlice(t *testing.T) {
|
|
|
|
CheckSliceSorter(Selection[int])
|
2021-12-06 08:01:25 +02:00
|
|
|
}
|
2021-12-14 12:35:28 +02:00
|
|
|
|
|
|
|
func BenchmarkSelection(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2021-12-16 17:46:10 +02:00
|
|
|
BenchmarkSort(10000, Selection[int])
|
2021-12-14 12:35:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInsertion(t *testing.T) {
|
2021-12-16 17:46:10 +02:00
|
|
|
CheckSliceSorter(Insertion[int])
|
2021-12-14 12:35:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkInsertion(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2021-12-16 17:46:10 +02:00
|
|
|
BenchmarkSort(10000, Insertion[int])
|
2021-12-14 12:35:28 +02:00
|
|
|
}
|
|
|
|
}
|
2021-12-14 14:01:44 +02:00
|
|
|
|
|
|
|
func TestShell(t *testing.T) {
|
2021-12-16 17:46:10 +02:00
|
|
|
CheckSliceSorter(Shell[int])
|
2021-12-14 14:01:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkShell(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
2021-12-16 17:46:10 +02:00
|
|
|
BenchmarkSort(10000, Shell[int])
|
2021-12-14 14:01:44 +02:00
|
|
|
}
|
|
|
|
}
|
2021-12-16 19:37:48 +02:00
|
|
|
|
|
|
|
func TestMerge(t *testing.T) {
|
|
|
|
CheckSliceSorter(Merge[int])
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMerge(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
BenchmarkSort(10000, Merge[int])
|
|
|
|
}
|
|
|
|
}
|