trackler 2.0.6.25 → 2.0.6.26
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/common/exercises/nucleotide-count/canonical-data.json +44 -0
- data/common/exercises/scrabble-score/canonical-data.json +5 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/exercises/gigasecond/test/test_gigasecond.c +1 -1
- data/tracks/c/exercises/grains/src/example.c +4 -0
- data/tracks/c/exercises/grains/test/test_grains.c +12 -0
- data/tracks/csharp/exercises/error-handling/ErrorHandlingTest.cs +5 -5
- data/tracks/delphi/SETUP.md +1 -1
- data/tracks/fsharp/exercises/food-chain/HINTS.md +2 -0
- data/tracks/fsharp/exercises/house/HINTS.md +2 -0
- data/tracks/fsharp/exercises/proverb/HINTS.md +2 -0
- data/tracks/fsharp/exercises/scrabble-score/ScrabbleScoreTest.fs +6 -1
- data/tracks/fsharp/exercises/twelve-days/HINTS.md +2 -0
- data/tracks/haskell/config.json +60 -0
- data/tracks/java/config.json +6 -0
- data/tracks/java/exercises/clock/build.gradle +17 -0
- data/tracks/java/exercises/clock/src/example/java/Clock.java +49 -0
- data/tracks/java/exercises/clock/src/main/java/.keep +0 -0
- data/tracks/java/exercises/clock/src/test/java/ClockAddTest.java +135 -0
- data/tracks/java/exercises/clock/src/test/java/ClockCreationTest.java +120 -0
- data/tracks/java/exercises/clock/src/test/java/ClockEqualTest.java +98 -0
- data/tracks/java/exercises/grade-school/build.gradle +1 -0
- data/tracks/java/exercises/grade-school/src/test/java/SchoolTest.java +39 -28
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/exercises/rna-transcription/example.js +1 -0
- data/tracks/javascript/exercises/rna-transcription/rna-transcription.spec.js +12 -0
- data/tracks/rust/config.json +41 -41
- metadata +13 -2
@@ -1,14 +1,14 @@
|
|
1
1
|
import org.junit.Ignore;
|
2
2
|
import org.junit.Test;
|
3
3
|
|
4
|
-
import java.lang.Integer;
|
5
|
-
import java.util.*;
|
6
4
|
import java.util.ArrayList;
|
7
|
-
import java.util.Arrays;
|
8
5
|
import java.util.HashMap;
|
9
|
-
import java.util.List;
|
10
6
|
import java.util.Map;
|
7
|
+
import java.util.List;
|
8
|
+
import java.util.Collection;
|
11
9
|
|
10
|
+
import org.hamcrest.Matcher;
|
11
|
+
import org.hamcrest.collection.IsIterableContainingInOrder;
|
12
12
|
import static org.hamcrest.CoreMatchers.*;
|
13
13
|
import static org.junit.Assert.assertThat;
|
14
14
|
import static org.junit.Assert.assertTrue;
|
@@ -60,31 +60,29 @@ public class SchoolTest {
|
|
60
60
|
assertTrue(school.grade(1).isEmpty());
|
61
61
|
}
|
62
62
|
|
63
|
-
@Ignore
|
64
|
-
@Test
|
65
|
-
public void gradeReturnsStudentsInTheOrderTheyWereInserted() {
|
66
|
-
int grade = 4;
|
67
|
-
school.add("Bartimaeus", grade);
|
68
|
-
school.add("Nathaniel", grade);
|
69
|
-
school.add("Faquarl", grade);
|
70
|
-
List<String> studentsInGrade = school.grade(grade);
|
71
|
-
assertThat(studentsInGrade.get(0), is("Bartimaeus"));
|
72
|
-
assertThat(studentsInGrade.get(1), is("Nathaniel"));
|
73
|
-
assertThat(studentsInGrade.get(2), is("Faquarl"));
|
74
|
-
}
|
75
|
-
|
76
63
|
@Ignore
|
77
64
|
@Test
|
78
65
|
public void sortsSchool() {
|
66
|
+
school.add("Kyle", 4);
|
67
|
+
school.add("Zed", 4);
|
68
|
+
school.add("Adam", 4);
|
79
69
|
school.add("Jennifer", 4);
|
80
70
|
school.add("Kareem", 6);
|
81
71
|
school.add("Christopher", 4);
|
82
|
-
school.add("
|
83
|
-
Map<Integer,
|
84
|
-
sortedStudents.put(6,
|
85
|
-
|
86
|
-
sortedStudents.put(
|
87
|
-
|
72
|
+
school.add("Kylie", 3);
|
73
|
+
Map<Integer, Matcher> sortedStudents = new HashMap<Integer, Matcher>();
|
74
|
+
sortedStudents.put(6, IsIterableContainingInOrder
|
75
|
+
.contains("Kareem"));
|
76
|
+
sortedStudents.put(4, IsIterableContainingInOrder
|
77
|
+
.contains("Adam", "Christopher", "Jennifer", "Kyle", "Zed"));
|
78
|
+
sortedStudents.put(3, IsIterableContainingInOrder
|
79
|
+
.contains("Kylie"));
|
80
|
+
|
81
|
+
Map schoolStudents = school.studentsByGradeAlphabetical();
|
82
|
+
for (Map.Entry<?, Matcher> entry : sortedStudents.entrySet()) {
|
83
|
+
|
84
|
+
assertThat((Collection) schoolStudents.get(entry.getKey()), entry.getValue());
|
85
|
+
}
|
88
86
|
}
|
89
87
|
|
90
88
|
@Ignore
|
@@ -93,8 +91,14 @@ public class SchoolTest {
|
|
93
91
|
String shouldNotBeAdded = "Should not be added to school";
|
94
92
|
int grade = 1;
|
95
93
|
|
96
|
-
|
97
|
-
|
94
|
+
Collection students = school.grade(grade);
|
95
|
+
|
96
|
+
try {
|
97
|
+
students.add(shouldNotBeAdded);
|
98
|
+
} catch (Exception exception) {
|
99
|
+
// Also valid that the add operation throws an exception
|
100
|
+
// Such as UnsupportedOperationException when an umodifiable collection type is used
|
101
|
+
}
|
98
102
|
|
99
103
|
assertThat(school.grade(grade), not(hasItem(shouldNotBeAdded)));
|
100
104
|
}
|
@@ -107,9 +111,16 @@ public class SchoolTest {
|
|
107
111
|
List<String> listWhichShouldNotBeAdded = new ArrayList<>();
|
108
112
|
listWhichShouldNotBeAdded.add(studentWhichShouldNotBeAdded);
|
109
113
|
|
110
|
-
Map
|
111
|
-
|
114
|
+
Map sortedStudents = school.studentsByGradeAlphabetical();
|
115
|
+
|
116
|
+
try {
|
117
|
+
sortedStudents.put(grade, listWhichShouldNotBeAdded);
|
118
|
+
} catch (Exception exception) {
|
119
|
+
// Also valid that the put operation throws an exception
|
120
|
+
// Such as UnsupportedOperationException when an unmodifiableMap is used
|
121
|
+
}
|
112
122
|
|
113
|
-
assertThat(school.studentsByGradeAlphabetical().get(grade),
|
123
|
+
assertThat(school.studentsByGradeAlphabetical().get(grade),
|
124
|
+
not(hasItem(studentWhichShouldNotBeAdded)));
|
114
125
|
}
|
115
126
|
}
|
@@ -23,4 +23,16 @@ describe('toRna()', function() {
|
|
23
23
|
expect(dnaTranscriber.toRna('ACGTGGTCTTAA'))
|
24
24
|
.toEqual('UGCACCAGAAUU');
|
25
25
|
});
|
26
|
+
|
27
|
+
xit('correctly handles completely invalid input', function () {
|
28
|
+
expect(function () { dnaTranscriber.toRna('XXX') }).toThrow(
|
29
|
+
new Error('Invalid input')
|
30
|
+
);
|
31
|
+
});
|
32
|
+
|
33
|
+
xit('correctly handles partially invalid input', function () {
|
34
|
+
expect(function () { dnaTranscriber.toRna('ACGTXXXCTTAA') }).toThrow(
|
35
|
+
new Error('Invalid input')
|
36
|
+
);
|
37
|
+
});
|
26
38
|
});
|
data/tracks/rust/config.json
CHANGED
@@ -81,14 +81,14 @@
|
|
81
81
|
},
|
82
82
|
{
|
83
83
|
"slug": "hamming",
|
84
|
-
"difficulty":
|
84
|
+
"difficulty": 4,
|
85
85
|
"topics": [
|
86
86
|
"Result"
|
87
87
|
]
|
88
88
|
},
|
89
89
|
{
|
90
90
|
"slug": "pascals-triangle",
|
91
|
-
"difficulty":
|
91
|
+
"difficulty": 4,
|
92
92
|
"topics": [
|
93
93
|
"Math",
|
94
94
|
"Vec",
|
@@ -97,7 +97,7 @@
|
|
97
97
|
},
|
98
98
|
{
|
99
99
|
"slug": "scrabble-score",
|
100
|
-
"difficulty":
|
100
|
+
"difficulty": 4,
|
101
101
|
"topics": [
|
102
102
|
"chaining higher-order functions",
|
103
103
|
"HashMap (optional)"
|
@@ -105,7 +105,7 @@
|
|
105
105
|
},
|
106
106
|
{
|
107
107
|
"slug": "pangram",
|
108
|
-
"difficulty":
|
108
|
+
"difficulty": 4,
|
109
109
|
"topics": [
|
110
110
|
"filter",
|
111
111
|
"ascii (optional)"
|
@@ -113,7 +113,7 @@
|
|
113
113
|
},
|
114
114
|
{
|
115
115
|
"slug": "nucleotide-count",
|
116
|
-
"difficulty":
|
116
|
+
"difficulty": 4,
|
117
117
|
"topics": [
|
118
118
|
"Result",
|
119
119
|
"filter",
|
@@ -124,7 +124,7 @@
|
|
124
124
|
},
|
125
125
|
{
|
126
126
|
"slug": "luhn",
|
127
|
-
"difficulty":
|
127
|
+
"difficulty": 4,
|
128
128
|
"topics": [
|
129
129
|
"str to digits",
|
130
130
|
"iterators",
|
@@ -133,7 +133,7 @@
|
|
133
133
|
},
|
134
134
|
{
|
135
135
|
"slug": "largest-series-product",
|
136
|
-
"difficulty":
|
136
|
+
"difficulty": 4,
|
137
137
|
"topics": [
|
138
138
|
"Result",
|
139
139
|
"windows",
|
@@ -143,7 +143,7 @@
|
|
143
143
|
},
|
144
144
|
{
|
145
145
|
"slug": "word-count",
|
146
|
-
"difficulty":
|
146
|
+
"difficulty": 4,
|
147
147
|
"topics": [
|
148
148
|
"hashmap",
|
149
149
|
"str vs string",
|
@@ -153,7 +153,7 @@
|
|
153
153
|
},
|
154
154
|
{
|
155
155
|
"slug": "atbash-cipher",
|
156
|
-
"difficulty":
|
156
|
+
"difficulty": 4,
|
157
157
|
"topics": [
|
158
158
|
"str vs string",
|
159
159
|
"primitive types",
|
@@ -164,14 +164,14 @@
|
|
164
164
|
},
|
165
165
|
{
|
166
166
|
"slug": "etl",
|
167
|
-
"difficulty":
|
167
|
+
"difficulty": 4,
|
168
168
|
"topics": [
|
169
169
|
"btree"
|
170
170
|
]
|
171
171
|
},
|
172
172
|
{
|
173
173
|
"slug": "acronym",
|
174
|
-
"difficulty":
|
174
|
+
"difficulty": 4,
|
175
175
|
"topics": [
|
176
176
|
"map",
|
177
177
|
"flat_map",
|
@@ -182,7 +182,7 @@
|
|
182
182
|
},
|
183
183
|
{
|
184
184
|
"slug": "sieve",
|
185
|
-
"difficulty":
|
185
|
+
"difficulty": 4,
|
186
186
|
"topics": [
|
187
187
|
"vector",
|
188
188
|
"map",
|
@@ -191,7 +191,7 @@
|
|
191
191
|
},
|
192
192
|
{
|
193
193
|
"slug": "rna-transcription",
|
194
|
-
"difficulty":
|
194
|
+
"difficulty": 4,
|
195
195
|
"topics": [
|
196
196
|
"match",
|
197
197
|
"struct",
|
@@ -200,7 +200,7 @@
|
|
200
200
|
},
|
201
201
|
{
|
202
202
|
"slug": "triangle",
|
203
|
-
"difficulty":
|
203
|
+
"difficulty": 4,
|
204
204
|
"topics": [
|
205
205
|
"Math",
|
206
206
|
"Struct"
|
@@ -208,7 +208,7 @@
|
|
208
208
|
},
|
209
209
|
{
|
210
210
|
"slug": "roman-numerals",
|
211
|
-
"difficulty":
|
211
|
+
"difficulty": 4,
|
212
212
|
"topics": [
|
213
213
|
"mutable",
|
214
214
|
"results",
|
@@ -219,7 +219,7 @@
|
|
219
219
|
},
|
220
220
|
{
|
221
221
|
"slug": "all-your-base",
|
222
|
-
"difficulty":
|
222
|
+
"difficulty": 4,
|
223
223
|
"topics": [
|
224
224
|
"Result",
|
225
225
|
"enumerate",
|
@@ -229,7 +229,7 @@
|
|
229
229
|
},
|
230
230
|
{
|
231
231
|
"slug": "grade-school",
|
232
|
-
"difficulty":
|
232
|
+
"difficulty": 4,
|
233
233
|
"topics": [
|
234
234
|
"struct",
|
235
235
|
"entry api",
|
@@ -239,7 +239,7 @@
|
|
239
239
|
},
|
240
240
|
{
|
241
241
|
"slug": "robot-simulator",
|
242
|
-
"difficulty":
|
242
|
+
"difficulty": 4,
|
243
243
|
"topics": [
|
244
244
|
"Immutability",
|
245
245
|
"enum"
|
@@ -247,7 +247,7 @@
|
|
247
247
|
},
|
248
248
|
{
|
249
249
|
"slug": "bracket-push",
|
250
|
-
"difficulty":
|
250
|
+
"difficulty": 4,
|
251
251
|
"topics": [
|
252
252
|
"From trait",
|
253
253
|
"stack or recursion"
|
@@ -255,7 +255,7 @@
|
|
255
255
|
},
|
256
256
|
{
|
257
257
|
"slug": "queen-attack",
|
258
|
-
"difficulty":
|
258
|
+
"difficulty": 4,
|
259
259
|
"topics": [
|
260
260
|
"struct",
|
261
261
|
"trait (optional)",
|
@@ -264,7 +264,7 @@
|
|
264
264
|
},
|
265
265
|
{
|
266
266
|
"slug": "bowling",
|
267
|
-
"difficulty":
|
267
|
+
"difficulty": 4,
|
268
268
|
"topics": [
|
269
269
|
"struct",
|
270
270
|
"Result",
|
@@ -273,7 +273,7 @@
|
|
273
273
|
},
|
274
274
|
{
|
275
275
|
"slug": "sublist",
|
276
|
-
"difficulty":
|
276
|
+
"difficulty": 4,
|
277
277
|
"topics": [
|
278
278
|
"enum",
|
279
279
|
"generic over type"
|
@@ -281,7 +281,7 @@
|
|
281
281
|
},
|
282
282
|
{
|
283
283
|
"slug": "space-age",
|
284
|
-
"difficulty":
|
284
|
+
"difficulty": 4,
|
285
285
|
"topics": [
|
286
286
|
"Custom Trait",
|
287
287
|
"From Trait",
|
@@ -290,7 +290,7 @@
|
|
290
290
|
},
|
291
291
|
{
|
292
292
|
"slug": "allergies",
|
293
|
-
"difficulty":
|
293
|
+
"difficulty": 4,
|
294
294
|
"topics": [
|
295
295
|
"struct",
|
296
296
|
"enum",
|
@@ -301,7 +301,7 @@
|
|
301
301
|
},
|
302
302
|
{
|
303
303
|
"slug": "variable-length-quantity",
|
304
|
-
"difficulty":
|
304
|
+
"difficulty": 4,
|
305
305
|
"topics": [
|
306
306
|
"Encodings",
|
307
307
|
"slices",
|
@@ -311,7 +311,7 @@
|
|
311
311
|
},
|
312
312
|
{
|
313
313
|
"slug": "phone-number",
|
314
|
-
"difficulty":
|
314
|
+
"difficulty": 4,
|
315
315
|
"topics": [
|
316
316
|
"option",
|
317
317
|
"format",
|
@@ -322,7 +322,7 @@
|
|
322
322
|
},
|
323
323
|
{
|
324
324
|
"slug": "wordy",
|
325
|
-
"difficulty":
|
325
|
+
"difficulty": 4,
|
326
326
|
"topics": [
|
327
327
|
"Result",
|
328
328
|
"string parsing",
|
@@ -331,7 +331,7 @@
|
|
331
331
|
},
|
332
332
|
{
|
333
333
|
"slug": "tournament",
|
334
|
-
"difficulty":
|
334
|
+
"difficulty": 4,
|
335
335
|
"topics": [
|
336
336
|
"enum",
|
337
337
|
"sorting",
|
@@ -341,7 +341,7 @@
|
|
341
341
|
},
|
342
342
|
{
|
343
343
|
"slug": "custom-set",
|
344
|
-
"difficulty":
|
344
|
+
"difficulty": 4,
|
345
345
|
"topics": [
|
346
346
|
"generic over type",
|
347
347
|
"vector",
|
@@ -351,7 +351,7 @@
|
|
351
351
|
},
|
352
352
|
{
|
353
353
|
"slug": "alphametics",
|
354
|
-
"difficulty":
|
354
|
+
"difficulty": 4,
|
355
355
|
"topics": [
|
356
356
|
"string parsing",
|
357
357
|
"combinations",
|
@@ -361,7 +361,7 @@
|
|
361
361
|
},
|
362
362
|
{
|
363
363
|
"slug": "anagram",
|
364
|
-
"difficulty":
|
364
|
+
"difficulty": 7,
|
365
365
|
"topics": [
|
366
366
|
"lifetimes",
|
367
367
|
"str vs string",
|
@@ -372,7 +372,7 @@
|
|
372
372
|
},
|
373
373
|
{
|
374
374
|
"slug": "nucleotide-codons",
|
375
|
-
"difficulty":
|
375
|
+
"difficulty": 7,
|
376
376
|
"topics": [
|
377
377
|
"struct",
|
378
378
|
"hash map",
|
@@ -382,7 +382,7 @@
|
|
382
382
|
},
|
383
383
|
{
|
384
384
|
"slug": "robot-name",
|
385
|
-
"difficulty":
|
385
|
+
"difficulty": 7,
|
386
386
|
"topics": [
|
387
387
|
"struct",
|
388
388
|
"slices",
|
@@ -393,7 +393,7 @@
|
|
393
393
|
},
|
394
394
|
{
|
395
395
|
"slug": "ocr-numbers",
|
396
|
-
"difficulty":
|
396
|
+
"difficulty": 10,
|
397
397
|
"topics": [
|
398
398
|
"Lines",
|
399
399
|
"Chunks",
|
@@ -402,14 +402,14 @@
|
|
402
402
|
},
|
403
403
|
{
|
404
404
|
"slug": "minesweeper",
|
405
|
-
"difficulty":
|
405
|
+
"difficulty": 10,
|
406
406
|
"topics": [
|
407
407
|
"Board state"
|
408
408
|
]
|
409
409
|
},
|
410
410
|
{
|
411
411
|
"slug": "dominoes",
|
412
|
-
"difficulty":
|
412
|
+
"difficulty": 10,
|
413
413
|
"topics": [
|
414
414
|
"Graph theory",
|
415
415
|
"searching"
|
@@ -417,14 +417,14 @@
|
|
417
417
|
},
|
418
418
|
{
|
419
419
|
"slug": "parallel-letter-frequency",
|
420
|
-
"difficulty":
|
420
|
+
"difficulty": 10,
|
421
421
|
"topics": [
|
422
422
|
"multi-threading"
|
423
423
|
]
|
424
424
|
},
|
425
425
|
{
|
426
426
|
"slug": "rectangles",
|
427
|
-
"difficulty":
|
427
|
+
"difficulty": 10,
|
428
428
|
"topics": [
|
429
429
|
"Enum",
|
430
430
|
"structs",
|
@@ -434,14 +434,14 @@
|
|
434
434
|
},
|
435
435
|
{
|
436
436
|
"slug": "forth",
|
437
|
-
"difficulty":
|
437
|
+
"difficulty": 10,
|
438
438
|
"topics": [
|
439
439
|
"Parser reimplementation"
|
440
440
|
]
|
441
441
|
},
|
442
442
|
{
|
443
443
|
"slug": "circular-buffer",
|
444
|
-
"difficulty":
|
444
|
+
"difficulty": 10,
|
445
445
|
"topics": [
|
446
446
|
"Buffer reimplementation",
|
447
447
|
"Generics"
|
@@ -449,7 +449,7 @@
|
|
449
449
|
},
|
450
450
|
{
|
451
451
|
"slug": "react",
|
452
|
-
"difficulty":
|
452
|
+
"difficulty": 10,
|
453
453
|
"topics": [
|
454
454
|
"Lifetimes",
|
455
455
|
"generics",
|