Skip to content

Commit 3db90d4

Browse files
rpottsohErikSchierboom
authored andcommitted
poker: straight to 5 in ascending order in example (#197)
* Straight to 5 was not in descending order While working on this exercise in Delphi it seemed to me that straight to 5 was not correct. However my tests were passing. I discovered that this for instance was not being tested. * Added testcase to test straight to 5 I believe this new test will fail if example is left with straight to 5 in ascending order. * poker: corrects typos in Straight_to_5_against_a_pair_of_jacks
1 parent 62e41a5 commit 3db90d4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

exercises/poker/Example.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private static int ScoreHand(Card[] cards)
5252

5353
if (ranks.SequenceEqual(new[] { 14, 5, 4, 3, 2 }))
5454
{
55-
ranks = new[] { 1, 2, 3, 4, 5 };
55+
ranks = new[] { 5, 4, 3, 2, 1 };
5656
}
5757

5858
var flush = suits.Distinct().Count() == 1;

exercises/poker/PokerTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,14 @@ public void Three_hand_with_tie()
168168
Assert.That(Poker.BestHands(new[] { spadeStraightTo9, diamondStraightTo9, threeOf4 }),
169169
Is.EqualTo(new[] { spadeStraightTo9, diamondStraightTo9 }));
170170
}
171+
172+
[Ignore("Remove to run test")]
173+
[Test]
174+
public void Straight_to_5_against_a_pair_of_jacks()
175+
{
176+
const string straightTo5 = "2S 4D 5C 3S AS";
177+
const string twoJacks = "JD 8D 7D JC 5D";
178+
Assert.That(Poker.BestHands(new[] { straightTo5, twoJacks }),
179+
Is.EqualTo(new[] { straightTo5 }));
180+
}
171181
}

0 commit comments

Comments
 (0)