trackler 2.2.1.14 → 2.2.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/docs/INSTALLATION.md +1 -1
  4. data/tracks/csharp/exercises/binary-search/BinarySearchTest.cs +2 -2
  5. data/tracks/csharp/exercises/poker/Example.cs +69 -20
  6. data/tracks/csharp/exercises/poker/PokerTest.cs +152 -82
  7. data/tracks/csharp/exercises/raindrops/RaindropsTest.cs +4 -4
  8. data/tracks/csharp/exercises/roman-numerals/RomanNumeralsTest.cs +4 -4
  9. data/tracks/csharp/exercises/word-count/Example.cs +2 -2
  10. data/tracks/csharp/exercises/word-count/WordCount.cs +2 -2
  11. data/tracks/csharp/exercises/word-count/WordCountTest.cs +85 -87
  12. data/tracks/csharp/generators/Exercises/Pangram.cs +0 -1
  13. data/tracks/csharp/generators/Exercises/Poker.cs +19 -0
  14. data/tracks/csharp/generators/Exercises/RomanNumerals.cs +0 -1
  15. data/tracks/csharp/generators/Exercises/WordCount.cs +27 -0
  16. data/tracks/csharp/generators/Output/NameExtensions.cs +6 -4
  17. data/tracks/delphi/{docs → exercises/hello-world}/GETTING_STARTED_GUIDE.md +0 -0
  18. data/tracks/go/config.json +629 -618
  19. data/tracks/go/config/maintainers.json +33 -33
  20. data/tracks/go/exercises/accumulate/README.md +0 -3
  21. data/tracks/go/exercises/hello-world/example.go +0 -2
  22. data/tracks/go/exercises/hello-world/hello_test.go +0 -20
  23. data/tracks/go/exercises/hello-world/hello_world.go +1 -36
  24. data/tracks/go/exercises/leap/leap.go +0 -1
  25. data/tracks/go/exercises/leap/leap_test.go +7 -3
  26. data/tracks/go/exercises/two-fer/README.md +66 -0
  27. data/tracks/go/exercises/two-fer/example.go +9 -0
  28. data/tracks/go/exercises/{hello-world/example_helloworld_test.go → two-fer/example_two_fer_test.go} +9 -9
  29. data/tracks/go/exercises/two-fer/two_fer.go +15 -0
  30. data/tracks/go/exercises/two-fer/two_fer_test.go +20 -0
  31. data/tracks/go/gen/gen.go +11 -10
  32. data/tracks/python/exercises/change/change_test.py +7 -2
  33. data/tracks/rust/config.json +1 -0
  34. data/tracks/rust/docs/ABOUT.md +1 -1
  35. data/tracks/scala/exercises/nth-prime/example.scala +2 -2
  36. data/tracks/scala/exercises/nth-prime/src/test/scala/NthPrimeTest.scala +29 -0
  37. data/tracks/scala/testgen/src/main/scala/NthPrimeTestGenerator.scala +34 -0
  38. metadata +12 -7
  39. data/tracks/fsharp/appveyor.yml +0 -4
  40. data/tracks/fsharp/circle.yml +0 -16
  41. data/tracks/scala/exercises/nth-prime/src/test/scala/PrimeTest.scala +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69d8a0c223e95766003538ba5109943e8eef13db
4
- data.tar.gz: '000541378abedc95ec41d12a7ce16572ec43b5f0'
3
+ metadata.gz: 99df2b52d78a5aa4268f1eefde99a24ab1f7fe7e
4
+ data.tar.gz: 0e9ee61d100bf9061d715d6d977740ace440822c
5
5
  SHA512:
6
- metadata.gz: eb37a920f2bd96e4628d637bb5c946c1ba06c806a6aa87e0e8975ea8cd05c3b3c3b11faf93ba2a8ac67ce2c60ba8bfdc461e825a2226c0fcc9072b1f6331b503
7
- data.tar.gz: ee47479dcc5d58ed396281d1370c9c1e2bfac02716e8229c86ee353ba85576f90e119767176a39e841f26a51b4edca23119e167d184f64e515c6916320f5de4b
6
+ metadata.gz: a827ac8f757cf694258e62f135d6c06e1ad0bfd44801cb8f3ce2f4b551aa876254c6f37a04173a43ba46eaacbd99d69bc2811fec894985e2abca8b322704ceaf
7
+ data.tar.gz: 34570f37ab0d07431fc589be29c96a9422538945f7eb2daa0c63b1187018673095ff6d1d24d30d6ab8c3bd560a0dbe052c364e17ab61a8e3466075d921eda1ed
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.14"
2
+ VERSION = "2.2.1.15"
3
3
  end
@@ -28,7 +28,7 @@ MacOS users can install gcc or clang with [Homebrew](http://brew.sh/) via
28
28
  #### Windows
29
29
 
30
30
  Windows users can get [Visual Studio Community][vs], a free download
31
- that will give you the Visual Studio 2013 IDE and the latest version of the
31
+ that will give you the Visual Studio 2017 IDE and the latest version of the
32
32
  Microsoft Visual C compiler.
33
33
 
34
34
  [vs]: http://visualstudio.com
@@ -61,7 +61,7 @@ public void Identifies_that_a_value_is_not_included_in_the_array()
61
61
  }
62
62
 
63
63
  [Fact(Skip = "Remove to run test")]
64
- public void A_value_smaller_than_the_array_s_smallest_value_is_not_included()
64
+ public void A_value_smaller_than_the_arrays_smallest_value_is_not_included()
65
65
  {
66
66
  var array = new[] { 1, 3, 4, 6, 8, 9, 11 };
67
67
  var sut = new BinarySearch(array);
@@ -69,7 +69,7 @@ public void A_value_smaller_than_the_array_s_smallest_value_is_not_included()
69
69
  }
70
70
 
71
71
  [Fact(Skip = "Remove to run test")]
72
- public void A_value_larger_than_the_array_s_largest_value_is_not_included()
72
+ public void A_value_larger_than_the_arrays_largest_value_is_not_included()
73
73
  {
74
74
  var array = new[] { 1, 3, 4, 6, 8, 9, 11 };
75
75
  var sut = new BinarySearch(array);
@@ -13,27 +13,43 @@ private struct Card
13
13
  private struct Hand
14
14
  {
15
15
  public string Input;
16
+ public Scores Result;
17
+ }
18
+
19
+ private struct Scores
20
+ {
16
21
  public int Score;
22
+ public int TieBreakerScore;
17
23
  }
18
24
 
19
25
  public static IEnumerable<string> BestHands(IEnumerable<string> hands)
20
26
  {
21
27
  var scoredHands = hands.Select(ParseHand).ToArray();
22
- var maxScore = scoredHands.Max(h => h.Score);
23
- return scoredHands.Where(h => h.Score == maxScore).Select(h => h.Input).ToList();
28
+ var maxScore = scoredHands.Max(h => h.Result.Score);
29
+ var maxHands = scoredHands.Where(h => h.Result.Score == maxScore);
30
+
31
+ return maxHands
32
+ .Where(h => h.Result.TieBreakerScore == maxHands.Max(m => m.Result.TieBreakerScore))
33
+ .Select(s => s.Input)
34
+ .ToList();
24
35
  }
25
36
 
26
- private static Hand ParseHand(string hand) => new Hand { Input = hand, Score = ScoreHand(ParseCards(hand)) };
37
+ private static Hand ParseHand(string hand) => new Hand { Input = hand, Result = ScoreHand(ParseCards(hand)) };
27
38
 
28
- private static Card[] ParseCards(string hand) => hand.Split(' ').Select(ParseCard).OrderByDescending(c => c.Rank).ToArray();
39
+ private static Card[] ParseCards(string hand) => hand
40
+ .Replace("10", "T")
41
+ .Split(' ')
42
+ .Select(ParseCard)
43
+ .OrderByDescending(c => c.Rank)
44
+ .ToArray();
29
45
 
30
46
  private static Card ParseCard(string card) => new Card { Rank = ParseRank(card), Suit = ParseSuit(card) };
31
-
47
+
32
48
  private static int ParseRank(string card) => "..23456789TJQKA".IndexOf(card[0]);
33
49
 
34
50
  private static int ParseSuit(string card) => ".HSDC".IndexOf(card[1]);
35
-
36
- private static int ScoreHand(Card[] cards)
51
+
52
+ private static Scores ScoreHand(Card[] cards)
37
53
  {
38
54
  var cardsByRank = cards
39
55
  .GroupBy(c => c.Rank)
@@ -46,7 +62,7 @@ private static int ScoreHand(Card[] cards)
46
62
  .Select(g => g.Count())
47
63
  .OrderByDescending(c => c)
48
64
  .ToArray();
49
-
65
+
50
66
  var ranks = cards.Select(c => c.Rank).ToArray();
51
67
  var suits = cards.Select(c => c.Suit).ToArray();
52
68
 
@@ -54,43 +70,76 @@ private static int ScoreHand(Card[] cards)
54
70
  {
55
71
  ranks = new[] { 5, 4, 3, 2, 1 };
56
72
  }
57
-
73
+
58
74
  var flush = suits.Distinct().Count() == 1;
59
75
  var straight = ranks.Distinct().Count() == 5 && ranks[0] - ranks[4] == 4;
60
-
76
+
61
77
  if (straight && flush)
62
78
  {
63
- return 800 + ranks.First();
79
+ return new Scores
80
+ {
81
+ Score = 800 + ranks.First()
82
+ };
64
83
  }
65
- if (rankCounts.SequenceEqual(new [] { 4, 1 }))
84
+ if (rankCounts.SequenceEqual(new[] { 4, 1 }))
66
85
  {
67
- return 700 + cardsByRank[0];
86
+ return new Scores
87
+ {
88
+ Score = 700 + cardsByRank[0],
89
+ TieBreakerScore = cardsByRank[1]
90
+ };
68
91
  }
69
92
  if (rankCounts.SequenceEqual(new[] { 3, 2 }))
70
93
  {
71
- return 600 + cardsByRank[0];
94
+ return new Scores
95
+ {
96
+ Score = 600 + cardsByRank[0],
97
+ TieBreakerScore = cardsByRank[1]
98
+ };
72
99
  }
73
100
  if (flush)
74
101
  {
75
- return 500 + ranks.First();
102
+ return new Scores
103
+ {
104
+ Score = 500 + ranks.First()
105
+ };
76
106
  }
77
107
  if (straight)
78
108
  {
79
- return 400 + ranks.First();
109
+ return new Scores
110
+ {
111
+ Score = 400 + ranks.First()
112
+ };
80
113
  }
81
114
  if (rankCounts.SequenceEqual(new[] { 3, 1, 1 }))
82
115
  {
83
- return 300 + cardsByRank[0];
116
+ return new Scores
117
+ {
118
+ Score = 300 + cardsByRank[0],
119
+ TieBreakerScore = cardsByRank[1]
120
+ };
84
121
  }
85
122
  if (rankCounts.SequenceEqual(new[] { 2, 2, 1 }))
86
123
  {
87
- return 200 + Math.Max(cardsByRank[0], cardsByRank[1]);
124
+ return new Scores
125
+ {
126
+ Score = 200 + cardsByRank[0] + cardsByRank[1],
127
+ TieBreakerScore = cardsByRank[2]
128
+ };
88
129
  }
89
130
  if (rankCounts.SequenceEqual(new[] { 2, 1, 1, 1 }))
90
131
  {
91
- return 100 + cardsByRank[0];
132
+ return new Scores
133
+ {
134
+ Score = 100 + cardsByRank[0],
135
+ TieBreakerScore = 0
136
+ };
92
137
  }
93
138
 
94
- return ranks.Max();
139
+ return new Scores
140
+ {
141
+ Score = ranks.Max(),
142
+ TieBreakerScore = cardsByRank[4]
143
+ };
95
144
  }
96
145
  }
@@ -1,160 +1,230 @@
1
- using Xunit;
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
3
+ using Xunit;
2
4
 
3
5
  public class PokerTest
4
6
  {
5
7
  [Fact]
6
- public void One_hand()
8
+ public void Single_hand_always_wins()
9
+ {
10
+ var actual = Poker.BestHands(new[] { "4S 5S 7H 8D JC" });
11
+ var expected = new[] { "4S 5S 7H 8D JC" };
12
+ Assert.Equal(expected, actual);
13
+ }
14
+
15
+ [Fact(Skip = "Remove to run test")]
16
+ public void Highest_card_out_of_all_hands_wins()
17
+ {
18
+ var actual = Poker.BestHands(new[] { "4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH" });
19
+ var expected = new[] { "3S 4S 5D 6H JH" };
20
+ Assert.Equal(expected, actual);
21
+ }
22
+
23
+ [Fact(Skip = "Remove to run test")]
24
+ public void A_tie_has_multiple_winners()
25
+ {
26
+ var actual = Poker.BestHands(new[] { "4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" });
27
+ var expected = new[] { "3S 4S 5D 6H JH", "3H 4H 5C 6C JD" };
28
+ Assert.Equal(expected, actual);
29
+ }
30
+
31
+ [Fact(Skip = "Remove to run test")]
32
+ public void Multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranked_down_to_last_card()
33
+ {
34
+ var actual = Poker.BestHands(new[] { "3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S" });
35
+ var expected = new[] { "3S 5H 6S 8D 7H" };
36
+ Assert.Equal(expected, actual);
37
+ }
38
+
39
+ [Fact(Skip = "Remove to run test")]
40
+ public void One_pair_beats_high_card()
41
+ {
42
+ var actual = Poker.BestHands(new[] { "4S 5H 6C 8D KH", "2S 4H 6S 4D JH" });
43
+ var expected = new[] { "2S 4H 6S 4D JH" };
44
+ Assert.Equal(expected, actual);
45
+ }
46
+
47
+ [Fact(Skip = "Remove to run test")]
48
+ public void Highest_pair_wins()
49
+ {
50
+ var actual = Poker.BestHands(new[] { "4S 2H 6S 2D JH", "2S 4H 6C 4D JD" });
51
+ var expected = new[] { "2S 4H 6C 4D JD" };
52
+ Assert.Equal(expected, actual);
53
+ }
54
+
55
+ [Fact(Skip = "Remove to run test")]
56
+ public void Two_pairs_beats_one_pair()
57
+ {
58
+ var actual = Poker.BestHands(new[] { "2S 8H 6S 8D JH", "4S 5H 4C 8C 5C" });
59
+ var expected = new[] { "4S 5H 4C 8C 5C" };
60
+ Assert.Equal(expected, actual);
61
+ }
62
+
63
+ [Fact(Skip = "Remove to run test")]
64
+ public void Both_hands_have_two_pairs_highest_ranked_pair_wins()
65
+ {
66
+ var actual = Poker.BestHands(new[] { "2S 8H 2D 8D 3H", "4S 5H 4C 8S 5D" });
67
+ var expected = new[] { "2S 8H 2D 8D 3H" };
68
+ Assert.Equal(expected, actual);
69
+ }
70
+
71
+ [Fact(Skip = "Remove to run test")]
72
+ public void Both_hands_have_two_pairs_with_the_same_highest_ranked_pair_tie_goes_to_low_pair()
73
+ {
74
+ var actual = Poker.BestHands(new[] { "2S QS 2C QD JH", "JD QH JS 8D QC" });
75
+ var expected = new[] { "JD QH JS 8D QC" };
76
+ Assert.Equal(expected, actual);
77
+ }
78
+
79
+ [Fact(Skip = "Remove to run test")]
80
+ public void Both_hands_have_two_identically_ranked_pairs_tie_goes_to_remaining_card_kicker_()
7
81
  {
8
- const string hand = "4S 5S 7H 8D JC";
9
- Assert.Equal(new[] { hand }, Poker.BestHands(new[] { hand }));
82
+ var actual = Poker.BestHands(new[] { "JD QH JS 8D QC", "JS QS JC 2D QD" });
83
+ var expected = new[] { "JD QH JS 8D QC" };
84
+ Assert.Equal(expected, actual);
10
85
  }
11
86
 
12
87
  [Fact(Skip = "Remove to run test")]
13
- public void Nothing_vs_one_pair()
88
+ public void Three_of_a_kind_beats_two_pair()
14
89
  {
15
- const string nothing = "4S 5H 6S 8D JH";
16
- const string pairOf4 = "2S 4H 6S 4D JH";
17
- Assert.Equal(new[] { pairOf4 }, Poker.BestHands(new[] { nothing, pairOf4 }));
90
+ var actual = Poker.BestHands(new[] { "2S 8H 2H 8D JH", "4S 5H 4C 8S 4H" });
91
+ var expected = new[] { "4S 5H 4C 8S 4H" };
92
+ Assert.Equal(expected, actual);
18
93
  }
19
94
 
20
95
  [Fact(Skip = "Remove to run test")]
21
- public void Two_pairs()
96
+ public void Both_hands_have_three_of_a_kind_tie_goes_to_highest_ranked_triplet()
22
97
  {
23
- const string pairOf2 = "4S 2H 6S 2D JH";
24
- const string pairOf4 = "2S 4H 6S 4D JH";
25
- Assert.Equal(new[] { pairOf4 }, Poker.BestHands(new[] { pairOf2, pairOf4 }));
98
+ var actual = Poker.BestHands(new[] { "2S 2H 2C 8D JH", "4S AH AS 8C AD" });
99
+ var expected = new[] { "4S AH AS 8C AD" };
100
+ Assert.Equal(expected, actual);
26
101
  }
27
102
 
28
103
  [Fact(Skip = "Remove to run test")]
29
- public void One_pair_vs_double_pair()
104
+ public void With_multiple_decks_two_players_can_have_same_three_of_a_kind_ties_go_to_highest_remaining_cards()
30
105
  {
31
- const string pairOf8 = "2S 8H 6S 8D JH";
32
- const string doublePair = "4S 5H 4S 8D 5H";
33
- Assert.Equal(new[] { doublePair }, Poker.BestHands(new[] { pairOf8, doublePair }));
106
+ var actual = Poker.BestHands(new[] { "4S AH AS 7C AD", "4S AH AS 8C AD" });
107
+ var expected = new[] { "4S AH AS 8C AD" };
108
+ Assert.Equal(expected, actual);
34
109
  }
35
110
 
36
111
  [Fact(Skip = "Remove to run test")]
37
- public void Two_double_pairs()
112
+ public void A_straight_beats_three_of_a_kind()
38
113
  {
39
- const string doublePair2And8 = "2S 8H 2S 8D JH";
40
- const string doublePair4And5 = "4S 5H 4S 8D 5H";
41
- Assert.Equal(new[] { doublePair2And8 }, Poker.BestHands(new[] { doublePair2And8, doublePair4And5 }));
114
+ var actual = Poker.BestHands(new[] { "4S 5H 4C 8D 4H", "3S 4D 2S 6D 5C" });
115
+ var expected = new[] { "3S 4D 2S 6D 5C" };
116
+ Assert.Equal(expected, actual);
42
117
  }
43
118
 
44
119
  [Fact(Skip = "Remove to run test")]
45
- public void Double_pair_vs_three()
120
+ public void Aces_can_end_a_straight_10_j_q_k_a_()
46
121
  {
47
- const string doublePair2And8 = "2S 8H 2S 8D JH";
48
- const string threeOf4 = "4S 5H 4S 8D 4H";
49
- Assert.Equal(new[] { threeOf4 }, Poker.BestHands(new[] { doublePair2And8, threeOf4 }));
122
+ var actual = Poker.BestHands(new[] { "4S 5H 4C 8D 4H", "10D JH QS KD AC" });
123
+ var expected = new[] { "10D JH QS KD AC" };
124
+ Assert.Equal(expected, actual);
50
125
  }
51
126
 
52
127
  [Fact(Skip = "Remove to run test")]
53
- public void Two_threes()
128
+ public void Aces_can_start_a_straight_a_2_3_4_5_()
54
129
  {
55
- const string threeOf2 = "2S 2H 2S 8D JH";
56
- const string threeOf1 = "4S AH AS 8D AH";
57
- Assert.Equal(new[] { threeOf1 }, Poker.BestHands(new[] { threeOf2, threeOf1 }));
130
+ var actual = Poker.BestHands(new[] { "4S 5H 4C 8D 4H", "4D AH 3S 2D 5C" });
131
+ var expected = new[] { "4D AH 3S 2D 5C" };
132
+ Assert.Equal(expected, actual);
58
133
  }
59
134
 
60
135
  [Fact(Skip = "Remove to run test")]
61
- public void Three_vs_straight()
136
+ public void Both_hands_with_a_straight_tie_goes_to_highest_ranked_card()
62
137
  {
63
- const string threeOf4 = "4S 5H 4S 8D 4H";
64
- const string straight = "3S 4H 2S 6D 5H";
65
- Assert.Equal(new[] { straight }, Poker.BestHands(new[] { threeOf4, straight }));
138
+ var actual = Poker.BestHands(new[] { "4S 6C 7S 8D 5H", "5S 7H 8S 9D 6H" });
139
+ var expected = new[] { "5S 7H 8S 9D 6H" };
140
+ Assert.Equal(expected, actual);
66
141
  }
67
142
 
68
143
  [Fact(Skip = "Remove to run test")]
69
- public void Two_straights()
144
+ public void Even_though_an_ace_is_usually_high_a_5_high_straight_is_the_lowest_scoring_straight()
70
145
  {
71
- const string straightTo8 = "4S 6H 7S 8D 5H";
72
- const string straightTo9 = "5S 7H 8S 9D 6H";
73
- Assert.Equal(new[] { straightTo9 }, Poker.BestHands(new[] { straightTo8, straightTo9 }));
74
-
75
- const string straightTo1 = "AS QH KS TD JH";
76
- const string straightTo5 = "4S AH 3S 2D 5H";
77
- Assert.Equal(new[] { straightTo1 }, Poker.BestHands(new[] { straightTo1, straightTo5 }));
146
+ var actual = Poker.BestHands(new[] { "2H 3C 4D 5D 6H", "4S AH 3S 2D 5H" });
147
+ var expected = new[] { "2H 3C 4D 5D 6H" };
148
+ Assert.Equal(expected, actual);
78
149
  }
79
150
 
80
151
  [Fact(Skip = "Remove to run test")]
81
- public void Straight_vs_flush()
152
+ public void Flush_beats_a_straight()
82
153
  {
83
- const string straightTo8 = "4S 6H 7S 8D 5H";
84
- const string flushTo7 = "2S 4S 5S 6S 7S";
85
- Assert.Equal(new[] { flushTo7 }, Poker.BestHands(new[] { straightTo8, flushTo7 }));
154
+ var actual = Poker.BestHands(new[] { "4C 6H 7D 8D 5H", "2S 4S 5S 6S 7S" });
155
+ var expected = new[] { "2S 4S 5S 6S 7S" };
156
+ Assert.Equal(expected, actual);
86
157
  }
87
158
 
88
159
  [Fact(Skip = "Remove to run test")]
89
- public void Two_flushes()
160
+ public void Both_hands_have_a_flush_tie_goes_to_high_card_down_to_the_last_one_if_necessary()
90
161
  {
91
- const string flushTo8 = "3H 6H 7H 8H 5H";
92
- const string flushTo7 = "2S 4S 5S 6S 7S";
93
- Assert.Equal(new[] { flushTo8 }, Poker.BestHands(new[] { flushTo8, flushTo7 }));
162
+ var actual = Poker.BestHands(new[] { "4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S" });
163
+ var expected = new[] { "4H 7H 8H 9H 6H" };
164
+ Assert.Equal(expected, actual);
94
165
  }
95
166
 
96
167
  [Fact(Skip = "Remove to run test")]
97
- public void Flush_vs_full()
168
+ public void Full_house_beats_a_flush()
98
169
  {
99
- const string flushTo8 = "3H 6H 7H 8H 5H";
100
- const string full = "4S 5H 4S 5D 4H";
101
- Assert.Equal(new[] { full }, Poker.BestHands(new[] { full, flushTo8 }));
170
+ var actual = Poker.BestHands(new[] { "3H 6H 7H 8H 5H", "4S 5H 4C 5D 4H" });
171
+ var expected = new[] { "4S 5H 4C 5D 4H" };
172
+ Assert.Equal(expected, actual);
102
173
  }
103
174
 
104
175
  [Fact(Skip = "Remove to run test")]
105
- public void Two_fulls()
176
+ public void Both_hands_have_a_full_house_tie_goes_to_highest_ranked_triplet()
106
177
  {
107
- const string fullOf4By9 = "4H 4S 4D 9S 9D";
108
- const string fullOf5By8 = "5H 5S 5D 8S 8D";
109
- Assert.Equal(new[] { fullOf5By8 }, Poker.BestHands(new[] { fullOf4By9, fullOf5By8 }));
178
+ var actual = Poker.BestHands(new[] { "4H 4S 4D 9S 9D", "5H 5S 5D 8S 8D" });
179
+ var expected = new[] { "5H 5S 5D 8S 8D" };
180
+ Assert.Equal(expected, actual);
110
181
  }
111
182
 
112
183
  [Fact(Skip = "Remove to run test")]
113
- public void Full_vs_square()
184
+ public void With_multiple_decks_both_hands_have_a_full_house_with_the_same_triplet_tie_goes_to_the_pair()
114
185
  {
115
- const string full = "4S 5H 4S 5D 4H";
116
- const string squareOf3 = "3S 3H 2S 3D 3H";
117
- Assert.Equal(new[] { squareOf3 }, Poker.BestHands(new[] { full, squareOf3 }));
186
+ var actual = Poker.BestHands(new[] { "5H 5S 5D 9S 9D", "5H 5S 5D 8S 8D" });
187
+ var expected = new[] { "5H 5S 5D 9S 9D" };
188
+ Assert.Equal(expected, actual);
118
189
  }
119
190
 
120
191
  [Fact(Skip = "Remove to run test")]
121
- public void Two_squares()
192
+ public void Four_of_a_kind_beats_a_full_house()
122
193
  {
123
- const string squareOf2 = "2S 2H 2S 8D 2H";
124
- const string squareOf5 = "4S 5H 5S 5D 5H";
125
- Assert.Equal(new[] { squareOf5 }, Poker.BestHands(new[] { squareOf2, squareOf5 }));
194
+ var actual = Poker.BestHands(new[] { "4S 5H 4D 5D 4H", "3S 3H 2S 3D 3C" });
195
+ var expected = new[] { "3S 3H 2S 3D 3C" };
196
+ Assert.Equal(expected, actual);
126
197
  }
127
198
 
128
199
  [Fact(Skip = "Remove to run test")]
129
- public void Square_vs_straight_flush()
200
+ public void Both_hands_have_four_of_a_kind_tie_goes_to_high_quad()
130
201
  {
131
- const string squareOf5 = "4S 5H 5S 5D 5H";
132
- const string straightFlushTo9 = "5S 7S 8S 9S 6S";
133
- Assert.Equal(new[] { straightFlushTo9 }, Poker.BestHands(new[] { squareOf5, straightFlushTo9 }));
202
+ var actual = Poker.BestHands(new[] { "2S 2H 2C 8D 2D", "4S 5H 5S 5D 5C" });
203
+ var expected = new[] { "4S 5H 5S 5D 5C" };
204
+ Assert.Equal(expected, actual);
134
205
  }
135
206
 
136
207
  [Fact(Skip = "Remove to run test")]
137
- public void Two_straight_flushes()
208
+ public void With_multiple_decks_both_hands_with_identical_four_of_a_kind_tie_determined_by_kicker()
138
209
  {
139
- const string straightFlushTo8 = "4H 6H 7H 8H 5H";
140
- const string straightFlushTo9 = "5S 7S 8S 9S 6S";
141
- Assert.Equal(new[] { straightFlushTo9 }, Poker.BestHands(new[] { straightFlushTo8, straightFlushTo9 }));
210
+ var actual = Poker.BestHands(new[] { "3S 3H 2S 3D 3C", "3S 3H 4S 3D 3C" });
211
+ var expected = new[] { "3S 3H 4S 3D 3C" };
212
+ Assert.Equal(expected, actual);
142
213
  }
143
214
 
144
215
  [Fact(Skip = "Remove to run test")]
145
- public void Three_hand_with_tie()
216
+ public void Straight_flush_beats_four_of_a_kind()
146
217
  {
147
- const string spadeStraightTo9 = "9S 8S 7S 6S 5S";
148
- const string diamondStraightTo9 = "9D 8D 7D 6D 5D";
149
- const string threeOf4 = "4D 4S 4H QS KS";
150
- Assert.Equal(new[] { spadeStraightTo9, diamondStraightTo9 }, Poker.BestHands(new[] { spadeStraightTo9, diamondStraightTo9, threeOf4 }));
218
+ var actual = Poker.BestHands(new[] { "4S 5H 5S 5D 5C", "7S 8S 9S 6S 10S" });
219
+ var expected = new[] { "7S 8S 9S 6S 10S" };
220
+ Assert.Equal(expected, actual);
151
221
  }
152
222
 
153
223
  [Fact(Skip = "Remove to run test")]
154
- public void Straight_to_5_against_a_pair_of_jacks()
224
+ public void Both_hands_have_straight_flush_tie_goes_to_highest_ranked_card()
155
225
  {
156
- const string straightTo5 = "2S 4D 5C 3S AS";
157
- const string twoJacks = "JD 8D 7D JC 5D";
158
- Assert.Equal(new[] { straightTo5 }, Poker.BestHands(new[] { straightTo5, twoJacks }));
226
+ var actual = Poker.BestHands(new[] { "4H 6H 7H 8H 5H", "5S 7S 8S 9S 6S" });
227
+ var expected = new[] { "5S 7S 8S 9S 6S" };
228
+ Assert.Equal(expected, actual);
159
229
  }
160
- }
230
+ }