-
Notifications
You must be signed in to change notification settings - Fork 0
/
best-hand_test.go
55 lines (53 loc) · 1015 Bytes
/
best-hand_test.go
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
49
50
51
52
53
54
55
package leetcode_solutions_golang
import "testing"
func Test_bestHand(t *testing.T) {
type args struct {
ranks []int
suits []byte
}
tests := []struct {
name string
args args
want string
}{
{
name: "test case 1",
args: args{
ranks: []int{1, 1, 1, 2, 2},
suits: []byte{'S', 'H', 'C', 'D', 'C'},
},
want: "Three of a Kind",
},
{
name: "test case 2",
args: args{
ranks: []int{1, 1, 2, 3},
suits: []byte{'S', 'C', 'D', 'C'},
},
want: "Pair",
},
{
name: "test case 3",
args: args{
ranks: []int{1, 2, 3, 4, 5},
suits: []byte{'S', 'H', 'C', 'D', 'C'},
},
want: "High Card",
},
{
name: "test case 4",
args: args{
ranks: []int{1, 2, 3, 4, 5},
suits: []byte{'S', 'S', 'S', 'S', 'S'},
},
want: "Flush",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := bestHand(tt.args.ranks, tt.args.suits); got != tt.want {
t.Errorf("bestHand() = %v, want %v", got, tt.want)
}
})
}
}