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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6623d9b34910648ea90043538910b8630b706a7c
4
- data.tar.gz: 43ad46ef86589fe924f1db60f6d6378a64fb32f8
3
+ metadata.gz: 8dc58526fa26ab3ee7b880060f19b9ff38f74b50
4
+ data.tar.gz: 500d43b55f63f5549d3c0f88de2e5e8eef4a4bc3
5
5
  SHA512:
6
- metadata.gz: 29f8ed887aa6e6e1198c4b09b392d3a55a653173c8946d2304b2f04c19a5b014a6987a0c10ed1169bfc7ef85d0e49ed396493dd1149099285022d1ec7df28c26
7
- data.tar.gz: cceb09834ad9067c09257dc26b53a1b00fb164bdaf790876c0dffc4dccea9d0cf56accd62a5ee61f4327eda783b00dba6d6e524217b4fac3a92d3222fb0869b1
6
+ metadata.gz: d94503aabd35ef75be0b356984f834a0e8ee6b537dbe2f2e4002e5f9fa6ea0ea78224ab5edfa1ea30a58e563ad458480b3732172aa9955b99ca81c9c2f2367ed
7
+ data.tar.gz: 19bac46a8dfb31ec316cd4db44641fb476224a018537e7f0de83b83ee423c5826c623fa6d44be744a2dd87a264b6b84f94f21ed8edcda8c019be3e7e6b51fd2d
@@ -1,327 +1,313 @@
1
1
  {
2
- "#": [
2
+ "exercise": "forth",
3
+ "version": "1.0.0",
4
+ "comments": [
3
5
  "The cases are split into multiple sections, all with the same structure.",
4
6
  "In all cases, the `expected` key is the resulting stack",
5
7
  "after executing the Forth program contained in the `input` key."
6
8
  ],
7
- "parsing and numbers": {
8
- "cases": [
9
- {
10
- "description": "empty input results in empty stack",
11
- "input": [],
12
- "expected": []
13
- },
14
- {
15
- "description": "numbers just get pushed onto the stack",
16
- "input": [
17
- "1 2 3 4 5"
18
- ],
19
- "expected": [1, 2, 3, 4, 5]
20
- },
21
- {
22
- "description": "all non-word characters are separators",
23
- "input": [
24
- "1\u00002\u00133\n4\r5 6\t7"
25
- ],
26
- "expected": [1, 2, 3, 4, 5, 6, 7]
27
- }
28
- ]
29
- },
30
- "addition": {
31
- "cases": [
32
- {
33
- "description": "can add two numbers",
34
- "input": [
35
- "1 2 +"
36
- ],
37
- "expected": [3]
38
- },
39
- {
40
- "description": "errors if there is nothing on the stack",
41
- "input": [
42
- "+"
43
- ],
44
- "expected": null
45
- },
46
- {
47
- "description": "errors if there is only one value on the stack",
48
- "input": [
49
- "1 +"
50
- ],
51
- "expected": null
52
- }
53
- ]
54
- },
55
- "subtraction": {
56
- "cases": [
57
- {
58
- "description": "can subtract two numbers",
59
- "input": [
60
- "3 4 -"
61
- ],
62
- "expected": [-1]
63
- },
64
- {
65
- "description": "errors if there is nothing on the stack",
66
- "input": [
67
- "-"
68
- ],
69
- "expected": null
70
- },
71
- {
72
- "description": "errors if there is only one value on the stack",
73
- "input": [
74
- "1 -"
75
- ],
76
- "expected": null
77
- }
78
- ]
79
- },
80
- "multiplication": {
81
- "cases": [
82
- {
83
- "description": "can multiply two numbers",
84
- "input": [
85
- "2 4 *"
86
- ],
87
- "expected": [8]
88
- },
89
- {
90
- "description": "errors if there is nothing on the stack",
91
- "input": [
92
- "*"
93
- ],
94
- "expected": null
95
- },
96
- {
97
- "description": "errors if there is only one value on the stack",
98
- "input": [
99
- "1 *"
100
- ],
101
- "expected": null
102
- }
103
- ]
104
- },
105
- "division": {
106
- "cases": [
107
- {
108
- "description": "can divide two numbers",
109
- "input": [
110
- "12 3 /"
111
- ],
112
- "expected": [4]
113
- },
114
- {
115
- "description": "performs integer division",
116
- "input": [
117
- "8 3 /"
118
- ],
119
- "expected": [2]
120
- },
121
- {
122
- "description": "errors if dividing by zero",
123
- "input": [
124
- "4 0 /"
125
- ],
126
- "expected": null
127
- },
128
- {
129
- "description": "errors if there is nothing on the stack",
130
- "input": [
131
- "/"
132
- ],
133
- "expected": null
134
- },
135
- {
136
- "description": "errors if there is only one value on the stack",
137
- "input": [
138
- "1 /"
139
- ],
140
- "expected": null
141
- }
142
- ]
143
- },
144
- "combined arithmetic": {
145
- "cases": [
146
- {
147
- "description": "addition and subtraction",
148
- "input": [
149
- "1 2 + 4 -"
150
- ],
151
- "expected": [-1]
152
- },
153
- {
154
- "description": "multiplication and division",
155
- "input": [
156
- "2 4 * 3 /"
157
- ],
158
- "expected": [2]
159
- }
160
- ]
161
- },
162
- "dup": {
163
- "cases": [
164
- {
165
- "description": "copies the top value on the stack",
166
- "input": [
167
- "1 DUP"
168
- ],
169
- "expected": [1, 1]
170
- },
171
- {
172
- "description": "is case-insensitive",
173
- "input": [
174
- "1 2 Dup"
175
- ],
176
- "expected": [1, 2, 2]
177
- },
178
- {
179
- "description": "errors if there is nothing on the stack",
180
- "input": [
181
- "dup"
182
- ],
183
- "expected": null
184
- }
185
- ]
186
- },
187
- "drop": {
188
- "cases": [
189
- {
190
- "description": "removes the top value on the stack if it is the only one",
191
- "input": [
192
- "1 drop"
193
- ],
194
- "expected": []
195
- },
196
- {
197
- "description": "removes the top value on the stack if it is not the only one",
198
- "input": [
199
- "1 2 drop"
200
- ],
201
- "expected": [1]
202
- },
203
- {
204
- "description": "errors if there is nothing on the stack",
205
- "input": [
206
- "drop"
207
- ],
208
- "expected": null
209
- }
210
- ]
211
- },
212
- "swap": {
213
- "cases": [
214
- {
215
- "description": "swaps the top two values on the stack if they are the only ones",
216
- "input": [
217
- "1 2 swap"
218
- ],
219
- "expected": [2, 1]
220
- },
221
- {
222
- "description": "swaps the top two values on the stack if they are not the only ones",
223
- "input": [
224
- "1 2 3 swap"
225
- ],
226
- "expected": [1, 3, 2]
227
- },
228
- {
229
- "description": "errors if there is nothing on the stack",
230
- "input": [
231
- "swap"
232
- ],
233
- "expected": null
234
- },
235
- {
236
- "description": "errors if there is only one value on the stack",
237
- "input": [
238
- "1 swap"
239
- ],
240
- "expected": null
241
- }
242
- ]
243
- },
244
- "over": {
245
- "cases": [
246
- {
247
- "description": "copies the second element if there are only two",
248
- "input": [
249
- "1 2 over"
250
- ],
251
- "expected": [1, 2, 1]
252
- },
253
- {
254
- "description": "copies the second element if there are more than two",
255
- "input": [
256
- "1 2 3 over"
257
- ],
258
- "expected": [1, 2, 3, 2]
259
- },
260
- {
261
- "description": "errors if there is nothing on the stack",
262
- "input": [
263
- "over"
264
- ],
265
- "expected": null
266
- },
267
- {
268
- "description": "errors if there is only one value on the stack",
269
- "input": [
270
- "1 over"
271
- ],
272
- "expected": null
273
- }
274
- ]
275
- },
276
- "user-defined words": {
277
- "cases": [
278
- {
279
- "description": "can consist of built-in words",
280
- "input": [
281
- ": dup-twice dup dup ;",
282
- "1 dup-twice"
283
- ],
284
- "expected": [1, 1, 1]
285
- },
286
- {
287
- "description": "execute in the right order",
288
- "input": [
289
- ": countup 1 2 3 ;",
290
- "countup"
291
- ],
292
- "expected": [1, 2, 3]
293
- },
294
- {
295
- "description": "can override other user-defined words",
296
- "input": [
297
- ": foo dup ;",
298
- ": foo dup dup ;",
299
- "1 foo"
300
- ],
301
- "expected": [1, 1, 1]
302
- },
303
- {
304
- "description": "can override built-in words",
305
- "input": [
306
- ": swap dup ;",
307
- "1 swap"
308
- ],
309
- "expected": [1, 1]
310
- },
311
- {
312
- "description": "cannot redefine numbers",
313
- "input": [
314
- ": 1 2 ;"
315
- ],
316
- "expected": null
317
- },
318
- {
319
- "description": "errors if executing a non-existent word",
320
- "input": [
321
- "foo"
322
- ],
323
- "expected": null
324
- }
325
- ]
326
- }
9
+ "cases": [
10
+ {
11
+ "description": "parsing and numbers",
12
+ "cases": [
13
+ {
14
+ "description": "empty input results in empty stack",
15
+ "property": "evaluate",
16
+ "input": [],
17
+ "expected": []
18
+ },
19
+ {
20
+ "description": "numbers just get pushed onto the stack",
21
+ "property": "evaluate",
22
+ "input": ["1 2 3 4 5"],
23
+ "expected": [1, 2, 3, 4, 5]
24
+ },
25
+ {
26
+ "description": "all non-word characters are separators",
27
+ "property": "evaluate",
28
+ "input": ["1\u00002\u00133\n4\r5 6\t7"],
29
+ "expected": [1, 2, 3, 4, 5, 6, 7]
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "description": "addition",
35
+ "cases": [
36
+ {
37
+ "description": "can add two numbers",
38
+ "property": "evaluate",
39
+ "input": ["1 2 +"],
40
+ "expected": [3]
41
+ },
42
+ {
43
+ "description": "errors if there is nothing on the stack",
44
+ "property": "evaluate",
45
+ "input": ["+"],
46
+ "expected": null
47
+ },
48
+ {
49
+ "description": "errors if there is only one value on the stack",
50
+ "property": "evaluate",
51
+ "input": ["1 +"],
52
+ "expected": null
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "description": "subtraction",
58
+ "cases": [
59
+ {
60
+ "description": "can subtract two numbers",
61
+ "property": "evaluate",
62
+ "input": ["3 4 -"],
63
+ "expected": [-1]
64
+ },
65
+ {
66
+ "description": "errors if there is nothing on the stack",
67
+ "property": "evaluate",
68
+ "input": ["-"],
69
+ "expected": null
70
+ },
71
+ {
72
+ "description": "errors if there is only one value on the stack",
73
+ "property": "evaluate",
74
+ "input": ["1 -"],
75
+ "expected": null
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "description": "multiplication",
81
+ "cases": [
82
+ {
83
+ "description": "can multiply two numbers",
84
+ "property": "evaluate",
85
+ "input": ["2 4 *"],
86
+ "expected": [8]
87
+ },
88
+ {
89
+ "description": "errors if there is nothing on the stack",
90
+ "property": "evaluate",
91
+ "input": ["*"],
92
+ "expected": null
93
+ },
94
+ {
95
+ "description": "errors if there is only one value on the stack",
96
+ "property": "evaluate",
97
+ "input": ["1 *"],
98
+ "expected": null
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "description": "division",
104
+ "cases": [
105
+ {
106
+ "description": "can divide two numbers",
107
+ "property": "evaluate",
108
+ "input": ["12 3 /"],
109
+ "expected": [4]
110
+ },
111
+ {
112
+ "description": "performs integer division",
113
+ "property": "evaluate",
114
+ "input": ["8 3 /"],
115
+ "expected": [2]
116
+ },
117
+ {
118
+ "description": "errors if dividing by zero",
119
+ "property": "evaluate",
120
+ "input": ["4 0 /"],
121
+ "expected": null
122
+ },
123
+ {
124
+ "description": "errors if there is nothing on the stack",
125
+ "property": "evaluate",
126
+ "input": ["/"],
127
+ "expected": null
128
+ },
129
+ {
130
+ "description": "errors if there is only one value on the stack",
131
+ "property": "evaluate",
132
+ "input": ["1 /"],
133
+ "expected": null
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "description": "combined arithmetic",
139
+ "cases": [
140
+ {
141
+ "description": "addition and subtraction",
142
+ "property": "evaluate",
143
+ "input": ["1 2 + 4 -"],
144
+ "expected": [-1]
145
+ },
146
+ {
147
+ "description": "multiplication and division",
148
+ "property": "evaluate",
149
+ "input": ["2 4 * 3 /"],
150
+ "expected": [2]
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "description": "dup",
156
+ "cases": [
157
+ {
158
+ "description": "copies the top value on the stack",
159
+ "property": "evaluate",
160
+ "input": ["1 DUP"],
161
+ "expected": [1, 1]
162
+ },
163
+ {
164
+ "description": "is case-insensitive",
165
+ "property": "evaluate",
166
+ "input": ["1 2 Dup"],
167
+ "expected": [1, 2, 2]
168
+ },
169
+ {
170
+ "description": "errors if there is nothing on the stack",
171
+ "property": "evaluate",
172
+ "input": ["dup"],
173
+ "expected": null
174
+ }
175
+ ]
176
+ },
177
+ {
178
+ "description": "drop",
179
+ "cases": [
180
+ {
181
+ "description": "removes the top value on the stack if it is the only one",
182
+ "property": "evaluate",
183
+ "input": ["1 drop"],
184
+ "expected": []
185
+ },
186
+ {
187
+ "description": "removes the top value on the stack if it is not the only one",
188
+ "property": "evaluate",
189
+ "input": ["1 2 drop"],
190
+ "expected": [1]
191
+ },
192
+ {
193
+ "description": "errors if there is nothing on the stack",
194
+ "property": "evaluate",
195
+ "input": ["drop"],
196
+ "expected": null
197
+ }
198
+ ]
199
+ },
200
+ {
201
+ "description": "swap",
202
+ "cases": [
203
+ {
204
+ "description": "swaps the top two values on the stack if they are the only ones",
205
+ "property": "evaluate",
206
+ "input": ["1 2 swap"],
207
+ "expected": [2, 1]
208
+ },
209
+ {
210
+ "description": "swaps the top two values on the stack if they are not the only ones",
211
+ "property": "evaluate",
212
+ "input": ["1 2 3 swap"],
213
+ "expected": [1, 3, 2]
214
+ },
215
+ {
216
+ "description": "errors if there is nothing on the stack",
217
+ "property": "evaluate",
218
+ "input": ["swap"],
219
+ "expected": null
220
+ },
221
+ {
222
+ "description": "errors if there is only one value on the stack",
223
+ "property": "evaluate",
224
+ "input": ["1 swap"],
225
+ "expected": null
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "description": "over",
231
+ "cases": [
232
+ {
233
+ "description": "copies the second element if there are only two",
234
+ "property": "evaluate",
235
+ "input": ["1 2 over"],
236
+ "expected": [1, 2, 1]
237
+ },
238
+ {
239
+ "description": "copies the second element if there are more than two",
240
+ "property": "evaluate",
241
+ "input": ["1 2 3 over"],
242
+ "expected": [1, 2, 3, 2]
243
+ },
244
+ {
245
+ "description": "errors if there is nothing on the stack",
246
+ "property": "evaluate",
247
+ "input": ["over"],
248
+ "expected": null
249
+ },
250
+ {
251
+ "description": "errors if there is only one value on the stack",
252
+ "property": "evaluate",
253
+ "input": ["1 over"],
254
+ "expected": null
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "description": "user-defined words",
260
+ "cases": [
261
+ {
262
+ "description": "can consist of built-in words",
263
+ "property": "evaluate",
264
+ "input": [
265
+ ": dup-twice dup dup ;",
266
+ "1 dup-twice"
267
+ ],
268
+ "expected": [1, 1, 1]
269
+ },
270
+ {
271
+ "description": "execute in the right order",
272
+ "property": "evaluate",
273
+ "input": [
274
+ ": countup 1 2 3 ;",
275
+ "countup"
276
+ ],
277
+ "expected": [1, 2, 3]
278
+ },
279
+ {
280
+ "description": "can override other user-defined words",
281
+ "property": "evaluate",
282
+ "input": [
283
+ ": foo dup ;",
284
+ ": foo dup dup ;",
285
+ "1 foo"
286
+ ],
287
+ "expected": [1, 1, 1]
288
+ },
289
+ {
290
+ "description": "can override built-in words",
291
+ "property": "evaluate",
292
+ "input": [
293
+ ": swap dup ;",
294
+ "1 swap"
295
+ ],
296
+ "expected": [1, 1]
297
+ },
298
+ {
299
+ "description": "cannot redefine numbers",
300
+ "property": "evaluate",
301
+ "input": [": 1 2 ;"],
302
+ "expected": null
303
+ },
304
+ {
305
+ "description": "errors if executing a non-existent word",
306
+ "property": "evaluate",
307
+ "input": ["foo"],
308
+ "expected": null
309
+ }
310
+ ]
311
+ }
312
+ ]
327
313
  }