trackler 2.0.6.10 → 2.0.6.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/circular-buffer/canonical-data.json +343 -0
  3. data/common/exercises/luhn/description.md +4 -1
  4. data/common/exercises/secret-handshake/canonical-data.json +67 -0
  5. data/common/exercises/secret-handshake/description.md +6 -8
  6. data/common/exercises/variable-length-quantity/canonical-data.json +147 -0
  7. data/lib/trackler/version.rb +1 -1
  8. data/tracks/ceylon/.gitignore +1 -0
  9. data/tracks/ceylon/.travis.yml +6 -1
  10. data/tracks/ceylon/README.md +143 -4
  11. data/tracks/ceylon/bin/test-all-exercises +13 -0
  12. data/tracks/ceylon/bin/test-exercise +30 -0
  13. data/tracks/ceylon/config.json +33 -3
  14. data/tracks/ceylon/{SETUP.md → exercises/TRACK_HINTS.md} +0 -0
  15. data/tracks/ceylon/exercises/anagram/example/Anagram.ceylon +8 -0
  16. data/tracks/ceylon/exercises/anagram/source/anagram/Anagram.ceylon +3 -0
  17. data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +47 -0
  18. data/tracks/ceylon/exercises/anagram/source/anagram/module.ceylon +3 -0
  19. data/tracks/ceylon/exercises/bracket-push/example/Brackets.ceylon +18 -0
  20. data/tracks/ceylon/exercises/bracket-push/example/module.ceylon +4 -0
  21. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/Brackets.ceylon +3 -0
  22. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +37 -0
  23. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/module.ceylon +3 -0
  24. data/tracks/ceylon/exercises/leap/example/Leap.ceylon +3 -0
  25. data/tracks/ceylon/exercises/leap/source/leap/Leap.ceylon +3 -0
  26. data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +10 -0
  27. data/tracks/ceylon/exercises/leap/source/leap/module.ceylon +3 -0
  28. data/tracks/ceylon/exercises/sieve/example/Sieve.ceylon +24 -0
  29. data/tracks/ceylon/exercises/sieve/example/module.ceylon +4 -0
  30. data/tracks/ceylon/exercises/sieve/source/sieve/Sieve.ceylon +3 -0
  31. data/tracks/ceylon/exercises/sieve/source/sieve/SieveTest.ceylon +23 -0
  32. data/tracks/ceylon/exercises/sieve/source/sieve/module.ceylon +3 -0
  33. data/tracks/csharp/.travis.yml +4 -0
  34. data/tracks/elm/SETUP.md +5 -4
  35. data/tracks/fsharp/.travis.yml +4 -0
  36. data/tracks/go/config.json +6 -2
  37. data/tracks/go/exercises/luhn/example.go +5 -4
  38. data/tracks/go/exercises/luhn/luhn_test.go +18 -34
  39. data/tracks/java/exercises/word-count/src/test/java/WordCountTest.java +10 -13
  40. data/tracks/lua/docs/ABOUT.md +1 -1
  41. data/tracks/lua/docs/LEARNING.md +1 -0
  42. data/tracks/lua/docs/RESOURCES.md +6 -1
  43. data/tracks/lua/exercises/flatten-array/flatten-array_spec.lua +11 -0
  44. data/tracks/lua/exercises/luhn/example.lua +11 -27
  45. data/tracks/lua/exercises/luhn/luhn_spec.lua +12 -39
  46. data/tracks/ocaml/exercises/all-your-base/all_your_base.mli +0 -2
  47. data/tracks/ocaml/exercises/bracket-push/bracket_push.mli +0 -2
  48. data/tracks/ocaml/exercises/luhn/example.ml +12 -16
  49. data/tracks/ocaml/exercises/luhn/luhn.mli +1 -2
  50. data/tracks/ocaml/exercises/luhn/test.ml +15 -12
  51. data/tracks/php/config.json +8 -0
  52. data/tracks/php/exercises/grains/example.php +63 -0
  53. data/tracks/php/exercises/grains/grains_test.php +82 -0
  54. data/tracks/pony/config.json +26 -14
  55. data/tracks/pony/exercises/anagram/example.pony +17 -73
  56. data/tracks/pony/exercises/anagram/test.pony +6 -13
  57. data/tracks/pony/exercises/bob/example.pony +24 -24
  58. data/tracks/pony/exercises/bob/test.pony +16 -34
  59. data/tracks/pony/exercises/difference-of-squares/example.pony +13 -25
  60. data/tracks/pony/exercises/difference-of-squares/test.pony +9 -16
  61. data/tracks/pony/exercises/hamming/example.pony +8 -23
  62. data/tracks/pony/exercises/hamming/test.pony +16 -30
  63. data/tracks/pony/exercises/hello-world/example.pony +3 -9
  64. data/tracks/pony/exercises/hello-world/test.pony +2 -11
  65. data/tracks/pony/exercises/leap/example.pony +4 -10
  66. data/tracks/pony/exercises/leap/test.pony +2 -11
  67. data/tracks/ruby/lib/generator/command_line.rb +5 -6
  68. data/tracks/ruby/lib/generator/repository.rb +13 -13
  69. data/tracks/ruby/lib/tasks/exercise_test_tasks.rb +2 -4
  70. data/tracks/ruby/lib/tasks/exercise_tests_runner.rb +6 -8
  71. data/tracks/ruby/test/generator/repository_test.rb +26 -34
  72. data/tracks/rust/README.md +1 -1
  73. data/tracks/scheme/config.json +5 -0
  74. data/tracks/scheme/docs/ABOUT.md +7 -0
  75. data/tracks/scheme/exercises/scrabble-score/example.scm +16 -0
  76. data/tracks/scheme/exercises/scrabble-score/scrabble-score-test.scm +57 -0
  77. data/tracks/scheme/exercises/scrabble-score/scrabble-score.scm +2 -0
  78. metadata +33 -5
  79. data/tracks/ceylon/exercises/.keep +0 -0
  80. data/tracks/ceylon/img/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 953233b1b3c26056a61ba8b0155589068f8a106e
4
- data.tar.gz: 8111432be32d72c9ee0b52448735add2f6a11333
3
+ metadata.gz: 80730bca62f82e148c9c102b1e1c19a0ab33cd53
4
+ data.tar.gz: ffa6a9582c1d94ee6e33ed0e2c1bc745b2ebb9cb
5
5
  SHA512:
6
- metadata.gz: 0f3b82d836515898a1a27435d01d86748105835110af07ccd8d05a542a0735e24a7112b005cda5aed1e0dc7aa96cbf7daba2b212f44ac70b9225f021d3e7ba36
7
- data.tar.gz: 49a6dc1f57ba27a0afa3af2260caf0d8cddcf49148566f893b2434c7dd44ba25ccc2efadd51d619193f5ee8d29e7f81443da39f89b34262d74791d4ae8a2488f
6
+ metadata.gz: 954c5a625d030d2892d93506fc9ad67c0117ad8cfedb037194e2cc8dcf9b4c6da18c6f2bd6c368a1ff1dec99afc61b0e20ad9582e9a00983508f231f47abc951
7
+ data.tar.gz: ad66f22ee9eadabfee064cdb40d83743165106f1f1ff080b3c4383eee26215ccec5895c43704940ddf05bd7f3171a0e22f4a5881833d1fe620085bf7af0cca3e
@@ -0,0 +1,343 @@
1
+ {
2
+ "#": [
3
+ "In general, these circular buffers are expected to be stateful,",
4
+ "and each language will operate on them differently.",
5
+ "Tests tend to perform a series of operations, some of which expect a certain result.",
6
+ "As such, this common test suite can only say in abstract terms what should be done.",
7
+ "",
8
+ "Tests will contain a number of operations. The operation will be specified in the `operation` key.",
9
+ "Based on the operation, other keys may be present.",
10
+ "read: Reading from the buffer should succeed if and only if `should_succeed` is true.",
11
+ " If it should succeed, it should produce the item at `expected`. ",
12
+ " If it should fail, `expected` will not be present. ",
13
+ "write: Writing the item located at `item` should succeed if and only if `should_succeed` is true.",
14
+ "overwrite: Write the item located at `item` into the buffer, removing the oldest item if necessary.",
15
+ "clear: Clear the buffer.",
16
+ "",
17
+ "Failure of either `read` or `write` may be indicated in a manner appropriate for your language:",
18
+ "Raising an exception, returning (int, error), returning Option<int>, etc.",
19
+ "",
20
+ "Finally, note that all values are integers.",
21
+ "If your language contains generics, you may consider allowing buffers to contain other types.",
22
+ "Tests for that are not included here.",
23
+ ""
24
+ ],
25
+ "cases": [
26
+ {
27
+ "description": "reading empty buffer should fail",
28
+ "capacity": 1,
29
+ "operations": [
30
+ {
31
+ "operation": "read",
32
+ "should_succeed": false
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "description": "can read an item just written",
38
+ "capacity": 1,
39
+ "operations": [
40
+ {
41
+ "operation": "write",
42
+ "item": 1,
43
+ "should_succeed": true
44
+ },
45
+ {
46
+ "operation": "read",
47
+ "should_succeed": true,
48
+ "expected": 1
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "description": "each item may only be read once",
54
+ "capacity": 1,
55
+ "operations": [
56
+ {
57
+ "operation": "write",
58
+ "item": 1,
59
+ "should_succeed": true
60
+ },
61
+ {
62
+ "operation": "read",
63
+ "should_succeed": true,
64
+ "expected": 1
65
+ },
66
+ {
67
+ "operation": "read",
68
+ "should_succeed": false
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "description": "items are read in the order they are written",
74
+ "capacity": 2,
75
+ "operations": [
76
+ {
77
+ "operation": "write",
78
+ "item": 1,
79
+ "should_succeed": true
80
+ },
81
+ {
82
+ "operation": "write",
83
+ "item": 2,
84
+ "should_succeed": true
85
+ },
86
+ {
87
+ "operation": "read",
88
+ "should_succeed": true,
89
+ "expected": 1
90
+ },
91
+ {
92
+ "operation": "read",
93
+ "should_succeed": true,
94
+ "expected": 2
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "description": "full buffer can't be written to",
100
+ "capacity": 1,
101
+ "operations": [
102
+ {
103
+ "operation": "write",
104
+ "item": 1,
105
+ "should_succeed": true
106
+ },
107
+ {
108
+ "operation": "write",
109
+ "item": 2,
110
+ "should_succeed": false
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "description": "a read frees up capacity for another write",
116
+ "capacity": 1,
117
+ "operations": [
118
+ {
119
+ "operation": "write",
120
+ "item": 1,
121
+ "should_succeed": true
122
+ },
123
+ {
124
+ "operation": "read",
125
+ "should_succeed": true,
126
+ "expected": 1
127
+ },
128
+ {
129
+ "operation": "write",
130
+ "item": 2,
131
+ "should_succeed": true
132
+ },
133
+ {
134
+ "operation": "read",
135
+ "should_succeed": true,
136
+ "expected": 2
137
+ }
138
+ ]
139
+ },
140
+ {
141
+ "description": "read position is maintained even across multiple writes",
142
+ "capacity": 3,
143
+ "operations": [
144
+ {
145
+ "operation": "write",
146
+ "item": 1,
147
+ "should_succeed": true
148
+ },
149
+ {
150
+ "operation": "write",
151
+ "item": 2,
152
+ "should_succeed": true
153
+ },
154
+ {
155
+ "operation": "read",
156
+ "should_succeed": true,
157
+ "expected": 1
158
+ },
159
+ {
160
+ "operation": "write",
161
+ "item": 3,
162
+ "should_succeed": true
163
+ },
164
+ {
165
+ "operation": "read",
166
+ "should_succeed": true,
167
+ "expected": 2
168
+ },
169
+ {
170
+ "operation": "read",
171
+ "should_succeed": true,
172
+ "expected": 3
173
+ }
174
+ ]
175
+ },
176
+ {
177
+ "description": "items cleared out of buffer can't be read",
178
+ "capacity": 1,
179
+ "operations": [
180
+ {
181
+ "operation": "write",
182
+ "item": 1,
183
+ "should_succeed": true
184
+ },
185
+ {
186
+ "operation": "clear"
187
+ },
188
+ {
189
+ "operation": "read",
190
+ "should_succeed": false
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ "description": "clear frees up capacity for another write",
196
+ "capacity": 1,
197
+ "operations": [
198
+ {
199
+ "operation": "write",
200
+ "item": 1,
201
+ "should_succeed": true
202
+ },
203
+ {
204
+ "operation": "clear"
205
+ },
206
+ {
207
+ "operation": "write",
208
+ "item": 2,
209
+ "should_succeed": true
210
+ },
211
+ {
212
+ "operation": "read",
213
+ "should_succeed": true,
214
+ "expected": 2
215
+ }
216
+ ]
217
+ },
218
+ {
219
+ "description": "clear does nothing on empty buffer",
220
+ "capacity": 1,
221
+ "operations": [
222
+ {
223
+ "operation": "clear"
224
+ },
225
+ {
226
+ "operation": "write",
227
+ "item": 1,
228
+ "should_succeed": true
229
+ },
230
+ {
231
+ "operation": "read",
232
+ "should_succeed": true,
233
+ "expected": 1
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ "description": "overwrite acts like write on non-full buffer",
239
+ "capacity": 2,
240
+ "operations": [
241
+ {
242
+ "operation": "write",
243
+ "item": 1,
244
+ "should_succeed": true
245
+ },
246
+ {
247
+ "operation": "overwrite",
248
+ "item": 2
249
+ },
250
+ {
251
+ "operation": "read",
252
+ "should_succeed": true,
253
+ "expected": 1
254
+ },
255
+ {
256
+ "operation": "read",
257
+ "should_succeed": true,
258
+ "expected": 2
259
+ }
260
+ ]
261
+ },
262
+ {
263
+ "description": "overwrite removes the oldest item on full buffer",
264
+ "capacity": 2,
265
+ "operations": [
266
+ {
267
+ "operation": "write",
268
+ "item": 1,
269
+ "should_succeed": true
270
+ },
271
+ {
272
+ "operation": "write",
273
+ "item": 2,
274
+ "should_succeed": true
275
+ },
276
+ {
277
+ "operation": "overwrite",
278
+ "item": 3
279
+ },
280
+ {
281
+ "operation": "read",
282
+ "should_succeed": true,
283
+ "expected": 2
284
+ },
285
+ {
286
+ "operation": "read",
287
+ "should_succeed": true,
288
+ "expected": 3
289
+ }
290
+ ]
291
+ },
292
+ {
293
+ "description": "overwrite doesn't remove an already-read item",
294
+ "capacity": 3,
295
+ "operations": [
296
+ {
297
+ "operation": "write",
298
+ "item": 1,
299
+ "should_succeed": true
300
+ },
301
+ {
302
+ "operation": "write",
303
+ "item": 2,
304
+ "should_succeed": true
305
+ },
306
+ {
307
+ "operation": "write",
308
+ "item": 3,
309
+ "should_succeed": true
310
+ },
311
+ {
312
+ "operation": "read",
313
+ "should_succeed": true,
314
+ "expected": 1
315
+ },
316
+ {
317
+ "operation": "write",
318
+ "item": 4,
319
+ "should_succeed": true
320
+ },
321
+ {
322
+ "operation": "overwrite",
323
+ "item": 5
324
+ },
325
+ {
326
+ "operation": "read",
327
+ "should_succeed": true,
328
+ "expected": 3
329
+ },
330
+ {
331
+ "operation": "read",
332
+ "should_succeed": true,
333
+ "expected": 4
334
+ },
335
+ {
336
+ "operation": "read",
337
+ "should_succeed": true,
338
+ "expected": 5
339
+ }
340
+ ]
341
+ }
342
+ ]
343
+ }
@@ -7,8 +7,11 @@ The task is to write a function that checks if a given string is valid.
7
7
 
8
8
  Validating a Number
9
9
  ------
10
+ Strings of length 1 or less are not valid. Spaces are allowed in the input,
11
+ but they should be stripped before checking. All other non-digit characters
12
+ are disallowed.
10
13
 
11
- As an example, here is a valid (but fictitious) Canadian Social Insurance
14
+ As an example of a valid string, here is a fictitious Canadian Social Insurance
12
15
  Number.
13
16
 
14
17
  ```
@@ -0,0 +1,67 @@
1
+ {
2
+ "commands": {
3
+ "description": ["Create a handshake for a number"],
4
+ "cases": [
5
+ {
6
+ "description": "wink for 1",
7
+ "input": 1,
8
+ "expected": ["wink"]
9
+ },
10
+ {
11
+ "description": "double blink for 10",
12
+ "input": 2,
13
+ "expected": ["double blink"]
14
+ },
15
+ {
16
+ "description": "close your eyes for 100",
17
+ "input": 4,
18
+ "expected": ["close your eyes"]
19
+ },
20
+ {
21
+ "description": "jump for 1000",
22
+ "input": 8,
23
+ "expected": ["jump"]
24
+ },
25
+ {
26
+ "description": "combine two actions",
27
+ "input": 3,
28
+ "expected": ["wink", "double blink"]
29
+ },
30
+ {
31
+ "description": "reverse two actions",
32
+ "input": 19,
33
+ "expected": ["double blink", "wink"]
34
+ },
35
+ {
36
+ "description": "reversing one action gives the same action",
37
+ "input": 24,
38
+ "expected": ["jump"]
39
+ },
40
+ {
41
+ "description": "reversing no actions still gives no actions",
42
+ "input": 16,
43
+ "expected": []
44
+ },
45
+ {
46
+ "description": "all possible actions",
47
+ "input": 15,
48
+ "expected": ["wink", "double blink", "close your eyes", "jump"]
49
+ },
50
+ {
51
+ "description": "reverse all possible actions",
52
+ "input": 31,
53
+ "expected": ["jump", "close your eyes", "double blink", "wink"]
54
+ },
55
+ {
56
+ "description": "do nothing for zero",
57
+ "input": 0,
58
+ "expected": []
59
+ },
60
+ {
61
+ "description": "do nothing if lower 5 bits not set",
62
+ "input": 32,
63
+ "expected": []
64
+ }
65
+ ]
66
+ }
67
+ }
@@ -16,12 +16,10 @@ binary decide to come up with a secret "handshake".
16
16
 
17
17
  Here's a couple of examples:
18
18
 
19
- Given the input 9, the function would return the array
20
- ["wink", "jump"]
19
+ Given the input 3, the function would return the array
20
+ ["wink", "double blink"] because 3 is 11 in binary.
21
21
 
22
- Given the input "11001", the function would return the array
23
- ["jump", "wink"]
24
-
25
-
26
- The program should consider strings specifying an invalid binary as the
27
- value 0.
22
+ Given the input 19, the function would return the array
23
+ ["double blink", "wink"] because 19 is 10011 in binary.
24
+ Notice that the addition of 16 (10000 in binary)
25
+ has caused the array to be reversed.