-
Notifications
You must be signed in to change notification settings - Fork 0
/
straight_test.go
109 lines (94 loc) · 2.64 KB
/
straight_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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package main
import (
"testing"
)
func TestStraightHandFlopRiver(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"A", "", 12}, {"10", "", 8}},
[3]Card{{"Q", "", 10}, {"K", "", 11}, {"10", "", 8}},
[1]Card{{"J", "", 9}},
[1]Card{{"9", "", 7}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "A" && cards[4].ID == "10" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}
func TestStraightFlopTurnRiver(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"9", "", 7}, {"5", "", 3}},
[3]Card{{"Q", "", 10}, {"K", "", 11}, {"10", "", 8}},
[1]Card{{"J", "", 9}},
[1]Card{{"A", "", 12}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "A" && cards[4].ID == "10" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}
func TestStraightAllCards(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"2", "", 0}, {"5", "", 3}},
[3]Card{{"3", "", 1}, {"7", "", 5}, {"8", "", 6}},
[1]Card{{"4", "", 2}},
[1]Card{{"6", "", 4}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "8" && cards[4].ID == "4" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}
func TestStraightLowerWithAces(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"2", "", 1}, {"5", "", 4}},
[3]Card{{"3", "", 2}, {"7", "", 6}, {"8", "", 7}},
[1]Card{{"4", "", 3}},
[1]Card{{"A", "", 13}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "5" && cards[4].ID == "A" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}
func TestStraightOutOfOrderLow(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"5", "", 4}, {"9", "", 8}},
[3]Card{{"7", "", 6}, {"8", "", 7}, {"J", "", 10}},
[1]Card{{"K", "", 12}},
[1]Card{{"6", "", 5}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "9" && cards[4].ID == "5" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}
func TestStraightOutOfOrderHigh(t *testing.T) {
checker := StraightChecker{}
avaiableCards := AvaiableCards{
[2]Card{{"5", "", 4}, {"9", "", 8}},
[3]Card{{"7", "", 6}, {"8", "", 7}, {"J", "", 10}},
[1]Card{{"10", "", 9}},
[1]Card{{"6", "", 5}},
}
hand, _, cards := checker.execute(avaiableCards)
if hand == Straight && cards[0].ID == "J" && cards[4].ID == "7" {
t.Log("Ok")
} else {
t.Errorf("Not ok %v %v", hand, cards)
}
}