trackler 2.0.8.17 → 2.0.8.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/forth/canonical-data.json +307 -321
  3. data/common/exercises/largest-series-product/canonical-data.json +139 -122
  4. data/common/exercises/list-ops/canonical-data.json +162 -141
  5. data/common/exercises/markdown/canonical-data.json +15 -14
  6. data/common/exercises/pov/canonical-data.json +264 -116
  7. data/common/exercises/prime-factors/canonical-data.json +51 -40
  8. data/common/exercises/rail-fence-cipher/canonical-data.json +56 -44
  9. data/common/exercises/react/canonical-data.json +18 -4
  10. data/common/exercises/rectangles/canonical-data.json +16 -1
  11. data/common/exercises/rotational-cipher/canonical-data.json +81 -67
  12. data/common/exercises/run-length-encoding/canonical-data.json +89 -71
  13. data/common/exercises/space-age/canonical-data.json +61 -45
  14. data/common/exercises/sublist/canonical-data.json +136 -99
  15. data/common/exercises/transpose/canonical-data.json +207 -194
  16. data/common/exercises/variable-length-quantity/canonical-data.json +171 -141
  17. data/lib/trackler/version.rb +1 -1
  18. data/tracks/csharp/exercises/diamond/HINTS.md +9 -0
  19. data/tracks/go/README.md +3 -0
  20. data/tracks/go/exercises/queen-attack/queen_attack_test.go +1 -1
  21. data/tracks/haskell/exercises/hamming/src/Hamming.hs +2 -1
  22. data/tracks/java/exercises/flatten-array/src/test/java/FlattenerTest.java +5 -0
  23. data/tracks/ocaml/exercises/anagram/test.ml +2 -2
  24. data/tracks/ocaml/tools/test-generator/src/controller.ml +7 -2
  25. data/tracks/ocaml/tools/test-generator/src/parser.ml +31 -18
  26. data/tracks/ocaml/tools/test-generator/src/template.ml +10 -8
  27. data/tracks/ocaml/tools/test-generator/src/utils.ml +11 -0
  28. data/tracks/ocaml/tools/test-generator/templates/phone-number/template.ml +4 -5
  29. data/tracks/ocaml/tools/test-generator/test/beer-song.json +77 -0
  30. data/tracks/ocaml/tools/test-generator/test/difference_of_squares.json +76 -62
  31. data/tracks/ocaml/tools/test-generator/test/parser_test.ml +11 -9
  32. data/tracks/ocaml/tools/test-generator/test/template_test.ml +2 -2
  33. metadata +4 -2
@@ -1,60 +1,61 @@
1
1
  {
2
- "#": [
2
+ "exercise": "markdown",
3
+ "version": "1.0.0",
4
+ "comments": [
3
5
  "Markdown is a shorthand for creating HTML from text strings."
4
6
  ],
5
- "methods": {
6
- "description": [
7
- "Check the public API is correct."
8
- ],
9
- "cases": [{
10
- "description": "must be able to parse a Markdown string",
11
- "method": "parse",
12
- "arity": 1
13
- }]
14
- },
15
7
  "cases": [
16
8
  {
17
- "description": "parses normal text as a paragraph",
18
- "input": "This will be a paragraph",
19
- "expected": "<p>This will be a paragraph</p>"
9
+ "description": "parses normal text as a paragraph",
10
+ "property": "parse",
11
+ "input": "This will be a paragraph",
12
+ "expected": "<p>This will be a paragraph</p>"
20
13
  },
21
14
  {
22
15
  "description": "parsing italics",
16
+ "property": "parse",
23
17
  "input": "_This will be italic_",
24
18
  "expected": "<p><em>This will be italic</em></p>"
25
19
  },
26
20
  {
27
21
  "description": "parsing bold text",
22
+ "property": "parse",
28
23
  "input": "__This will be bold__",
29
24
  "expected": "<p><strong>This will be bold</strong></p>"
30
25
  },
31
26
  {
32
27
  "description": "mixed normal, italics and bold text",
28
+ "property": "parse",
33
29
  "input": "This will _be_ __mixed__",
34
30
  "expected": "<p>This will <em>be</em> <strong>mixed</strong></p>"
35
31
  },
36
32
  {
37
33
  "description": "with h1 header level",
34
+ "property": "parse",
38
35
  "input": "# This will be an h1",
39
36
  "expected": "<h1>This will be an h1</h1>"
40
37
  },
41
38
  {
42
39
  "description": "with h2 header level",
40
+ "property": "parse",
43
41
  "input": "## This will be an h2",
44
42
  "expected": "<h2>This will be an h2</h2>"
45
43
  },
46
44
  {
47
45
  "description": "with h6 header level",
46
+ "property": "parse",
48
47
  "input": "###### This will be an h6",
49
48
  "expected": "<h6>This will be an h6</h6>"
50
49
  },
51
50
  {
52
51
  "description": "unordered lists",
52
+ "property": "parse",
53
53
  "input": "* Item 1\n* Item 2",
54
54
  "expected": "<ul><li><p>Item 1</p></li><li><p>Item 2</p></li></ul>"
55
55
  },
56
56
  {
57
57
  "description": "With a little bit of everything",
58
+ "property": "parse",
58
59
  "input": "# Header!\n* __Bold Item__\n* _Italic Item_",
59
60
  "expected": "<h1>Header!</h1><ul><li><strong>Bold Item</strong></li><li><em>Italic Item</em></li></ul>"
60
61
  }
@@ -1,7 +1,9 @@
1
1
  {
2
- "from_pov": {
3
- "description": [
4
- "Reroot a tree so that its root is the specified node.",
2
+ "exercise": "pov",
3
+ "version": "1.1.0",
4
+ "cases": [{
5
+ "description": "Reroot a tree so that its root is the specified node.",
6
+ "comments": [
5
7
  "In this way, the tree is presented from the point of view of the specified node.",
6
8
  "The input trees used here are those in the `trees` section of this file.",
7
9
  "",
@@ -17,7 +19,10 @@
17
19
  "cases": [
18
20
  {
19
21
  "description": "Results in the same tree if the input tree is a singleton",
20
- "tree": "singleton",
22
+ "property": "fromPov",
23
+ "tree": {
24
+ "label": "x"
25
+ },
21
26
  "from": "x",
22
27
  "expected": {
23
28
  "label": "x"
@@ -25,7 +30,18 @@
25
30
  },
26
31
  {
27
32
  "description": "Can reroot a tree with a parent and one sibling",
28
- "tree": "simple",
33
+ "property": "fromPov",
34
+ "tree": {
35
+ "label": "parent",
36
+ "children": [
37
+ {
38
+ "label": "x"
39
+ },
40
+ {
41
+ "label": "sibling"
42
+ }
43
+ ]
44
+ },
29
45
  "from": "x",
30
46
  "expected": {
31
47
  "label": "x",
@@ -43,7 +59,24 @@
43
59
  },
44
60
  {
45
61
  "description": "Can reroot a tree with a parent and many siblings",
46
- "tree": "large_flat",
62
+ "property": "fromPov",
63
+ "tree": {
64
+ "label": "parent",
65
+ "children": [
66
+ {
67
+ "label": "a"
68
+ },
69
+ {
70
+ "label": "x"
71
+ },
72
+ {
73
+ "label": "b"
74
+ },
75
+ {
76
+ "label": "c"
77
+ }
78
+ ]
79
+ },
47
80
  "from": "x",
48
81
  "expected": {
49
82
  "label": "x",
@@ -67,7 +100,30 @@
67
100
  },
68
101
  {
69
102
  "description": "Can reroot a tree with new root deeply nested in tree",
70
- "tree": "deeply_nested",
103
+ "property": "fromPov",
104
+ "tree": {
105
+ "label": "level-0",
106
+ "children": [
107
+ {
108
+ "label": "level-1",
109
+ "children": [
110
+ {
111
+ "label": "level-2",
112
+ "children": [
113
+ {
114
+ "label": "level-3",
115
+ "children": [
116
+ {
117
+ "label": "x"
118
+ }
119
+ ]
120
+ }
121
+ ]
122
+ }
123
+ ]
124
+ }
125
+ ]
126
+ },
71
127
  "from": "x",
72
128
  "expected": {
73
129
  "label": "x",
@@ -95,7 +151,23 @@
95
151
  },
96
152
  {
97
153
  "description": "Moves children of the new root to same level as former parent",
98
- "tree": "kids",
154
+ "property": "fromPov",
155
+ "tree": {
156
+ "label": "parent",
157
+ "children": [
158
+ {
159
+ "label": "x",
160
+ "children": [
161
+ {
162
+ "label": "kid-0"
163
+ },
164
+ {
165
+ "label": "kid-1"
166
+ }
167
+ ]
168
+ }
169
+ ]
170
+ },
99
171
  "from": "x",
100
172
  "expected": {
101
173
  "label": "x",
@@ -114,7 +186,45 @@
114
186
  },
115
187
  {
116
188
  "description": "Can reroot a complex tree with cousins",
117
- "tree": "cousins",
189
+ "property": "fromPov",
190
+ "tree": {
191
+ "label": "grandparent",
192
+ "children": [
193
+ {
194
+ "label": "parent",
195
+ "children": [
196
+ {
197
+ "label": "x",
198
+ "children": [
199
+ {
200
+ "label": "kid-0"
201
+ },
202
+ {
203
+ "label": "kid-1"
204
+ }
205
+ ]
206
+ },
207
+ {
208
+ "label": "sibling-0"
209
+ },
210
+ {
211
+ "label": "sibling-1"
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "label": "uncle",
217
+ "children": [
218
+ {
219
+ "label": "cousin-0"
220
+ },
221
+ {
222
+ "label": "cousin-1"
223
+ }
224
+ ]
225
+ }
226
+ ]
227
+ },
118
228
  "from": "x",
119
229
  "expected": {
120
230
  "label": "x",
@@ -157,21 +267,45 @@
157
267
  },
158
268
  {
159
269
  "description": "Errors if target does not exist in a singleton tree",
160
- "tree": "singleton",
270
+ "property": "fromPov",
271
+ "tree": {
272
+ "label": "x"
273
+ },
161
274
  "from": "nonexistent",
162
275
  "expected": null
163
276
  },
164
277
  {
165
278
  "description": "Errors if target does not exist in a large tree",
166
- "tree": "cousins",
279
+ "property": "fromPov",
280
+ "tree": {
281
+ "label": "parent",
282
+ "children": [
283
+ {
284
+ "label": "x",
285
+ "children": [
286
+ {
287
+ "label": "kid-0"
288
+ },
289
+ {
290
+ "label": "kid-1"
291
+ }
292
+ ]
293
+ },
294
+ {
295
+ "label": "sibling-0"
296
+ },
297
+ {
298
+ "label": "sibling-1"
299
+ }
300
+ ]
301
+ },
167
302
  "from": "nonexistent",
168
303
  "expected": null
169
304
  }
170
305
  ]
171
- },
172
- "path_to": {
173
- "description": [
174
- "Given two nodes, find the path between them.",
306
+ }, {
307
+ "description": "Given two nodes, find the path between them",
308
+ "comments": [
175
309
  "A typical implementation would first reroot the tree on one of the two nodes.",
176
310
  "",
177
311
  "If appropriate for your track, you may test that the input tree is not modified.",
@@ -181,9 +315,20 @@
181
315
  "cases": [
182
316
  {
183
317
  "description": "Can find path to parent",
318
+ "property": "pathTo",
184
319
  "from": "x",
185
320
  "to": "parent",
186
- "tree": "simple",
321
+ "tree": {
322
+ "label": "parent",
323
+ "children": [
324
+ {
325
+ "label": "x"
326
+ },
327
+ {
328
+ "label": "sibling"
329
+ }
330
+ ]
331
+ },
187
332
  "expected": [
188
333
  "x",
189
334
  "parent"
@@ -191,9 +336,26 @@
191
336
  },
192
337
  {
193
338
  "description": "Can find path to sibling",
339
+ "property": "pathTo",
194
340
  "from": "x",
195
341
  "to": "b",
196
- "tree": "large_flat",
342
+ "tree": {
343
+ "label": "parent",
344
+ "children": [
345
+ {
346
+ "label": "a"
347
+ },
348
+ {
349
+ "label": "x"
350
+ },
351
+ {
352
+ "label": "b"
353
+ },
354
+ {
355
+ "label": "c"
356
+ }
357
+ ]
358
+ },
197
359
  "expected": [
198
360
  "x",
199
361
  "parent",
@@ -202,9 +364,47 @@
202
364
  },
203
365
  {
204
366
  "description": "Can find path to cousin",
367
+ "property": "pathTo",
205
368
  "from": "x",
206
369
  "to": "cousin-1",
207
- "tree": "cousins",
370
+ "tree": {
371
+ "label": "grandparent",
372
+ "children": [
373
+ {
374
+ "label": "parent",
375
+ "children": [
376
+ {
377
+ "label": "x",
378
+ "children": [
379
+ {
380
+ "label": "kid-0"
381
+ },
382
+ {
383
+ "label": "kid-1"
384
+ }
385
+ ]
386
+ },
387
+ {
388
+ "label": "sibling-0"
389
+ },
390
+ {
391
+ "label": "sibling-1"
392
+ }
393
+ ]
394
+ },
395
+ {
396
+ "label": "uncle",
397
+ "children": [
398
+ {
399
+ "label": "cousin-0"
400
+ },
401
+ {
402
+ "label": "cousin-1"
403
+ }
404
+ ]
405
+ }
406
+ ]
407
+ },
208
408
  "expected": [
209
409
  "x",
210
410
  "parent",
@@ -215,109 +415,67 @@
215
415
  },
216
416
  {
217
417
  "description": "Can find path from nodes other than x",
218
- "from": "kid-1",
219
- "to": "cousin-0",
220
- "tree": "cousins",
418
+ "property": "pathTo",
419
+ "from": "a",
420
+ "to": "c",
421
+ "tree": {
422
+ "label": "parent",
423
+ "children": [
424
+ {
425
+ "label": "a"
426
+ },
427
+ {
428
+ "label": "x"
429
+ },
430
+ {
431
+ "label": "b"
432
+ },
433
+ {
434
+ "label": "c"
435
+ }
436
+ ]
437
+ },
221
438
  "expected": [
222
- "kid-1",
223
- "x",
439
+ "a",
224
440
  "parent",
225
- "grandparent",
226
- "uncle",
227
- "cousin-0"
441
+ "c"
228
442
  ]
229
443
  },
230
444
  {
231
445
  "description": "Errors if destination does not exist",
446
+ "property": "pathTo",
232
447
  "from": "x",
233
448
  "to": "nonexistent",
234
- "tree": "cousins",
235
- "expected": null
236
- },
237
- {
238
- "description": "Errors if source does not exist",
239
- "from": "nonexistent",
240
- "to": "x",
241
- "tree": "cousins",
242
- "expected": null
243
- }
244
- ]
245
- },
246
- "trees": {
247
- "singleton": {
248
- "label": "x"
249
- },
250
- "simple": {
251
- "label": "parent",
252
- "children": [
253
- {
254
- "label": "x"
255
- },
256
- {
257
- "label": "sibling"
258
- }
259
- ]
260
- },
261
- "large_flat": {
262
- "label": "parent",
263
- "children": [
264
- {
265
- "label": "a"
266
- },
267
- {
268
- "label": "x"
269
- },
270
- {
271
- "label": "b"
272
- },
273
- {
274
- "label": "c"
275
- }
276
- ]
277
- },
278
- "deeply_nested": {
279
- "label": "level-0",
280
- "children": [
281
- {
282
- "label": "level-1",
449
+ "tree": {
450
+ "label": "parent",
283
451
  "children": [
284
452
  {
285
- "label": "level-2",
453
+ "label": "x",
286
454
  "children": [
287
455
  {
288
- "label": "level-3",
289
- "children": [
290
- {
291
- "label": "x"
292
- }
293
- ]
456
+ "label": "kid-0"
457
+ },
458
+ {
459
+ "label": "kid-1"
294
460
  }
295
461
  ]
296
- }
297
- ]
298
- }
299
- ]
300
- },
301
- "kids": {
302
- "label": "parent",
303
- "children": [
304
- {
305
- "label": "x",
306
- "children": [
462
+ },
307
463
  {
308
- "label": "kid-0"
464
+ "label": "sibling-0"
309
465
  },
310
466
  {
311
- "label": "kid-1"
467
+ "label": "sibling-1"
312
468
  }
313
469
  ]
314
- }
315
- ]
316
- },
317
- "cousins": {
318
- "label": "grandparent",
319
- "children": [
320
- {
470
+ },
471
+ "expected": null
472
+ },
473
+ {
474
+ "description": "Errors if source does not exist",
475
+ "property": "pathTo",
476
+ "from": "nonexistent",
477
+ "to": "x",
478
+ "tree": {
321
479
  "label": "parent",
322
480
  "children": [
323
481
  {
@@ -339,18 +497,8 @@
339
497
  }
340
498
  ]
341
499
  },
342
- {
343
- "label": "uncle",
344
- "children": [
345
- {
346
- "label": "cousin-0"
347
- },
348
- {
349
- "label": "cousin-1"
350
- }
351
- ]
352
- }
353
- ]
354
- }
355
- }
500
+ "expected": null
501
+ }
502
+ ]
503
+ }]
356
504
  }
@@ -1,42 +1,53 @@
1
1
  {
2
- "for": {
3
- "description": "returns prime factors for the given input number",
4
- "cases": [
5
- {
6
- "description" : "no factors",
7
- "input" : 1,
8
- "expected" : []
9
- },
10
- {
11
- "description" : "prime number",
12
- "input" : 2,
13
- "expected" : [2]
14
- },
15
- {
16
- "description" : "square of a prime",
17
- "input" : 9,
18
- "expected" : [3, 3]
19
- },
20
- {
21
- "description" : "cube of a prime",
22
- "input" : 8,
23
- "expected" : [2, 2, 2]
24
- },
25
- {
26
- "description" : "product of primes and non-primes",
27
- "input" : 12,
28
- "expected" : [2, 2, 3]
29
- },
30
- {
31
- "description" : "product of primes",
32
- "input" : 901255,
33
- "expected" : [5, 17, 23, 461]
34
- },
35
- {
36
- "description" : "factors include a large prime",
37
- "input" : 93819012551,
38
- "expected" : [11, 9539, 894119]
39
- }
40
- ]
41
- }
2
+ "exercise": "prime-factors",
3
+ "version": "1.0.0",
4
+ "cases": [
5
+ {
6
+ "description": "returns prime factors for the given input number",
7
+ "cases": [
8
+ {
9
+ "description": "no factors",
10
+ "property": "factors",
11
+ "input": 1,
12
+ "expected": []
13
+ },
14
+ {
15
+ "description": "prime number",
16
+ "property": "factors",
17
+ "input": 2,
18
+ "expected": [2]
19
+ },
20
+ {
21
+ "description": "square of a prime",
22
+ "property": "factors",
23
+ "input": 9,
24
+ "expected": [3, 3]
25
+ },
26
+ {
27
+ "description": "cube of a prime",
28
+ "property": "factors",
29
+ "input": 8,
30
+ "expected": [2, 2, 2]
31
+ },
32
+ {
33
+ "description": "product of primes and non-primes",
34
+ "property": "factors",
35
+ "input": 12,
36
+ "expected": [2, 2, 3]
37
+ },
38
+ {
39
+ "description": "product of primes",
40
+ "property": "factors",
41
+ "input": 901255,
42
+ "expected": [5, 17, 23, 461]
43
+ },
44
+ {
45
+ "description": "factors include a large prime",
46
+ "property": "factors",
47
+ "input": 93819012551,
48
+ "expected": [11, 9539, 894119]
49
+ }
50
+ ]
51
+ }
52
+ ]
42
53
  }