trackler 2.2.1.86 → 2.2.1.87
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/reverse-string/metadata.yml +0 -1
- data/tracks/bash/CONTRIBUTING.md +129 -28
- data/tracks/bash/config/exercise_readme.go.tmpl +10 -4
- data/tracks/bash/exercises/acronym/README.md +8 -11
- data/tracks/bash/exercises/acronym/{acronym_tests.sh → acronym_test.sh} +0 -0
- data/tracks/bash/exercises/anagram/README.md +6 -1
- data/tracks/bash/exercises/anagram/anagram_test.sh +1 -1
- data/tracks/bash/exercises/armstrong-numbers/README.md +10 -2
- data/tracks/bash/exercises/atbash-cipher/README.md +6 -6
- data/tracks/bash/exercises/bob/README.md +8 -1
- data/tracks/bash/exercises/collatz-conjecture/README.md +11 -2
- data/tracks/bash/exercises/collatz-conjecture/{collatz_test.sh → collatz_conjecture_test.sh} +6 -6
- data/tracks/bash/exercises/difference-of-squares/README.md +6 -1
- data/tracks/bash/exercises/error-handling/README.md +13 -5
- data/tracks/bash/exercises/error-handling/error_handling_test.sh +18 -22
- data/tracks/bash/exercises/error-handling/example.sh +7 -6
- data/tracks/bash/exercises/gigasecond/.meta/hints.md +0 -5
- data/tracks/bash/exercises/gigasecond/README.md +36 -1
- data/tracks/bash/exercises/grains/README.md +10 -2
- data/tracks/bash/exercises/hamming/README.md +6 -1
- data/tracks/bash/exercises/hello-world/README.md +7 -2
- data/tracks/bash/exercises/leap/README.md +7 -2
- data/tracks/bash/exercises/luhn/README.md +7 -2
- data/tracks/bash/exercises/nucleotide-count/README.md +13 -22
- data/tracks/bash/exercises/pangram/README.md +7 -2
- data/tracks/bash/exercises/phone-number/README.md +10 -4
- data/tracks/bash/exercises/raindrops/README.md +6 -1
- data/tracks/bash/exercises/reverse-string/README.md +11 -2
- data/tracks/bash/exercises/rna-transcription/README.md +7 -2
- data/tracks/bash/exercises/roman-numerals/README.md +11 -2
- data/tracks/bash/exercises/triangle/README.md +5 -4
- data/tracks/bash/exercises/two-fer/README.md +7 -9
- data/tracks/bash/exercises/word-count/README.md +6 -2
- data/tracks/bash/exercises/word-count/example.sh +22 -13
- data/tracks/bash/scripts/canonical_data_check.sh +112 -0
- data/tracks/c/exercises/acronym/src/{example.h → acronym.h} +0 -0
- data/tracks/c/exercises/gigasecond/.meta/hints.md +124 -0
- data/tracks/c/exercises/gigasecond/README.md +126 -0
- data/tracks/c/exercises/isogram/src/{example.h → isogram.h} +0 -0
- data/tracks/c/exercises/meetup/.meta/hints.md +124 -0
- data/tracks/c/exercises/meetup/README.md +142 -12
- data/tracks/c/exercises/pangram/src/{example.h → pangram.h} +0 -0
- data/tracks/c/exercises/space-age/.meta/hints.md +124 -0
- data/tracks/c/exercises/space-age/README.md +127 -2
- data/tracks/elisp/bin/test-examples +11 -14
- data/tracks/elisp/config.json +9 -1
- data/tracks/elisp/exercises/acronym/README.md +13 -0
- data/tracks/elisp/exercises/acronym/acronym-test.el +28 -0
- data/tracks/elisp/exercises/acronym/acronym.el +11 -0
- data/tracks/elisp/exercises/acronym/example.el +14 -0
- data/tracks/elisp/exercises/bob/example.el +1 -3
- data/tracks/elisp/exercises/hamming/README.md +2 -0
- data/tracks/elisp/exercises/hamming/hamming-test.el +35 -12
- data/tracks/elisp/exercises/hamming/hamming.el +0 -3
- data/tracks/fsharp/exercises/custom-set/CustomSetTest.fs +206 -132
- data/tracks/fsharp/exercises/custom-set/Example.fs +2 -0
- data/tracks/fsharp/generators/Generators.fs +61 -0
- data/tracks/go/config.json +25 -2
- data/tracks/go/exercises/acronym/acronym_test.go +8 -0
- data/tracks/go/exercises/alphametics/.meta/gen.go +72 -0
- data/tracks/go/exercises/alphametics/.meta/hints.md +38 -0
- data/tracks/go/exercises/alphametics/README.md +93 -0
- data/tracks/go/exercises/alphametics/alphametics_test.go +33 -0
- data/tracks/go/exercises/alphametics/cases_test.go +59 -0
- data/tracks/go/exercises/alphametics/example.go +212 -0
- data/tracks/go/exercises/atbash-cipher/.meta/gen.go +6 -4
- data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/change/.meta/gen.go +7 -5
- data/tracks/go/exercises/change/cases_test.go +2 -2
- data/tracks/go/exercises/collatz-conjecture/.meta/gen.go +5 -3
- data/tracks/go/exercises/collatz-conjecture/cases_test.go +2 -2
- data/tracks/go/exercises/connect/.meta/gen.go +5 -3
- data/tracks/go/exercises/connect/cases_test.go +2 -2
- data/tracks/go/exercises/flatten-array/.meta/gen.go +5 -3
- data/tracks/go/exercises/flatten-array/cases_test.go +2 -2
- data/tracks/go/exercises/meetup/.meta/gen.go +19 -8
- data/tracks/go/exercises/meetup/cases_test.go +2 -2
- data/tracks/go/exercises/simple-linked-list/README.md +47 -0
- data/tracks/go/exercises/simple-linked-list/example.go +74 -0
- data/tracks/go/exercises/simple-linked-list/linked_list_test.go +210 -0
- data/tracks/idris/config.json +2 -2
- data/tracks/java/exercises/all-your-base/.meta/src/reference/java/BaseConverter.java +1 -5
- data/tracks/java/exercises/all-your-base/.meta/version +1 -1
- data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +34 -10
- data/tracks/java/exercises/bob/README.md +2 -0
- data/tracks/java/exercises/kindergarten-garden/.meta/version +1 -0
- data/tracks/java/exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java +0 -55
- data/tracks/java/exercises/meetup/.meta/version +1 -0
- data/tracks/java/exercises/meetup/src/test/java/MeetupTest.java +32 -0
- data/tracks/java/exercises/parallel-letter-frequency/README.md +1 -0
- data/tracks/java/exercises/proverb/README.md +16 -10
- data/tracks/java/exercises/rail-fence-cipher/README.md +5 -6
- data/tracks/java/exercises/two-fer/README.md +1 -1
- data/tracks/java/exercises/word-search/.meta/version +1 -1
- data/tracks/java/exercises/word-search/src/test/java/WordSearcherTest.java +240 -2
- data/tracks/javascript/.eslintignore +0 -1
- data/tracks/javascript/exercises/palindrome-products/example.js +3 -3
- data/tracks/kotlin/docs/INSTALLATION.md +77 -68
- data/tracks/kotlin/docs/TESTS.md +41 -39
- data/tracks/perl6/exercises/acronym/acronym.t +20 -8
- data/tracks/perl6/exercises/acronym/example.yaml +1 -1
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +108 -66
- data/tracks/perl6/exercises/all-your-base/example.yaml +2 -2
- data/tracks/perl6/exercises/allergies/allergies.t +39 -15
- data/tracks/perl6/exercises/allergies/example.yaml +2 -2
- data/tracks/perl6/exercises/anagram/anagram.t +73 -40
- data/tracks/perl6/exercises/anagram/example.yaml +1 -1
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +38 -15
- data/tracks/perl6/exercises/atbash-cipher/example.yaml +1 -1
- data/tracks/perl6/exercises/bob/bob.t +77 -27
- data/tracks/perl6/exercises/bob/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +20 -8
- data/tracks/perl6/exercises/luhn/example.yaml +1 -1
- data/tracks/perl6/exercises/luhn/luhn.t +42 -16
- data/tracks/perl6/exercises/roman-numerals/README.md +68 -0
- data/tracks/php/exercises/gigasecond/gigasecond_test.php +1 -1
- data/tracks/python/docs/ABOUT.md +2 -2
- metadata +27 -10
- data/tracks/bash/docs/EXERCISE_README_INSERT.md +0 -3
- data/tracks/bash/exercises/word-count/example.awk +0 -12
- data/tracks/java/exercises/alphametics/src/main/java/.keep +0 -0
data/tracks/idris/config.json
CHANGED
|
@@ -39,11 +39,7 @@ final class BaseConverter {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (originalDigits.length == 0) {
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (originalDigits.length > 1 && originalDigits[0] == 0) {
|
|
46
|
-
throw new IllegalArgumentException("Digits may not contain leading zeros.");
|
|
42
|
+
return;
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
if (Arrays.stream(originalDigits).min().getAsInt() < 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.1.0
|
|
@@ -150,10 +150,18 @@ public class BaseConverterTest {
|
|
|
150
150
|
@Ignore("Remove to run test")
|
|
151
151
|
@Test
|
|
152
152
|
public void testEmptyDigits() {
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
final BaseConverter baseConverter = new BaseConverter(2, new int[]{});
|
|
154
|
+
|
|
155
|
+
final int[] expectedDigits = new int[]{0};
|
|
156
|
+
final int[] actualDigits = baseConverter.convertToBase(10);
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
assertArrayEquals(
|
|
159
|
+
String.format(
|
|
160
|
+
"Expected digits: %s but found digits: %s",
|
|
161
|
+
Arrays.toString(expectedDigits),
|
|
162
|
+
Arrays.toString(actualDigits)),
|
|
163
|
+
expectedDigits,
|
|
164
|
+
actualDigits);
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
@Ignore("Remove to run test")
|
|
@@ -176,19 +184,35 @@ public class BaseConverterTest {
|
|
|
176
184
|
@Ignore("Remove to run test")
|
|
177
185
|
@Test
|
|
178
186
|
public void testMultipleZeros() {
|
|
179
|
-
|
|
180
|
-
|
|
187
|
+
final BaseConverter baseConverter = new BaseConverter(10, new int[]{0, 0, 0});
|
|
188
|
+
|
|
189
|
+
final int[] expectedDigits = new int[]{0};
|
|
190
|
+
final int[] actualDigits = baseConverter.convertToBase(2);
|
|
181
191
|
|
|
182
|
-
|
|
192
|
+
assertArrayEquals(
|
|
193
|
+
String.format(
|
|
194
|
+
"Expected digits: %s but found digits: %s",
|
|
195
|
+
Arrays.toString(expectedDigits),
|
|
196
|
+
Arrays.toString(actualDigits)),
|
|
197
|
+
expectedDigits,
|
|
198
|
+
actualDigits);
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
@Ignore("Remove to run test")
|
|
186
202
|
@Test
|
|
187
203
|
public void testLeadingZeros() {
|
|
188
|
-
|
|
189
|
-
|
|
204
|
+
final BaseConverter baseConverter = new BaseConverter(7, new int[]{0, 6, 0});
|
|
205
|
+
|
|
206
|
+
final int[] expectedDigits = new int[]{4, 2};
|
|
207
|
+
final int[] actualDigits = baseConverter.convertToBase(10);
|
|
190
208
|
|
|
191
|
-
|
|
209
|
+
assertArrayEquals(
|
|
210
|
+
String.format(
|
|
211
|
+
"Expected digits: %s but found digits: %s",
|
|
212
|
+
Arrays.toString(expectedDigits),
|
|
213
|
+
Arrays.toString(actualDigits)),
|
|
214
|
+
expectedDigits,
|
|
215
|
+
actualDigits);
|
|
192
216
|
}
|
|
193
217
|
|
|
194
218
|
@Ignore("Remove to run test")
|
|
@@ -250,7 +274,7 @@ public class BaseConverterTest {
|
|
|
250
274
|
@Ignore("Remove to run test")
|
|
251
275
|
@Test
|
|
252
276
|
public void testSecondBaseIsZero() {
|
|
253
|
-
final BaseConverter baseConverter = new BaseConverter(
|
|
277
|
+
final BaseConverter baseConverter = new BaseConverter(10, new int[]{7});
|
|
254
278
|
|
|
255
279
|
expectedException.expect(IllegalArgumentException.class);
|
|
256
280
|
expectedException.expectMessage("Bases must be at least 2.");
|
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
|
6
6
|
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
|
8
8
|
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
|
10
|
+
|
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
|
10
12
|
anything.
|
|
11
13
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -124,59 +124,4 @@ public class KindergartenGardenTest {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
@Ignore("Remove to run test")
|
|
128
|
-
@Test
|
|
129
|
-
public void customStudentGardenFirstStudentInAlphabeticalOrder() {
|
|
130
|
-
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
131
|
-
String student = "Patricia";
|
|
132
|
-
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
133
|
-
List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS);
|
|
134
|
-
|
|
135
|
-
assertEquals(
|
|
136
|
-
expected,
|
|
137
|
-
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@Ignore("Remove to run test")
|
|
142
|
-
@Test
|
|
143
|
-
public void customStudentGardenSecondStudentInAlphabeticalOrder() {
|
|
144
|
-
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
145
|
-
String student = "Roger";
|
|
146
|
-
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
147
|
-
List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER);
|
|
148
|
-
|
|
149
|
-
assertEquals(
|
|
150
|
-
expected,
|
|
151
|
-
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@Ignore("Remove to run test")
|
|
156
|
-
@Test
|
|
157
|
-
public void customStudentGardenThirdStudentInAlphabeticalOrder() {
|
|
158
|
-
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
159
|
-
String student = "Samantha";
|
|
160
|
-
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
161
|
-
List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS);
|
|
162
|
-
|
|
163
|
-
assertEquals(
|
|
164
|
-
expected,
|
|
165
|
-
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@Ignore("Remove to run test")
|
|
170
|
-
@Test
|
|
171
|
-
public void customStudentGardenFourthStudentInAlphabeticalOrder() {
|
|
172
|
-
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
173
|
-
String student = "Xander";
|
|
174
|
-
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
175
|
-
List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS);
|
|
176
|
-
|
|
177
|
-
assertEquals(
|
|
178
|
-
expected,
|
|
179
|
-
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
127
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.0
|
|
@@ -734,4 +734,36 @@ public class MeetupTest {
|
|
|
734
734
|
Meetup meetup = new Meetup(4, 2013);
|
|
735
735
|
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.LAST));
|
|
736
736
|
}
|
|
737
|
+
|
|
738
|
+
@Ignore("Remove to run test")
|
|
739
|
+
@Test
|
|
740
|
+
public void testLastWednesdayOfFebruary2012() {
|
|
741
|
+
LocalDate expected = LocalDate.of(2012, 2, 29);
|
|
742
|
+
Meetup meetup = new Meetup(2, 2012);
|
|
743
|
+
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST));
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
@Ignore("Remove to run test")
|
|
747
|
+
@Test
|
|
748
|
+
public void testLastWednesdayOfDecember2014() {
|
|
749
|
+
LocalDate expected = LocalDate.of(2014, 12, 31);
|
|
750
|
+
Meetup meetup = new Meetup(12, 2014);
|
|
751
|
+
assertEquals(expected, meetup.day(DayOfWeek.WEDNESDAY, MeetupSchedule.LAST));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
@Ignore("Remove to run test")
|
|
755
|
+
@Test
|
|
756
|
+
public void testLastSundayOfFebruary2015() {
|
|
757
|
+
LocalDate expected = LocalDate.of(2015, 2, 22);
|
|
758
|
+
Meetup meetup = new Meetup(2, 2015);
|
|
759
|
+
assertEquals(expected, meetup.day(DayOfWeek.SUNDAY, MeetupSchedule.LAST));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
@Ignore("Remove to run test")
|
|
763
|
+
@Test
|
|
764
|
+
public void testFirstFridayOfDecember2012() {
|
|
765
|
+
LocalDate expected = LocalDate.of(2012, 12, 7);
|
|
766
|
+
Meetup meetup = new Meetup(12, 2012);
|
|
767
|
+
assertEquals(expected, meetup.day(DayOfWeek.FRIDAY, MeetupSchedule.FIRST));
|
|
768
|
+
}
|
|
737
769
|
}
|
|
@@ -15,6 +15,7 @@ Java documentation on [parallel streams](https://docs.oracle.com/javase/tutorial
|
|
|
15
15
|
|
|
16
16
|
As a stretch goal, consider if your implementation will work for characters with [diacritics or accents](https://en.wikipedia.org/wiki/Diacritic). For example, such solutions should not consider e and ë the same character. An example text for this case is [Wilhelmus](https://en.wikipedia.org/wiki/Wilhelmus), the Dutch national anthem.
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
# Running the tests
|
|
19
20
|
|
|
20
21
|
You can run all the tests for an exercise by entering
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
# Proverb
|
|
1
|
+
# Proverb
|
|
2
2
|
|
|
3
|
-
For want of a horseshoe nail, a kingdom was lost, or so the saying goes.
|
|
3
|
+
For want of a horseshoe nail, a kingdom was lost, or so the saying goes.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Given a list of inputs, generate the relevant proverb. For example, given the list `["nail", "shoe", "horse", "rider", "message", "battle", "kingdom"]`, you will output the full text of this proverbial rhyme:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
For want of a nail the shoe was lost.
|
|
9
|
+
For want of a shoe the horse was lost.
|
|
10
|
+
For want of a horse the rider was lost.
|
|
11
|
+
For want of a rider the message was lost.
|
|
12
|
+
For want of a message the battle was lost.
|
|
13
|
+
For want of a battle the kingdom was lost.
|
|
14
|
+
And all for the want of a nail.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Note that the list of inputs may vary; your solution should be able to handle lists of arbitrary length and content. No line of the output text should be a static, unchanging string; all should vary according to the input given.
|
|
12
18
|
|
|
13
19
|
# Running the tests
|
|
14
20
|
|
|
@@ -22,7 +28,7 @@ in your terminal.
|
|
|
22
28
|
|
|
23
29
|
## Source
|
|
24
30
|
|
|
25
|
-
Wikipedia [
|
|
31
|
+
Wikipedia [http://en.wikipedia.org/wiki/For_Want_of_a_Nail](http://en.wikipedia.org/wiki/For_Want_of_a_Nail)
|
|
26
32
|
|
|
27
33
|
## Submitting Incomplete Solutions
|
|
28
34
|
|
|
@@ -58,21 +58,20 @@ W . . . E . . . C . . . R . . . L . . . T . . . E
|
|
|
58
58
|
|
|
59
59
|
If you now read along the zig-zag shape you can read the original message.
|
|
60
60
|
|
|
61
|
+
# Running the tests
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
To run the tests:
|
|
63
|
+
You can run all the tests for an exercise by entering
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
66
|
$ gradle test
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
in your terminal.
|
|
71
70
|
|
|
72
71
|
## Source
|
|
73
72
|
|
|
74
|
-
[
|
|
73
|
+
Wikipedia [https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher](https://en.wikipedia.org/wiki/Transposition_cipher#Rail_Fence_cipher)
|
|
75
74
|
|
|
76
75
|
## Submitting Incomplete Solutions
|
|
76
|
+
|
|
77
77
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
78
|
-
i
|
|
@@ -66,7 +66,7 @@ in your terminal.
|
|
|
66
66
|
|
|
67
67
|
## Source
|
|
68
68
|
|
|
69
|
-
This is an exercise to introduce users to basic programming constructs, just after
|
|
69
|
+
This is an exercise to introduce users to basic programming constructs, just after Hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
|
|
70
70
|
|
|
71
71
|
## Submitting Incomplete Solutions
|
|
72
72
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import org.junit.Before;
|
|
2
2
|
import org.junit.Test;
|
|
3
|
+
import org.junit.Ignore;
|
|
3
4
|
|
|
4
5
|
import java.util.*;
|
|
5
6
|
|
|
@@ -15,7 +16,136 @@ public class WordSearcherTest {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
@Test
|
|
18
|
-
public void
|
|
19
|
+
public void testAcceptsInitialGridAndTargetWord() {
|
|
20
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
21
|
+
expectedLocations.put("clojure", Optional.empty());
|
|
22
|
+
|
|
23
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
24
|
+
|
|
25
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
26
|
+
searchWords,
|
|
27
|
+
new char[][]{
|
|
28
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
assertEquals(expectedLocations, actualLocations);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Ignore("Remove to run test")
|
|
36
|
+
@Test
|
|
37
|
+
public void testLocatesOneWordWrittenLeftToRight() {
|
|
38
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
39
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 1), new Pair(7, 1))));
|
|
40
|
+
|
|
41
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
42
|
+
|
|
43
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
44
|
+
searchWords,
|
|
45
|
+
new char[][]{
|
|
46
|
+
{'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm', 't'}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
assertEquals(expectedLocations, actualLocations);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@Ignore("Remove to run test")
|
|
54
|
+
@Test
|
|
55
|
+
public void testShouldLocateTheSameWordLeftToRightInDifferentPosition() {
|
|
56
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
57
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(3, 1), new Pair(9, 1))));
|
|
58
|
+
|
|
59
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
60
|
+
|
|
61
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
62
|
+
searchWords,
|
|
63
|
+
new char[][]{
|
|
64
|
+
{'m', 't', 'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r'}
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
assertEquals(expectedLocations, actualLocations);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Ignore("Remove to run test")
|
|
72
|
+
@Test
|
|
73
|
+
public void testShouldLocateADifferentLeftToRightWord() {
|
|
74
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
75
|
+
expectedLocations.put("coffee", Optional.of(new WordLocation(new Pair(1, 1), new Pair(6, 1))));
|
|
76
|
+
|
|
77
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
78
|
+
|
|
79
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
80
|
+
searchWords,
|
|
81
|
+
new char[][]{
|
|
82
|
+
{'c', 'o', 'f', 'f', 'e', 'e', 'l', 'p', 'l', 'x'}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
assertEquals(expectedLocations, actualLocations);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Ignore("Remove to run test")
|
|
90
|
+
@Test
|
|
91
|
+
public void testShouldLocateThatDifferentLeftToRightWordInADifferentPosition() {
|
|
92
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
93
|
+
expectedLocations.put("coffee", Optional.of(new WordLocation(new Pair(2, 1), new Pair(7, 1))));
|
|
94
|
+
|
|
95
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
96
|
+
|
|
97
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
98
|
+
searchWords,
|
|
99
|
+
new char[][]{
|
|
100
|
+
{'x', 'c', 'o', 'f', 'f', 'e', 'e', 'z', 'l', 'p'}
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
assertEquals(expectedLocations, actualLocations);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@Ignore("Remove to run test")
|
|
108
|
+
@Test
|
|
109
|
+
public void testShouldLocateLeftToRightWordInTwoLineGrid() {
|
|
110
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
111
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(2, 2), new Pair(8, 2))));
|
|
112
|
+
|
|
113
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
114
|
+
|
|
115
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
116
|
+
searchWords,
|
|
117
|
+
new char[][]{
|
|
118
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'},
|
|
119
|
+
{'t', 'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm'}
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
assertEquals(expectedLocations, actualLocations);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@Ignore("Remove to run test")
|
|
127
|
+
@Test
|
|
128
|
+
public void testShouldLocateLeftToRightWordInThreeLineGrid() {
|
|
129
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
130
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 3), new Pair(7, 3))));
|
|
131
|
+
|
|
132
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
133
|
+
|
|
134
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
135
|
+
searchWords,
|
|
136
|
+
new char[][]{
|
|
137
|
+
{'c', 'a', 'm', 'd', 'c', 'i', 'm', 'g', 't', 'c'},
|
|
138
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'},
|
|
139
|
+
{'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm', 't'}
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
assertEquals(expectedLocations, actualLocations);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@Ignore("Remove to run test")
|
|
147
|
+
@Test
|
|
148
|
+
public void testLocatesWordWrittenLeftToRightInTenLineGrid() {
|
|
19
149
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
20
150
|
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10))));
|
|
21
151
|
|
|
@@ -40,11 +170,112 @@ public class WordSearcherTest {
|
|
|
40
170
|
assertEquals(expectedLocations, actualLocations);
|
|
41
171
|
}
|
|
42
172
|
|
|
173
|
+
@Ignore("Remove to run test")
|
|
174
|
+
@Test
|
|
175
|
+
public void testLocatesSameWordWrittenLeftToRightInDifferentTenLineGrid() {
|
|
176
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
177
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 9), new Pair(7, 9))));
|
|
178
|
+
|
|
179
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
180
|
+
|
|
181
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
182
|
+
searchWords,
|
|
183
|
+
new char[][]{
|
|
184
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'},
|
|
185
|
+
{'c', 'a', 'm', 'd', 'c', 'i', 'm', 'g', 't', 'c'},
|
|
186
|
+
{'o', 'i', 'v', 'o', 'k', 'p', 'r', 'j', 's', 'm'},
|
|
187
|
+
{'p', 'b', 'w', 'a', 's', 'q', 'r', 'o', 'u', 'a'},
|
|
188
|
+
{'r', 'i', 'x', 'i', 'l', 'e', 'l', 'h', 'r', 's'},
|
|
189
|
+
{'w', 'o', 'l', 'c', 'q', 'l', 'i', 'r', 'p', 'c'},
|
|
190
|
+
{'s', 'c', 'r', 'e', 'e', 'a', 'u', 'm', 'g', 'r'},
|
|
191
|
+
{'a', 'l', 'x', 'h', 'p', 'b', 'u', 'r', 'y', 'i'},
|
|
192
|
+
{'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm', 't'},
|
|
193
|
+
{'j', 'a', 'l', 'a', 'y', 'c', 'a', 'l', 'm', 'p'}
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
assertEquals(expectedLocations, actualLocations);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@Ignore("Remove to run test")
|
|
201
|
+
@Test
|
|
202
|
+
public void testLocatesDifferentWordWrittenLeftToRightInTenLineGrid() {
|
|
203
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
204
|
+
expectedLocations.put("fortran", Optional.of(new WordLocation(new Pair(1, 7), new Pair(7, 7))));
|
|
205
|
+
|
|
206
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
207
|
+
|
|
208
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
209
|
+
searchWords,
|
|
210
|
+
new char[][]{
|
|
211
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'},
|
|
212
|
+
{'c', 'a', 'm', 'd', 'c', 'i', 'm', 'g', 't', 'c'},
|
|
213
|
+
{'o', 'i', 'v', 'o', 'k', 'p', 'r', 'j', 's', 'm'},
|
|
214
|
+
{'p', 'b', 'w', 'a', 's', 'q', 'r', 'o', 'u', 'a'},
|
|
215
|
+
{'r', 'i', 'x', 'i', 'l', 'e', 'l', 'h', 'r', 's'},
|
|
216
|
+
{'w', 'o', 'l', 'c', 'q', 'l', 'i', 'r', 'p', 'c'},
|
|
217
|
+
{'f', 'o', 'r', 't', 'r', 'a', 'n', 'f', 't', 'w'},
|
|
218
|
+
{'a', 'l', 'x', 'h', 'p', 'b', 'u', 'r', 'y', 'i'},
|
|
219
|
+
{'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm', 't'},
|
|
220
|
+
{'j', 'a', 'l', 'a', 'y', 'c', 'a', 'l', 'm', 'p'}
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
assertEquals(expectedLocations, actualLocations);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@Ignore("Remove to run test")
|
|
43
228
|
@Test
|
|
44
|
-
public void
|
|
229
|
+
public void testShouldLocateMultipleWords() {
|
|
45
230
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
231
|
+
expectedLocations.put("fortran", Optional.of(new WordLocation(new Pair(1, 7), new Pair(7, 7))));
|
|
46
232
|
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10))));
|
|
233
|
+
|
|
234
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
235
|
+
|
|
236
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
237
|
+
searchWords,
|
|
238
|
+
new char[][]{
|
|
239
|
+
{'j', 'e', 'f', 'b', 'l', 'p', 'e', 'p', 'r', 'e'},
|
|
240
|
+
{'c', 'a', 'm', 'd', 'c', 'i', 'm', 'g', 't', 'c'},
|
|
241
|
+
{'o', 'i', 'v', 'o', 'k', 'p', 'r', 'j', 's', 'm'},
|
|
242
|
+
{'p', 'b', 'w', 'a', 's', 'q', 'r', 'o', 'u', 'a'},
|
|
243
|
+
{'r', 'i', 'x', 'i', 'l', 'e', 'l', 'h', 'r', 's'},
|
|
244
|
+
{'w', 'o', 'l', 'c', 'q', 'l', 'i', 'r', 'p', 'c'},
|
|
245
|
+
{'f', 'o', 'r', 't', 'r', 'a', 'n', 'f', 't', 'w'},
|
|
246
|
+
{'a', 'l', 'x', 'h', 'p', 'b', 'u', 'r', 'y', 'i'},
|
|
247
|
+
{'j', 'a', 'l', 'a', 'y', 'c', 'a', 'l', 'm', 'p'},
|
|
248
|
+
{'c', 'l', 'o', 'j', 'u', 'r', 'e', 'r', 'm', 't'}
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
assertEquals(expectedLocations, actualLocations);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@Ignore("Remove to run test")
|
|
256
|
+
@Test
|
|
257
|
+
public void testShouldLocateASingleWordRightToLeft() {
|
|
258
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
259
|
+
expectedLocations.put("elixir", Optional.of(new WordLocation(new Pair(6, 1), new Pair(1, 1))));
|
|
260
|
+
|
|
261
|
+
Set<String> searchWords = expectedLocations.keySet();
|
|
262
|
+
|
|
263
|
+
Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search(
|
|
264
|
+
searchWords,
|
|
265
|
+
new char[][]{
|
|
266
|
+
{'r', 'i', 'x', 'i', 'l', 'e', 'l', 'h', 'r', 's'}
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
assertEquals(expectedLocations, actualLocations);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
@Ignore("Remove to run test")
|
|
274
|
+
@Test
|
|
275
|
+
public void testShouldLocateMultipleWordsWrittenInDifferentHorizontalDirections() {
|
|
276
|
+
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
47
277
|
expectedLocations.put("elixir", Optional.of(new WordLocation(new Pair(6, 5), new Pair(1, 5))));
|
|
278
|
+
expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10))));
|
|
48
279
|
|
|
49
280
|
Set<String> searchWords = expectedLocations.keySet();
|
|
50
281
|
|
|
@@ -67,6 +298,7 @@ public class WordSearcherTest {
|
|
|
67
298
|
assertEquals(expectedLocations, actualLocations);
|
|
68
299
|
}
|
|
69
300
|
|
|
301
|
+
@Ignore("Remove to run test")
|
|
70
302
|
@Test
|
|
71
303
|
public void testLocatesWordsWrittenTopToBottom() {
|
|
72
304
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -95,6 +327,7 @@ public class WordSearcherTest {
|
|
|
95
327
|
assertEquals(expectedLocations, actualLocations);
|
|
96
328
|
}
|
|
97
329
|
|
|
330
|
+
@Ignore("Remove to run test")
|
|
98
331
|
@Test
|
|
99
332
|
public void testLocatesWordsWrittenBottomToTop() {
|
|
100
333
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -122,6 +355,7 @@ public class WordSearcherTest {
|
|
|
122
355
|
assertEquals(expectedLocations, actualLocations);
|
|
123
356
|
}
|
|
124
357
|
|
|
358
|
+
@Ignore("Remove to run test")
|
|
125
359
|
@Test
|
|
126
360
|
public void testLocatesWordsWrittenTopLeftToBottomRight() {
|
|
127
361
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -150,6 +384,7 @@ public class WordSearcherTest {
|
|
|
150
384
|
assertEquals(expectedLocations, actualLocations);
|
|
151
385
|
}
|
|
152
386
|
|
|
387
|
+
@Ignore("Remove to run test")
|
|
153
388
|
@Test
|
|
154
389
|
public void testLocatesWordsWrittenBottomRightToTopLeft() {
|
|
155
390
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -179,6 +414,7 @@ public class WordSearcherTest {
|
|
|
179
414
|
assertEquals(expectedLocations, actualLocations);
|
|
180
415
|
}
|
|
181
416
|
|
|
417
|
+
@Ignore("Remove to run test")
|
|
182
418
|
@Test
|
|
183
419
|
public void testLocatesWordsWrittenBottomLeftToTopRight() {
|
|
184
420
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -209,6 +445,7 @@ public class WordSearcherTest {
|
|
|
209
445
|
assertEquals(expectedLocations, actualLocations);
|
|
210
446
|
}
|
|
211
447
|
|
|
448
|
+
@Ignore("Remove to run test")
|
|
212
449
|
@Test
|
|
213
450
|
public void testLocatesWordsWrittenTopRightToBottomLeft() {
|
|
214
451
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|
|
@@ -240,6 +477,7 @@ public class WordSearcherTest {
|
|
|
240
477
|
assertEquals(expectedLocations, actualLocations);
|
|
241
478
|
}
|
|
242
479
|
|
|
480
|
+
@Ignore("Remove to run test")
|
|
243
481
|
@Test
|
|
244
482
|
public void testFailsToLocateAWordsThatIsNotInThePuzzle() {
|
|
245
483
|
Map<String, Optional<WordLocation>> expectedLocations = new HashMap<>();
|