|
|
@@ -1,4 +1,4 @@
|
|
1
|
|
-import static org.junit.Assert.*;
|
|
|
1
|
+import static org.junit.Assert.assertEquals;
|
|
2
|
2
|
import java.util.Arrays;
|
|
3
|
3
|
import org.junit.Ignore;
|
|
4
|
4
|
import org.junit.Test;
|
|
|
@@ -6,176 +6,176 @@ import org.junit.Test;
|
|
6
|
6
|
public class PokerTest
|
|
7
|
7
|
{
|
|
8
|
8
|
@Test
|
|
9
|
|
- public void One_hand()
|
|
|
9
|
+ public void OneHand()
|
|
10
|
10
|
{
|
|
11
|
11
|
final String hand = "4S 5S 7H 8D JC";
|
|
12
|
|
- assertEquals(Arrays.asList(hand),Poker.BestHands(Arrays.asList(hand)));
|
|
|
12
|
+ assertEquals(Arrays.asList(hand),Poker.bestHands(Arrays.asList(hand)));
|
|
13
|
13
|
}
|
|
14
|
14
|
|
|
15
|
15
|
@Test
|
|
16
|
16
|
@Ignore
|
|
17
|
|
- public void Nothing_vs_one_pair()
|
|
|
17
|
+ public void NothingVsOnePair()
|
|
18
|
18
|
{
|
|
19
|
19
|
final String nothing = "4S 5H 6S 8D JH";
|
|
20
|
20
|
final String pairOf4 = "2S 4H 6S 4D JH";
|
|
21
|
|
- assertEquals(Arrays.asList(pairOf4), Poker.BestHands(Arrays.asList(nothing, pairOf4)));
|
|
|
21
|
+ assertEquals(Arrays.asList(pairOf4), Poker.bestHands(Arrays.asList(nothing, pairOf4)));
|
|
22
|
22
|
}
|
|
23
|
23
|
|
|
24
|
24
|
@Test
|
|
25
|
25
|
@Ignore
|
|
26
|
|
- public void Two_pairs()
|
|
|
26
|
+ public void TwoPairs()
|
|
27
|
27
|
{
|
|
28
|
28
|
final String pairOf2 = "4S 2H 6S 2D JH";
|
|
29
|
29
|
final String pairOf4 = "2S 4H 6S 4D JH";
|
|
30
|
|
- assertEquals(Arrays.asList(pairOf4), Poker.BestHands(Arrays.asList(pairOf2,pairOf4)));
|
|
|
30
|
+ assertEquals(Arrays.asList(pairOf4), Poker.bestHands(Arrays.asList(pairOf2,pairOf4)));
|
|
31
|
31
|
}
|
|
32
|
32
|
|
|
33
|
33
|
@Test
|
|
34
|
34
|
@Ignore
|
|
35
|
|
- public void One_pair_vs_double_pair()
|
|
|
35
|
+ public void OnePairVsDoublePair()
|
|
36
|
36
|
{
|
|
37
|
37
|
final String pairOf8 = "2S 8H 6S 8D JH";
|
|
38
|
38
|
final String doublePair = "4S 5H 4S 8D 5H";
|
|
39
|
|
- assertEquals(Arrays.asList(doublePair), Poker.BestHands(Arrays.asList(pairOf8, doublePair)));
|
|
|
39
|
+ assertEquals(Arrays.asList(doublePair), Poker.bestHands(Arrays.asList(pairOf8, doublePair)));
|
|
40
|
40
|
}
|
|
41
|
41
|
|
|
42
|
42
|
@Test
|
|
43
|
43
|
@Ignore
|
|
44
|
|
- public void Two_double_pairs()
|
|
|
44
|
+ public void TwoDoublePairs()
|
|
45
|
45
|
{
|
|
46
|
46
|
final String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
47
|
47
|
final String doublePair4And5 = "4S 5H 4S 8D 5H";
|
|
48
|
|
- assertEquals(Arrays.asList(doublePair2And8), Poker.BestHands(Arrays.asList(doublePair2And8, doublePair4And5)));
|
|
|
48
|
+ assertEquals(Arrays.asList(doublePair2And8), Poker.bestHands(Arrays.asList(doublePair2And8, doublePair4And5)));
|
|
49
|
49
|
}
|
|
50
|
50
|
|
|
51
|
51
|
@Test
|
|
52
|
52
|
@Ignore
|
|
53
|
|
- public void Double_pair_vs_three()
|
|
|
53
|
+ public void DoublePairVsThree()
|
|
54
|
54
|
{
|
|
55
|
55
|
final String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
56
|
56
|
final String threeOf4 = "4S 5H 4S 8D 4H";
|
|
57
|
|
- assertEquals(Arrays.asList(threeOf4 ), Poker.BestHands(Arrays.asList(doublePair2And8, threeOf4 )));
|
|
|
57
|
+ assertEquals(Arrays.asList(threeOf4 ), Poker.bestHands(Arrays.asList(doublePair2And8, threeOf4 )));
|
|
58
|
58
|
}
|
|
59
|
59
|
|
|
60
|
60
|
@Test
|
|
61
|
61
|
@Ignore
|
|
62
|
|
- public void Two_threes()
|
|
|
62
|
+ public void TwoThrees()
|
|
63
|
63
|
{
|
|
64
|
64
|
final String threeOf2 = "2S 2H 2S 8D JH";
|
|
65
|
65
|
final String threeOf1 = "4S AH AS 8D AH";
|
|
66
|
|
- assertEquals(Arrays.asList(threeOf1), Poker.BestHands(Arrays.asList(threeOf2, threeOf1)));
|
|
|
66
|
+ assertEquals(Arrays.asList(threeOf1), Poker.bestHands(Arrays.asList(threeOf2, threeOf1)));
|
|
67
|
67
|
}
|
|
68
|
68
|
|
|
69
|
69
|
@Test
|
|
70
|
70
|
@Ignore
|
|
71
|
|
- public void Three_vs_straight()
|
|
|
71
|
+ public void ThreeVsStraight()
|
|
72
|
72
|
{
|
|
73
|
73
|
final String threeOf4 = "4S 5H 4S 8D 4H";
|
|
74
|
74
|
final String straight = "3S 4H 2S 6D 5H";
|
|
75
|
|
- assertEquals(Arrays.asList(straight), Poker.BestHands(Arrays.asList(threeOf4, straight )));
|
|
|
75
|
+ assertEquals(Arrays.asList(straight), Poker.bestHands(Arrays.asList(threeOf4, straight )));
|
|
76
|
76
|
}
|
|
77
|
77
|
|
|
78
|
78
|
@Test
|
|
79
|
79
|
@Ignore
|
|
80
|
|
- public void Two_straights()
|
|
|
80
|
+ public void TwoStraights()
|
|
81
|
81
|
{
|
|
82
|
82
|
final String straightTo8 = "4S 6H 7S 8D 5H";
|
|
83
|
83
|
final String straightTo9 = "5S 7H 8S 9D 6H";
|
|
84
|
|
- assertEquals(Arrays.asList(straightTo9 ), Poker.BestHands(Arrays.asList(straightTo8, straightTo9 )));
|
|
|
84
|
+ assertEquals(Arrays.asList(straightTo9 ), Poker.bestHands(Arrays.asList(straightTo8, straightTo9 )));
|
|
85
|
85
|
|
|
86
|
86
|
final String straightTo1 = "AS QH KS TD JH";
|
|
87
|
87
|
final String straightTo5 = "4S AH 3S 2D 5H";
|
|
88
|
|
- assertEquals(Arrays.asList(straightTo1), Poker.BestHands(Arrays.asList(straightTo1, straightTo5)));
|
|
|
88
|
+ assertEquals(Arrays.asList(straightTo1), Poker.bestHands(Arrays.asList(straightTo1, straightTo5)));
|
|
89
|
89
|
}
|
|
90
|
90
|
|
|
91
|
91
|
@Test
|
|
92
|
92
|
@Ignore
|
|
93
|
|
- public void Straight_vs_flush()
|
|
|
93
|
+ public void StraightVsFlush()
|
|
94
|
94
|
{
|
|
95
|
95
|
final String straightTo8 = "4S 6H 7S 8D 5H";
|
|
96
|
96
|
final String flushTo7 = "2S 4S 5S 6S 7S";
|
|
97
|
|
- assertEquals(Arrays.asList(flushTo7 ), Poker.BestHands(Arrays.asList(straightTo8, flushTo7 )));
|
|
|
97
|
+ assertEquals(Arrays.asList(flushTo7 ), Poker.bestHands(Arrays.asList(straightTo8, flushTo7 )));
|
|
98
|
98
|
}
|
|
99
|
99
|
|
|
100
|
100
|
@Test
|
|
101
|
101
|
@Ignore
|
|
102
|
|
- public void Two_flushes()
|
|
|
102
|
+ public void TwoFlushes()
|
|
103
|
103
|
{
|
|
104
|
104
|
final String flushTo8 = "3H 6H 7H 8H 5H";
|
|
105
|
105
|
final String flushTo7 = "2S 4S 5S 6S 7S";
|
|
106
|
|
- assertEquals(Arrays.asList(flushTo8), Poker.BestHands(Arrays.asList(flushTo8, flushTo7)));
|
|
|
106
|
+ assertEquals(Arrays.asList(flushTo8), Poker.bestHands(Arrays.asList(flushTo8, flushTo7)));
|
|
107
|
107
|
}
|
|
108
|
108
|
|
|
109
|
109
|
@Test
|
|
110
|
110
|
@Ignore
|
|
111
|
|
- public void Flush_vs_full()
|
|
|
111
|
+ public void FlushVsFull()
|
|
112
|
112
|
{
|
|
113
|
113
|
final String flushTo8 = "3H 6H 7H 8H 5H";
|
|
114
|
114
|
final String full = "4S 5H 4S 5D 4H";
|
|
115
|
|
- assertEquals(Arrays.asList(full ), Poker.BestHands(Arrays.asList(full, flushTo8)));
|
|
|
115
|
+ assertEquals(Arrays.asList(full ), Poker.bestHands(Arrays.asList(full, flushTo8)));
|
|
116
|
116
|
}
|
|
117
|
117
|
|
|
118
|
118
|
@Test
|
|
119
|
119
|
@Ignore
|
|
120
|
|
- public void Two_fulls()
|
|
|
120
|
+ public void TwoFulls()
|
|
121
|
121
|
{
|
|
122
|
122
|
final String fullOf4By9 = "4H 4S 4D 9S 9D";
|
|
123
|
123
|
final String fullOf5By8 = "5H 5S 5D 8S 8D";
|
|
124
|
|
- assertEquals(Arrays.asList(fullOf5By8 ), Poker.BestHands(Arrays.asList(fullOf4By9, fullOf5By8)));
|
|
|
124
|
+ assertEquals(Arrays.asList(fullOf5By8 ), Poker.bestHands(Arrays.asList(fullOf4By9, fullOf5By8)));
|
|
125
|
125
|
}
|
|
126
|
126
|
|
|
127
|
127
|
@Test
|
|
128
|
128
|
@Ignore
|
|
129
|
|
- public void Full_vs_square()
|
|
|
129
|
+ public void FullVsSquare()
|
|
130
|
130
|
{
|
|
131
|
131
|
final String full = "4S 5H 4S 5D 4H";
|
|
132
|
132
|
final String squareOf3 = "3S 3H 2S 3D 3H";
|
|
133
|
|
- assertEquals(Arrays.asList(squareOf3 ), Poker.BestHands(Arrays.asList(full, squareOf3 )));
|
|
|
133
|
+ assertEquals(Arrays.asList(squareOf3 ), Poker.bestHands(Arrays.asList(full, squareOf3 )));
|
|
134
|
134
|
}
|
|
135
|
135
|
|
|
136
|
136
|
@Test
|
|
137
|
137
|
@Ignore
|
|
138
|
|
- public void Two_squares()
|
|
|
138
|
+ public void TwoSquares()
|
|
139
|
139
|
{
|
|
140
|
140
|
final String squareOf2 = "2S 2H 2S 8D 2H";
|
|
141
|
141
|
final String squareOf5 = "4S 5H 5S 5D 5H";
|
|
142
|
|
- assertEquals(Arrays.asList(squareOf5), Poker.BestHands(Arrays.asList(squareOf2, squareOf5)));
|
|
|
142
|
+ assertEquals(Arrays.asList(squareOf5), Poker.bestHands(Arrays.asList(squareOf2, squareOf5)));
|
|
143
|
143
|
}
|
|
144
|
144
|
|
|
145
|
145
|
@Test
|
|
146
|
146
|
@Ignore
|
|
147
|
|
- public void Square_vs_straight_flush()
|
|
|
147
|
+ public void SquareVsStraightFlush()
|
|
148
|
148
|
{
|
|
149
|
149
|
final String squareOf5 = "4S 5H 5S 5D 5H";
|
|
150
|
150
|
final String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
151
|
|
- assertEquals(Arrays.asList(straightFlushTo9 ), Poker.BestHands(Arrays.asList(squareOf5, straightFlushTo9 )));
|
|
|
151
|
+ assertEquals(Arrays.asList(straightFlushTo9 ), Poker.bestHands(Arrays.asList(squareOf5, straightFlushTo9 )));
|
|
152
|
152
|
}
|
|
153
|
153
|
|
|
154
|
154
|
@Test
|
|
155
|
155
|
@Ignore
|
|
156
|
|
- public void Two_straight_flushes()
|
|
|
156
|
+ public void TwoStraightFlushes()
|
|
157
|
157
|
{
|
|
158
|
158
|
final String straightFlushTo8 = "4H 6H 7H 8H 5H";
|
|
159
|
159
|
final String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
160
|
|
- assertEquals(Arrays.asList(straightFlushTo9 ), Poker.BestHands(Arrays.asList(straightFlushTo8, straightFlushTo9)));
|
|
|
160
|
+ assertEquals(Arrays.asList(straightFlushTo9 ), Poker.bestHands(Arrays.asList(straightFlushTo8, straightFlushTo9)));
|
|
161
|
161
|
}
|
|
162
|
162
|
|
|
163
|
163
|
@Test
|
|
164
|
164
|
@Ignore
|
|
165
|
|
- public void Three_hand_with_tie()
|
|
|
165
|
+ public void ThreeHandWithTie()
|
|
166
|
166
|
{
|
|
167
|
167
|
final String spadeStraightTo9 = "9S 8S 7S 6S 5S";
|
|
168
|
168
|
final String diamondStraightTo9 = "9D 8D 7D 6D 5D";
|
|
169
|
169
|
final String threeOf4 = "4D 4S 4H QS KS";
|
|
170
|
|
- assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), Poker.BestHands(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)));
|
|
|
170
|
+ assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), Poker.bestHands(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)));
|
|
171
|
171
|
}
|
|
172
|
172
|
|
|
173
|
173
|
@Test
|
|
174
|
174
|
@Ignore
|
|
175
|
|
- public void Straight_to_5_against_a_pair_of_jacks()
|
|
|
175
|
+ public void StraightTo5AgainstAPairOfJacks()
|
|
176
|
176
|
{
|
|
177
|
177
|
final String straightTo5 = "2S 4D 5C 3S AS";
|
|
178
|
178
|
final String twoJacks = "JD 8D 7D JC 5D";
|
|
179
|
|
- assertEquals(Arrays.asList(straightTo5), Poker.BestHands(Arrays.asList(straightTo5, twoJacks)));
|
|
|
179
|
+ assertEquals(Arrays.asList(straightTo5), Poker.bestHands(Arrays.asList(straightTo5, twoJacks)));
|
|
180
|
180
|
}
|
|
181
|
181
|
}
|