-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort_test.go
More file actions
35 lines (27 loc) · 924 Bytes
/
Copy pathsort_test.go
File metadata and controls
35 lines (27 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package algorithm
import "testing"
var sortNumbers []int = []int{1, 20, 18, 12, 12, 21, 109, 22, 211, 29}
func TestBubbleSortFromSort (t *testing.T) {
sorted := BubbleSortFromSort(sortNumbers)
if IsSorted(sorted) {
t.Log("sort success by BubbleSortFromSort\n")
return
}
t.Errorf("sort fail by BubbleSortFromSort\n, input is %v\n, output is %v\n", sortNumbers, sorted)
}
func TestSelectSortFromSort(t *testing.T) {
sorted := SelectSortFromSort(sortNumbers)
if IsSorted(sorted) {
t.Log("sort success by SelectSortFromSort\n")
return
}
t.Errorf("sort fail by SelectSortFromSort\n, input is %v\n, output is %v\n", sortNumbers, sorted)
}
func TestQuickSortFromSort(t *testing.T) {
sorted := QuickSortFromSort(sortNumbers)
if IsSorted(sorted) {
t.Log("sort success by QuickSortFromSort\n")
return
}
t.Errorf("sort fail by QuickSortFromSort\n, input is %v\n, output is %v\n", sortNumbers, sorted)
}