trackler 2.2.1.137 → 2.2.1.138
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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/diffie-hellman/canonical-data.json +72 -0
- data/problem-specifications/exercises/yacht/description.md +2 -2
- data/tracks/csharp/exercises/sgf-parsing/Example.cs +1 -1
- data/tracks/csharp/exercises/sgf-parsing/SgfParsingTest.cs +1 -1
- data/tracks/csharp/exercises/sublist/SublistTest.cs +37 -78
- data/tracks/csharp/generators/Exercises/Sublist.cs +32 -0
- data/tracks/elisp/exercises/bob/README.md +2 -0
- data/tracks/elisp/exercises/bob/bob-test.el +60 -15
- data/tracks/elisp/exercises/bob/example.el +15 -5
- data/tracks/elisp/exercises/hamming/hamming-test.el +1 -1
- data/tracks/fsharp/build.ps1 +3 -3
- data/tracks/fsharp/build.sh +3 -3
- data/tracks/fsharp/exercises/bracket-push/BracketPushTest.fs +5 -1
- data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifierTest.fs +5 -1
- data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGardenTest.fs +1 -1
- data/tracks/fsharp/exercises/pov/PovTest.fs +6 -1
- data/tracks/fsharp/exercises/react/Example.fs +2 -2
- data/tracks/fsharp/exercises/react/React.fsproj +1 -0
- data/tracks/fsharp/exercises/react/ReactTest.fs +55 -33
- data/tracks/fsharp/exercises/series/Example.fs +2 -12
- data/tracks/fsharp/exercises/series/SeriesTest.fs +33 -56
- data/tracks/fsharp/generators/Generators.fs +81 -46
- data/tracks/idris/exercises/rna-transcription/src/{example.idr → Example.idr} +0 -0
- data/tracks/java/config.json +14 -0
- data/tracks/java/exercises/acronym/src/test/java/AcronymTest.java +10 -10
- data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +39 -39
- data/tracks/java/exercises/grep/.meta/hints.md +58 -0
- data/tracks/java/exercises/grep/.meta/src/reference/java/GrepTool.java +65 -0
- data/tracks/java/exercises/grep/.meta/version +1 -0
- data/tracks/java/exercises/grep/README.md +145 -0
- data/tracks/java/exercises/grep/build.gradle +18 -0
- data/tracks/java/exercises/grep/src/main/java/.keep +0 -0
- data/tracks/java/exercises/grep/src/test/java/GrepToolTest.java +395 -0
- data/tracks/java/exercises/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java +36 -36
- data/tracks/java/exercises/minesweeper/src/test/java/MinesweeperBoardTest.java +36 -36
- data/tracks/java/exercises/phone-number/src/test/java/PhoneNumberTest.java +14 -14
- data/tracks/java/exercises/poker/src/test/java/PokerTest.java +40 -40
- data/tracks/java/exercises/pythagorean-triplet/src/test/java/PythagoreanTripletTest.java +10 -10
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/ocaml/exercises/anagram/example.ml +1 -1
- data/tracks/ocaml/exercises/change/example.ml +1 -1
- data/tracks/ocaml/exercises/custom-set/example.ml +4 -3
- data/tracks/ocaml/exercises/custom-set/test.ml +0 -1
- data/tracks/ocaml/exercises/dominoes/test.ml +1 -1
- data/tracks/ocaml/exercises/etl/example.ml +1 -1
- data/tracks/ocaml/exercises/grade-school/example.ml +1 -1
- data/tracks/ocaml/exercises/palindrome-products/example.ml +2 -2
- data/tracks/ocaml/exercises/prime-factors/example.ml +1 -1
- data/tracks/ocaml/exercises/robot-name/test.ml +1 -1
- data/tracks/ocaml/exercises/triangle/example.ml +1 -1
- data/tracks/ocaml/make-exercise.sh +1 -0
- data/tracks/ocaml/tools/test-generator/src/controller.ml +1 -1
- data/tracks/perl5/exercises/raindrops/.meta/solutions/Raindrops.pm +13 -12
- data/tracks/perl5/exercises/raindrops/raindrops.t +166 -111
- data/tracks/perl6/docs/INSTALLATION.md +1 -3
- data/tracks/perl6/exercises/raindrops/.meta/exercise-data.yaml +5 -5
- data/tracks/perl6/exercises/raindrops/.meta/solutions/Raindrops.pm6 +2 -2
- data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +2 -2
- data/tracks/perl6/exercises/raindrops/raindrops.t +3 -3
- data/tracks/python/exercises/food-chain/example.py +11 -2
- data/tracks/python/exercises/food-chain/food_chain_test.py +48 -45
- data/tracks/python/exercises/pov/pov_test.py +12 -1
- data/tracks/python/exercises/series/README.md +6 -6
- data/tracks/python/exercises/series/example.py +2 -3
- data/tracks/python/exercises/series/series_test.py +27 -28
- data/tracks/python/exercises/sgf-parsing/example.py +1 -1
- data/tracks/python/exercises/sgf-parsing/sgf_parsing_test.py +1 -1
- data/tracks/python/exercises/yacht/README.md +2 -2
- data/tracks/ruby/Gemfile +0 -1
- data/tracks/ruby/README.md +23 -0
- data/tracks/ruby/bin/generate +1 -0
- data/tracks/ruby/exercises/complex-numbers/complex_numbers_test.rb +1 -1
- data/tracks/ruby/lib/generator.rb +1 -2
- data/tracks/ruby/lib/generator/command_line.rb +3 -0
- data/tracks/ruby/lib/generator/command_line/generator_optparser.rb +1 -0
- data/tracks/ruby/lib/generator/exercise.rb +2 -0
- data/tracks/ruby/lib/generator/exercise_case.rb +3 -0
- data/tracks/ruby/lib/generator/files.rb +1 -0
- data/tracks/ruby/lib/generator/files/metadata_files.rb +2 -0
- data/tracks/ruby/lib/generator/files/track_files.rb +1 -0
- data/tracks/ruby/lib/generator/implementation.rb +1 -0
- data/tracks/ruby/lib/generator/repository.rb +3 -0
- data/tracks/ruby/lib/generator/template_values.rb +1 -0
- data/tracks/ruby/test/generator/case_values_test.rb +2 -0
- data/tracks/ruby/test/generator/command_line_test.rb +1 -0
- data/tracks/ruby/test/generator/files/metadata_files_test.rb +2 -0
- data/tracks/ruby/test/generator/files/track_files_test.rb +1 -0
- data/tracks/ruby/test/generator/implementation_test.rb +1 -0
- data/tracks/ruby/test/tasks/exercise_test.rb +1 -0
- data/tracks/ruby/test/tasks/exercise_test_tasks_test.rb +2 -0
- data/tracks/ruby/test/test_helper.rb +1 -3
- data/tracks/rust/config.json +12 -0
- data/tracks/rust/exercises/atbash-cipher/src/lib.rs +9 -0
- data/tracks/rust/exercises/hamming/src/lib.rs +6 -0
- data/tracks/rust/exercises/isogram/src/lib.rs +3 -0
- data/tracks/rust/exercises/luhn/src/lib.rs +4 -0
- data/tracks/rust/exercises/palindrome-products/.meta/test-in-release-mode +1 -0
- data/tracks/rust/exercises/palindrome-products/Cargo.toml +6 -0
- data/tracks/rust/exercises/palindrome-products/README.md +72 -0
- data/tracks/rust/exercises/palindrome-products/example.rs +25 -0
- data/tracks/rust/exercises/palindrome-products/src/lib.rs +22 -0
- data/tracks/rust/exercises/palindrome-products/tests/palindrome-products.rs +57 -0
- data/tracks/rust/exercises/pangram/src/lib.rs +4 -0
- data/tracks/rust/exercises/run-length-encoding/src/lib.rs +7 -0
- data/tracks/rust/exercises/say/src/lib.rs +3 -4
- data/tracks/rust/exercises/scrabble-score/src/lib.rs +4 -0
- data/tracks/rust/exercises/word-count/src/lib.rs +6 -0
- data/tracks/scheme/exercises/hello-world/example.scm +1 -4
- data/tracks/scheme/exercises/hello-world/hello-world-test.scm +1 -5
- data/tracks/scheme/exercises/scrabble-score/scrabble-score-test.scm +2 -2
- data/tracks/typescript/config.json +30 -0
- data/tracks/typescript/exercises/queen-attack/README.md +59 -0
- data/tracks/typescript/exercises/queen-attack/package.json +36 -0
- data/tracks/typescript/exercises/queen-attack/queen-attack.example.ts +56 -0
- data/tracks/typescript/exercises/queen-attack/queen-attack.test.ts +71 -0
- data/tracks/typescript/exercises/queen-attack/queen-attack.ts +0 -0
- data/tracks/typescript/exercises/queen-attack/tsconfig.json +22 -0
- data/tracks/typescript/exercises/queen-attack/tslint.json +127 -0
- data/tracks/typescript/exercises/queen-attack/yarn.lock +2624 -0
- data/tracks/typescript/exercises/spiral-matrix/README.md +56 -0
- data/tracks/typescript/exercises/spiral-matrix/package.json +36 -0
- data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.example.ts +33 -0
- data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.test.ts +49 -0
- data/tracks/typescript/exercises/spiral-matrix/spiral-matrix.ts +0 -0
- data/tracks/typescript/exercises/spiral-matrix/tsconfig.json +22 -0
- data/tracks/typescript/exercises/spiral-matrix/tslint.json +127 -0
- data/tracks/typescript/exercises/spiral-matrix/yarn.lock +2624 -0
- metadata +35 -3
|
@@ -11,9 +11,9 @@ public class MinesweeperBoardTest {
|
|
|
11
11
|
|
|
12
12
|
@Test
|
|
13
13
|
public void testInputBoardWithNoRowsAndNoColumns() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
List<String> inputBoard = Collections.emptyList();
|
|
15
|
+
List<String> expectedNumberedBoard = Collections.emptyList();
|
|
16
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
17
17
|
|
|
18
18
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
19
19
|
}
|
|
@@ -21,9 +21,9 @@ public class MinesweeperBoardTest {
|
|
|
21
21
|
@Ignore("Remove to run test")
|
|
22
22
|
@Test
|
|
23
23
|
public void testInputBoardWithOneRowAndNoColumns() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
List<String> inputBoard = Collections.singletonList("");
|
|
25
|
+
List<String> expectedNumberedBoard = Collections.singletonList("");
|
|
26
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
27
27
|
|
|
28
28
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
29
29
|
}
|
|
@@ -31,19 +31,19 @@ public class MinesweeperBoardTest {
|
|
|
31
31
|
@Ignore("Remove to run test")
|
|
32
32
|
@Test
|
|
33
33
|
public void testInputBoardWithNoMines() {
|
|
34
|
-
|
|
34
|
+
List<String> inputBoard = Arrays.asList(
|
|
35
35
|
" ",
|
|
36
36
|
" ",
|
|
37
37
|
" "
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
41
41
|
" ",
|
|
42
42
|
" ",
|
|
43
43
|
" "
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
47
47
|
|
|
48
48
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
49
49
|
}
|
|
@@ -51,19 +51,19 @@ public class MinesweeperBoardTest {
|
|
|
51
51
|
@Ignore("Remove to run test")
|
|
52
52
|
@Test
|
|
53
53
|
public void testInputBoardWithOnlyMines() {
|
|
54
|
-
|
|
54
|
+
List<String> inputBoard = Arrays.asList(
|
|
55
55
|
"***",
|
|
56
56
|
"***",
|
|
57
57
|
"***"
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
61
61
|
"***",
|
|
62
62
|
"***",
|
|
63
63
|
"***"
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
67
67
|
|
|
68
68
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
69
69
|
}
|
|
@@ -71,19 +71,19 @@ public class MinesweeperBoardTest {
|
|
|
71
71
|
@Ignore("Remove to run test")
|
|
72
72
|
@Test
|
|
73
73
|
public void testInputBoardWithSingleMineAtCenter() {
|
|
74
|
-
|
|
74
|
+
List<String> inputBoard = Arrays.asList(
|
|
75
75
|
" ",
|
|
76
76
|
" * ",
|
|
77
77
|
" "
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
81
81
|
"111",
|
|
82
82
|
"1*1",
|
|
83
83
|
"111"
|
|
84
84
|
);
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
87
87
|
|
|
88
88
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
89
89
|
}
|
|
@@ -91,19 +91,19 @@ public class MinesweeperBoardTest {
|
|
|
91
91
|
@Ignore("Remove to run test")
|
|
92
92
|
@Test
|
|
93
93
|
public void testInputBoardWithMinesAroundPerimeter() {
|
|
94
|
-
|
|
94
|
+
List<String> inputBoard = Arrays.asList(
|
|
95
95
|
"***",
|
|
96
96
|
"* *",
|
|
97
97
|
"***"
|
|
98
98
|
);
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
101
101
|
"***",
|
|
102
102
|
"*8*",
|
|
103
103
|
"***"
|
|
104
104
|
);
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
107
107
|
|
|
108
108
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
109
109
|
}
|
|
@@ -111,15 +111,15 @@ public class MinesweeperBoardTest {
|
|
|
111
111
|
@Ignore("Remove to run test")
|
|
112
112
|
@Test
|
|
113
113
|
public void testInputBoardWithSingleRowAndTwoMines() {
|
|
114
|
-
|
|
114
|
+
List<String> inputBoard = Collections.singletonList(
|
|
115
115
|
" * * "
|
|
116
116
|
);
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
List<String> expectedNumberedBoard = Collections.singletonList(
|
|
119
119
|
"1*2*1"
|
|
120
120
|
);
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
123
123
|
|
|
124
124
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
125
125
|
}
|
|
@@ -127,15 +127,15 @@ public class MinesweeperBoardTest {
|
|
|
127
127
|
@Ignore("Remove to run test")
|
|
128
128
|
@Test
|
|
129
129
|
public void testInputBoardWithSingleRowAndTwoMinesAtEdges() {
|
|
130
|
-
|
|
130
|
+
List<String> inputBoard = Collections.singletonList(
|
|
131
131
|
"* *"
|
|
132
132
|
);
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
List<String> expectedNumberedBoard = Collections.singletonList(
|
|
135
135
|
"*1 1*"
|
|
136
136
|
);
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
139
139
|
|
|
140
140
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
141
141
|
}
|
|
@@ -143,7 +143,7 @@ public class MinesweeperBoardTest {
|
|
|
143
143
|
@Ignore("Remove to run test")
|
|
144
144
|
@Test
|
|
145
145
|
public void testInputBoardWithSingleColumnAndTwoMines() {
|
|
146
|
-
|
|
146
|
+
List<String> inputBoard = Arrays.asList(
|
|
147
147
|
" ",
|
|
148
148
|
"*",
|
|
149
149
|
" ",
|
|
@@ -151,7 +151,7 @@ public class MinesweeperBoardTest {
|
|
|
151
151
|
" "
|
|
152
152
|
);
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
155
155
|
"1",
|
|
156
156
|
"*",
|
|
157
157
|
"2",
|
|
@@ -159,7 +159,7 @@ public class MinesweeperBoardTest {
|
|
|
159
159
|
"1"
|
|
160
160
|
);
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
163
163
|
|
|
164
164
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
165
165
|
}
|
|
@@ -167,7 +167,7 @@ public class MinesweeperBoardTest {
|
|
|
167
167
|
@Ignore("Remove to run test")
|
|
168
168
|
@Test
|
|
169
169
|
public void testInputBoardWithSingleColumnAndTwoMinesAtEdges() {
|
|
170
|
-
|
|
170
|
+
List<String> inputBoard = Arrays.asList(
|
|
171
171
|
"*",
|
|
172
172
|
" ",
|
|
173
173
|
" ",
|
|
@@ -175,7 +175,7 @@ public class MinesweeperBoardTest {
|
|
|
175
175
|
"*"
|
|
176
176
|
);
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
179
179
|
"*",
|
|
180
180
|
"1",
|
|
181
181
|
" ",
|
|
@@ -183,7 +183,7 @@ public class MinesweeperBoardTest {
|
|
|
183
183
|
"*"
|
|
184
184
|
);
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
187
187
|
|
|
188
188
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
189
189
|
}
|
|
@@ -191,7 +191,7 @@ public class MinesweeperBoardTest {
|
|
|
191
191
|
@Ignore("Remove to run test")
|
|
192
192
|
@Test
|
|
193
193
|
public void testInputBoardWithMinesInCross() {
|
|
194
|
-
|
|
194
|
+
List<String> inputBoard = Arrays.asList(
|
|
195
195
|
" * ",
|
|
196
196
|
" * ",
|
|
197
197
|
"*****",
|
|
@@ -199,7 +199,7 @@ public class MinesweeperBoardTest {
|
|
|
199
199
|
" * "
|
|
200
200
|
);
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
203
203
|
" 2*2 ",
|
|
204
204
|
"25*52",
|
|
205
205
|
"*****",
|
|
@@ -207,7 +207,7 @@ public class MinesweeperBoardTest {
|
|
|
207
207
|
" 2*2 "
|
|
208
208
|
);
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
211
211
|
|
|
212
212
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
213
213
|
}
|
|
@@ -215,7 +215,7 @@ public class MinesweeperBoardTest {
|
|
|
215
215
|
@Ignore("Remove to run test")
|
|
216
216
|
@Test
|
|
217
217
|
public void testLargeInputBoard() {
|
|
218
|
-
|
|
218
|
+
List<String> inputBoard = Arrays.asList(
|
|
219
219
|
" * * ",
|
|
220
220
|
" * ",
|
|
221
221
|
" * ",
|
|
@@ -224,7 +224,7 @@ public class MinesweeperBoardTest {
|
|
|
224
224
|
" "
|
|
225
225
|
);
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
List<String> expectedNumberedBoard = Arrays.asList(
|
|
228
228
|
"1*22*1",
|
|
229
229
|
"12*322",
|
|
230
230
|
" 123*2",
|
|
@@ -233,7 +233,7 @@ public class MinesweeperBoardTest {
|
|
|
233
233
|
"111111"
|
|
234
234
|
);
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
List<String> actualNumberedBoard = new MinesweeperBoard(inputBoard).withNumbers();
|
|
237
237
|
|
|
238
238
|
assertEquals(expectedNumberedBoard, actualNumberedBoard);
|
|
239
239
|
}
|
|
@@ -6,12 +6,12 @@ import org.junit.rules.ExpectedException;
|
|
|
6
6
|
import static org.junit.Assert.assertEquals;
|
|
7
7
|
|
|
8
8
|
public class PhoneNumberTest {
|
|
9
|
-
private
|
|
10
|
-
private
|
|
9
|
+
private static String wrongLengthExceptionMessage = "Number must be 10 or 11 digits";
|
|
10
|
+
private static String numberIs11DigitsButDoesNotStartWith1ExceptionMessage =
|
|
11
11
|
"Can only have 11 digits if number starts with '1'";
|
|
12
|
-
private
|
|
12
|
+
private static String illegalCharacterExceptionMessage =
|
|
13
13
|
"Illegal character in phone number. Only digits, spaces, parentheses, hyphens or dots accepted.";
|
|
14
|
-
private
|
|
14
|
+
private static String illegalAreaOrExchangeCodeMessage =
|
|
15
15
|
"Illegal Area Or Exchange Code. Only 2-9 are valid digits";
|
|
16
16
|
|
|
17
17
|
@Rule
|
|
@@ -19,8 +19,8 @@ public class PhoneNumberTest {
|
|
|
19
19
|
|
|
20
20
|
@Test
|
|
21
21
|
public void cleansTheNumber() {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
String expectedNumber = "2234567890";
|
|
23
|
+
String actualNumber = new PhoneNumber("(223) 456-7890").getNumber();
|
|
24
24
|
|
|
25
25
|
assertEquals(
|
|
26
26
|
expectedNumber, actualNumber
|
|
@@ -30,8 +30,8 @@ public class PhoneNumberTest {
|
|
|
30
30
|
@Ignore("Remove to run test")
|
|
31
31
|
@Test
|
|
32
32
|
public void cleansNumbersWithDots() {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
String expectedNumber = "2234567890";
|
|
34
|
+
String actualNumber = new PhoneNumber("223.456.7890").getNumber();
|
|
35
35
|
|
|
36
36
|
assertEquals(
|
|
37
37
|
expectedNumber, actualNumber
|
|
@@ -41,8 +41,8 @@ public class PhoneNumberTest {
|
|
|
41
41
|
@Ignore("Remove to run test")
|
|
42
42
|
@Test
|
|
43
43
|
public void cleansNumbersWithMultipleSpaces() {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
String expectedNumber = "2234567890";
|
|
45
|
+
String actualNumber = new PhoneNumber("223 456 7890 ").getNumber();
|
|
46
46
|
|
|
47
47
|
assertEquals(
|
|
48
48
|
expectedNumber, actualNumber
|
|
@@ -68,8 +68,8 @@ public class PhoneNumberTest {
|
|
|
68
68
|
@Ignore("Remove to run test")
|
|
69
69
|
@Test
|
|
70
70
|
public void validWhen11DigitsAndStartingWith1() {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
String expectedNumber = "2234567890";
|
|
72
|
+
String actualNumber = new PhoneNumber("12234567890").getNumber();
|
|
73
73
|
|
|
74
74
|
assertEquals(
|
|
75
75
|
expectedNumber, actualNumber
|
|
@@ -79,8 +79,8 @@ public class PhoneNumberTest {
|
|
|
79
79
|
@Ignore("Remove to run test")
|
|
80
80
|
@Test
|
|
81
81
|
public void validWhen11DigitsAndStartingWith1EvenWithPunctuation() {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
String expectedNumber = "2234567890";
|
|
83
|
+
String actualNumber = new PhoneNumber("+1 (223) 456-7890").getNumber();
|
|
84
84
|
|
|
85
85
|
assertEquals(
|
|
86
86
|
expectedNumber, actualNumber
|
|
@@ -8,156 +8,156 @@ import static org.junit.Assert.assertEquals;
|
|
|
8
8
|
public class PokerTest {
|
|
9
9
|
@Test
|
|
10
10
|
public void oneHand() {
|
|
11
|
-
|
|
11
|
+
String hand = "4S 5S 7H 8D JC";
|
|
12
12
|
assertEquals(Arrays.asList(hand), new Poker(Arrays.asList(hand)).getBestHands());
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@Ignore("Remove to run test")
|
|
16
16
|
@Test
|
|
17
17
|
public void nothingVsOnePair() {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
String nothing = "4S 5H 6S 8D JH";
|
|
19
|
+
String pairOf4 = "2S 4H 6S 4D JH";
|
|
20
20
|
assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(nothing, pairOf4)).getBestHands());
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@Ignore("Remove to run test")
|
|
24
24
|
@Test
|
|
25
25
|
public void twoPairs() {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
String pairOf2 = "4S 2H 6S 2D JH";
|
|
27
|
+
String pairOf4 = "2S 4H 6S 4D JH";
|
|
28
28
|
assertEquals(Arrays.asList(pairOf4), new Poker(Arrays.asList(pairOf2, pairOf4)).getBestHands());
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@Ignore("Remove to run test")
|
|
32
32
|
@Test
|
|
33
33
|
public void onePairVsDoublePair() {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
String pairOf8 = "2S 8H 6S 8D JH";
|
|
35
|
+
String doublePair = "4S 5H 4S 8D 5H";
|
|
36
36
|
assertEquals(Arrays.asList(doublePair), new Poker(Arrays.asList(pairOf8, doublePair)).getBestHands());
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@Ignore("Remove to run test")
|
|
40
40
|
@Test
|
|
41
41
|
public void twoDoublePairs() {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
43
|
+
String doublePair4And5 = "4S 5H 4S 8D 5H";
|
|
44
44
|
assertEquals(Arrays.asList(doublePair2And8), new Poker(Arrays.asList(doublePair2And8, doublePair4And5)).getBestHands());
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
@Ignore("Remove to run test")
|
|
48
48
|
@Test
|
|
49
49
|
public void doublePairVsThree() {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
String doublePair2And8 = "2S 8H 2S 8D JH";
|
|
51
|
+
String threeOf4 = "4S 5H 4S 8D 4H";
|
|
52
52
|
assertEquals(Arrays.asList(threeOf4), new Poker(Arrays.asList(doublePair2And8, threeOf4)).getBestHands());
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
@Ignore("Remove to run test")
|
|
56
56
|
@Test
|
|
57
57
|
public void twoThrees() {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
String threeOf2 = "2S 2H 2S 8D JH";
|
|
59
|
+
String threeOf1 = "4S AH AS 8D AH";
|
|
60
60
|
assertEquals(Arrays.asList(threeOf1), new Poker(Arrays.asList(threeOf2, threeOf1)).getBestHands());
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
@Ignore("Remove to run test")
|
|
64
64
|
@Test
|
|
65
65
|
public void threeVsStraight() {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
String threeOf4 = "4S 5H 4S 8D 4H";
|
|
67
|
+
String straight = "3S 4H 2S 6D 5H";
|
|
68
68
|
assertEquals(Arrays.asList(straight), new Poker(Arrays.asList(threeOf4, straight)).getBestHands());
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
@Ignore("Remove to run test")
|
|
72
72
|
@Test
|
|
73
73
|
public void twoStraights() {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
String straightTo8 = "4S 6H 7S 8D 5H";
|
|
75
|
+
String straightTo9 = "5S 7H 8S 9D 6H";
|
|
76
76
|
assertEquals(Arrays.asList(straightTo9), new Poker(Arrays.asList(straightTo8, straightTo9)).getBestHands());
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
String straightTo1 = "AS QH KS TD JH";
|
|
79
|
+
String straightTo5 = "4S AH 3S 2D 5H";
|
|
80
80
|
assertEquals(Arrays.asList(straightTo1), new Poker(Arrays.asList(straightTo1, straightTo5)).getBestHands());
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
@Ignore("Remove to run test")
|
|
84
84
|
@Test
|
|
85
85
|
public void straightVsFlush() {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
String straightTo8 = "4S 6H 7S 8D 5H";
|
|
87
|
+
String flushTo7 = "2S 4S 5S 6S 7S";
|
|
88
88
|
assertEquals(Arrays.asList(flushTo7), new Poker(Arrays.asList(straightTo8, flushTo7)).getBestHands());
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
@Ignore("Remove to run test")
|
|
92
92
|
@Test
|
|
93
93
|
public void twoFlushes() {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
String flushTo8 = "3H 6H 7H 8H 5H";
|
|
95
|
+
String flushTo7 = "2S 4S 5S 6S 7S";
|
|
96
96
|
assertEquals(Arrays.asList(flushTo8), new Poker(Arrays.asList(flushTo8, flushTo7)).getBestHands());
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
@Ignore("Remove to run test")
|
|
100
100
|
@Test
|
|
101
101
|
public void flushVsFull() {
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
String flushTo8 = "3H 6H 7H 8H 5H";
|
|
103
|
+
String full = "4S 5H 4S 5D 4H";
|
|
104
104
|
assertEquals(Arrays.asList(full), new Poker(Arrays.asList(full, flushTo8)).getBestHands());
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
@Ignore("Remove to run test")
|
|
108
108
|
@Test
|
|
109
109
|
public void twoFulls() {
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
String fullOf4By9 = "4H 4S 4D 9S 9D";
|
|
111
|
+
String fullOf5By8 = "5H 5S 5D 8S 8D";
|
|
112
112
|
assertEquals(Arrays.asList(fullOf5By8), new Poker(Arrays.asList(fullOf4By9, fullOf5By8)).getBestHands());
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
@Ignore("Remove to run test")
|
|
116
116
|
@Test
|
|
117
117
|
public void fullVsSquare() {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
String full = "4S 5H 4S 5D 4H";
|
|
119
|
+
String squareOf3 = "3S 3H 2S 3D 3H";
|
|
120
120
|
assertEquals(Arrays.asList(squareOf3), new Poker(Arrays.asList(full, squareOf3)).getBestHands());
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
@Ignore("Remove to run test")
|
|
124
124
|
@Test
|
|
125
125
|
public void twoSquares() {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
String squareOf2 = "2S 2H 2S 8D 2H";
|
|
127
|
+
String squareOf5 = "4S 5H 5S 5D 5H";
|
|
128
128
|
assertEquals(Arrays.asList(squareOf5), new Poker(Arrays.asList(squareOf2, squareOf5)).getBestHands());
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
@Ignore("Remove to run test")
|
|
132
132
|
@Test
|
|
133
133
|
public void squareVsStraightFlush() {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
String squareOf5 = "4S 5H 5S 5D 5H";
|
|
135
|
+
String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
136
136
|
assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(squareOf5, straightFlushTo9)).getBestHands());
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
@Ignore("Remove to run test")
|
|
140
140
|
@Test
|
|
141
141
|
public void twoStraightFlushes() {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
String straightFlushTo8 = "4H 6H 7H 8H 5H";
|
|
143
|
+
String straightFlushTo9 = "5S 7S 8S 9S 6S";
|
|
144
144
|
assertEquals(Arrays.asList(straightFlushTo9), new Poker(Arrays.asList(straightFlushTo8, straightFlushTo9)).getBestHands());
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
@Ignore("Remove to run test")
|
|
148
148
|
@Test
|
|
149
149
|
public void threeHandWithTie() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
String spadeStraightTo9 = "9S 8S 7S 6S 5S";
|
|
151
|
+
String diamondStraightTo9 = "9D 8D 7D 6D 5D";
|
|
152
|
+
String threeOf4 = "4D 4S 4H QS KS";
|
|
153
153
|
assertEquals(Arrays.asList(spadeStraightTo9, diamondStraightTo9), new Poker(Arrays.asList(spadeStraightTo9, diamondStraightTo9, threeOf4)).getBestHands());
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
@Ignore("Remove to run test")
|
|
157
157
|
@Test
|
|
158
158
|
public void straightTo5AgainstAPairOfJacks() {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
String straightTo5 = "2S 4D 5C 3S AS";
|
|
160
|
+
String twoJacks = "JD 8D 7D JC 5D";
|
|
161
161
|
assertEquals(Arrays.asList(straightTo5), new Poker(Arrays.asList(straightTo5, twoJacks)).getBestHands());
|
|
162
162
|
}
|
|
163
163
|
}
|