Skip to content

Commit b8aca6d

Browse files
hkBstkytrinyx
andauthored
Additional tests for straights (#2117)
* Additional tests for straights Additional tests for straights with the same tests also for straight flushes. (Originally proposed in the Rust track: exercism/rust#1555) * Update canonical-data.json remove trailing comma * Update canonical-data.json Add UUIDs generated by running "uuidgen". * Reorder straight flush cases This reorders the straight flush cases to match the order of the straight cases, per suggestion from petertseng. Co-authored-by: Katrina Owen <[email protected]>
1 parent 396dffd commit b8aca6d

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

exercises/poker/canonical-data.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@
168168
},
169169
"expected": ["4D AH 3S 2D 5C"]
170170
},
171+
{
172+
"uuid": "e214b7df-dcba-45d3-a2e5-342d8c46c286",
173+
"description": "aces cannot be in the middle of a straight (Q K A 2 3)",
174+
"property": "bestHands",
175+
"input": {
176+
"hands": ["2C 3D 7H 5H 2S", "QS KH AC 2D 3S"]
177+
},
178+
"expected": ["2C 3D 7H 5H 2S"]
179+
},
171180
{
172181
"uuid": "6980c612-bbff-4914-b17a-b044e4e69ea1",
173182
"description": "both hands with a straight, tie goes to highest ranked card",
@@ -267,14 +276,50 @@
267276
},
268277
"expected": ["7S 8S 9S 6S 10S"]
269278
},
279+
{
280+
"uuid": "d9629e22-c943-460b-a951-2134d1b43346",
281+
"description": "aces can end a straight flush (10 J Q K A)",
282+
"property": "bestHands",
283+
"input": {
284+
"hands": ["KC AH AS AD AC", "10C JC QC KC AC"]
285+
},
286+
"expected": ["10C JC QC KC AC"]
287+
},
288+
{
289+
"uuid": "05d5ede9-64a5-4678-b8ae-cf4c595dc824",
290+
"description": "aces can start a straight flush (A 2 3 4 5)",
291+
"property": "bestHands",
292+
"input": {
293+
"hands": ["KS AH AS AD AC", "4H AH 3H 2H 5H"]
294+
},
295+
"expected": ["4H AH 3H 2H 5H"]
296+
},
297+
{
298+
"uuid": "ad655466-6d04-49e8-a50c-0043c3ac18ff",
299+
"description": "aces cannot be in the middle of a straight flush (Q K A 2 3)",
300+
"property": "bestHands",
301+
"input": {
302+
"hands": ["2C AC QC 10C KC", "QH KH AH 2H 3H"]
303+
},
304+
"expected": ["2C AC QC 10C KC"]
305+
},
270306
{
271307
"uuid": "d0927f70-5aec-43db-aed8-1cbd1b6ee9ad",
272-
"description": "both hands have straight flush, tie goes to highest-ranked card",
308+
"description": "both hands have a straight flush, tie goes to highest-ranked card",
273309
"property": "bestHands",
274310
"input": {
275311
"hands": ["4H 6H 7H 8H 5H", "5S 7S 8S 9S 6S"]
276312
},
277313
"expected": ["5S 7S 8S 9S 6S"]
314+
},
315+
{
316+
"uuid": "be620e09-0397-497b-ac37-d1d7a4464cfc",
317+
"description": "even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush",
318+
"property": "bestHands",
319+
"input": {
320+
"hands": ["2H 3H 4H 5H 6H", "4D AD 3D 2D 5D"]
321+
},
322+
"expected": ["2H 3H 4H 5H 6H"]
278323
}
279324
]
280325
}

0 commit comments

Comments
 (0)