Skip to content

Commit 10ae94a

Browse files
committed
Create best-hand_test.go
1 parent 84f3480 commit 10ae94a

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

best-hand_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package leetcode_solutions_golang
2+
3+
import "testing"
4+
5+
func Test_bestHand(t *testing.T) {
6+
type args struct {
7+
ranks []int
8+
suits []byte
9+
}
10+
tests := []struct {
11+
name string
12+
args args
13+
want string
14+
}{
15+
{
16+
name: "test case 1",
17+
args: args{
18+
ranks: []int{1, 1, 1, 2, 2},
19+
suits: []byte{'S', 'H', 'C', 'D', 'C'},
20+
},
21+
want: "Three of a Kind",
22+
},
23+
{
24+
name: "test case 2",
25+
args: args{
26+
ranks: []int{1, 1, 2, 3},
27+
suits: []byte{'S', 'C', 'D', 'C'},
28+
},
29+
want: "Pair",
30+
},
31+
{
32+
name: "test case 3",
33+
args: args{
34+
ranks: []int{1, 2, 3, 4, 5},
35+
suits: []byte{'S', 'H', 'C', 'D', 'C'},
36+
},
37+
want: "High Card",
38+
},
39+
{
40+
name: "test case 4",
41+
args: args{
42+
ranks: []int{1, 2, 3, 4, 5},
43+
suits: []byte{'S', 'S', 'S', 'S', 'S'},
44+
},
45+
want: "Flush",
46+
},
47+
}
48+
for _, tt := range tests {
49+
t.Run(tt.name, func(t *testing.T) {
50+
if got := bestHand(tt.args.ranks, tt.args.suits); got != tt.want {
51+
t.Errorf("bestHand() = %v, want %v", got, tt.want)
52+
}
53+
})
54+
}
55+
}

0 commit comments

Comments
 (0)