-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquicksort_test.go
More file actions
48 lines (45 loc) · 773 Bytes
/
quicksort_test.go
File metadata and controls
48 lines (45 loc) · 773 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
36
37
38
39
40
41
42
43
44
45
46
47
48
package algorithms
import (
"fmt"
"reflect"
"testing"
)
func TestQuicksort(t *testing.T) {
tests := []struct {
name string
arr []int
want []int
}{
{"first",
[]int{2, 1, 4, 3, 7, 6},
[]int{1, 2, 3, 4, 6, 7},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
fmt.Println(tt.arr)
Quicksort(tt.arr)
fmt.Println(tt.arr)
if !reflect.DeepEqual(tt.arr, tt.want) {
t.Fatalf("quisort want %v and got %v", tt.want, tt.arr)
}
})
}
}
func Test_quicksort(t *testing.T) {
type args struct {
}
tests := []struct {
name string
arr []int
left int
right int
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
quicksort(tt.arr, tt.left, tt.right)
})
}
}