trackler 2.1.0.30 → 2.1.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +0 -164
  3. data/common/exercises/collatz-conjecture/canonical-data.json +7 -1
  4. data/common/exercises/dominoes/canonical-data.json +13 -13
  5. data/common/exercises/proverb/description.md +8 -8
  6. data/common/exercises/scale-generator/description.md +5 -14
  7. data/lib/trackler/version.rb +1 -1
  8. data/tracks/java/config.json +10 -10
  9. data/tracks/java/exercises/ocr-numbers/src/example/java/OpticalCharacterReader.java +3 -3
  10. data/tracks/ocaml/exercises/dominoes/test.ml +1 -1
  11. data/tracks/ocaml/exercises/forth/test.ml +1 -1
  12. data/tracks/ocaml/exercises/list-ops/test.ml +34 -42
  13. data/tracks/ocaml/tools/test-generator/src/controller.ml +3 -4
  14. data/tracks/ocaml/tools/test-generator/src/languages.ml +9 -7
  15. data/tracks/ocaml/tools/test-generator/src/ocaml_special_cases.ml +0 -6
  16. data/tracks/ocaml/tools/test-generator/templates/ocaml/acronym/{template.ml → test.ml} +0 -0
  17. data/tracks/ocaml/tools/test-generator/templates/ocaml/all-your-base/{template.ml → test.ml} +0 -0
  18. data/tracks/ocaml/tools/test-generator/templates/ocaml/anagram/{template.ml → test.ml} +0 -0
  19. data/tracks/ocaml/tools/test-generator/templates/ocaml/atbash-cipher/{template.ml → test.ml} +0 -0
  20. data/tracks/ocaml/tools/test-generator/templates/ocaml/beer-song/{template.ml → test.ml} +0 -0
  21. data/tracks/ocaml/tools/test-generator/templates/ocaml/binary-search/{template.ml → test.ml} +0 -0
  22. data/tracks/ocaml/tools/test-generator/templates/ocaml/bob/{template.ml → test.ml} +0 -0
  23. data/tracks/ocaml/tools/test-generator/templates/ocaml/bowling/{template.ml → test.ml} +0 -0
  24. data/tracks/ocaml/tools/test-generator/templates/ocaml/bracket-push/{template.ml → test.ml} +0 -0
  25. data/tracks/ocaml/tools/test-generator/templates/ocaml/change/{template.ml → test.ml} +0 -0
  26. data/tracks/ocaml/tools/test-generator/templates/ocaml/connect/{template.ml → test.ml} +0 -0
  27. data/tracks/ocaml/tools/test-generator/templates/ocaml/difference-of-squares/{template.ml → test.ml} +0 -0
  28. data/tracks/ocaml/tools/test-generator/templates/ocaml/dominoes/{template.ml → test.ml} +0 -0
  29. data/tracks/ocaml/tools/test-generator/templates/ocaml/etl/{template.ml → test.ml} +0 -0
  30. data/tracks/ocaml/tools/test-generator/templates/ocaml/forth/{template.ml → test.ml} +0 -0
  31. data/tracks/ocaml/tools/test-generator/templates/ocaml/hamming/{template.ml → test.ml} +0 -0
  32. data/tracks/ocaml/tools/test-generator/templates/ocaml/hello-world/{template.ml → test.ml} +0 -0
  33. data/tracks/ocaml/tools/test-generator/templates/ocaml/leap/{template.ml → test.ml} +0 -0
  34. data/tracks/ocaml/tools/test-generator/templates/ocaml/luhn/{template.ml → test.ml} +0 -0
  35. data/tracks/ocaml/tools/test-generator/templates/ocaml/minesweeper/{template.ml → test.ml} +0 -0
  36. data/tracks/ocaml/tools/test-generator/templates/ocaml/pangram/{template.ml → test.ml} +0 -0
  37. data/tracks/ocaml/tools/test-generator/templates/ocaml/phone-number/{template.ml → test.ml} +0 -0
  38. data/tracks/ocaml/tools/test-generator/templates/ocaml/prime-factors/{template.ml → test.ml} +0 -0
  39. data/tracks/ocaml/tools/test-generator/templates/ocaml/raindrops/{template.ml → test.ml} +0 -0
  40. data/tracks/ocaml/tools/test-generator/templates/ocaml/roman-numerals/{template.ml → test.ml} +0 -0
  41. data/tracks/ocaml/tools/test-generator/templates/ocaml/run-length-encoding/{template.ml → test.ml} +0 -0
  42. data/tracks/ocaml/tools/test-generator/templates/ocaml/say/{template.ml → test.ml} +0 -0
  43. data/tracks/ocaml/tools/test-generator/templates/ocaml/space-age/{template.ml → test.ml} +0 -0
  44. data/tracks/ocaml/tools/test-generator/templates/ocaml/triangle/{template.ml → test.ml} +0 -0
  45. data/tracks/ocaml/tools/test-generator/templates/ocaml/word-count/{template.ml → test.ml} +0 -0
  46. data/tracks/python/README.md +27 -12
  47. data/tracks/rust/README.md +1 -1
  48. metadata +32 -33
  49. data/tracks/ocaml/tools/test-generator/src/special_cases.ml +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74cde339f5cdb1ac6755c1107093a003ebe1aa59
4
- data.tar.gz: a504d24c826d0e30cb2ba137a09768679be8a11c
3
+ metadata.gz: ba0238c5efd0610f51d605a41a98489110c75117
4
+ data.tar.gz: 3749d5108159a055ad4d2c68a99ed6297f01c272
5
5
  SHA512:
6
- metadata.gz: 5618589cbec041969591deecf786a8603074d858d17f68ef8200fad1e42ab9c6dd6d726d15e348c79050bc5beb592e44cb5123aa74683bd56277fbde2957c69f
7
- data.tar.gz: 596445c4128d4f3080a3c81c766793d47ea6baed7cb3ed9fdd865c644d6cab3e83cec0e5b55d6e189b47d8ae58461c33d5f5bdc412b5290e0b51076110951091
6
+ metadata.gz: ba96c15d0f423acd0aee7ec87c11308d95bc8d634626361803a779bdbab47a278466de2baa348f698c628a95c3c0ab02e558f598aa6fcd4d65f19b2d9cdfbff4
7
+ data.tar.gz: 70e84d13ae79a5d25eeba58d39ac848d2ae2b68c8d8c7f3d7c972e5beec589d58339005aa39fc1626242627fe1a041751b86e1bf7ff137c4a36621e73283ac2d
@@ -27,13 +27,10 @@ themselves. There are other guides about contributing to other parts of the Exer
27
27
  * [Overview](#overview)
28
28
  * [Updating an Exercise Test Suite](#updating-an-exercise-test-suite)
29
29
  * [Updating a Generated Test Suite](#updating-a-generated-test-suite)
30
- * [Porting an Exercise to Another Language Track](#porting-an-exercise-to-another-language-track)
31
- * [Providing Feedback on the Site for an Exercise You Implemented](#providing-feedback-on-the-site-for-an-exercise-you-implemented)
32
30
  * [Implementing a Completely New Exercise](#implementing-a-completely-new-exercise)
33
31
  * [Track Anatomy](#track-anatomy)
34
32
  * [Starting a New Track](#starting-a-new-track)
35
33
  * [Beta-Testing a Language Track](#beta-testing-a-language-track)
36
- * [Maintaining a Track](#maintaining-a-track)
37
34
  * [Useful Tidbits](#useful-tidbits)
38
35
  * [Pull Request Guidelines](#pull-request-guidelines)
39
36
  * [Exercise Versioning](#exercise-versioning)
@@ -219,80 +216,6 @@ Follow the guidelines for setting up a development environment, verifying the ch
219
216
  and submitting a pull request, as described in the [main section about updating an
220
217
  exercise test suite](#updating-an-exercise-test-suite).
221
218
 
222
- ## Porting an Exercise to Another Language Track
223
-
224
- To get a list of all the exercises that can be ported to a track,
225
- go to the url `http://exercism.io/languages/:track_id/todo`.
226
-
227
- For example here is the list of exercises that have not yet been implemented
228
- for the Ruby track: http://exercism.io/languages/ruby/todo
229
-
230
- Each unimplemented exercise links to existing implementations of the exercise in
231
- other language tracks, so that people can use those example solutions and test
232
- suites as inspiration.
233
-
234
- We are also extracting canonical inputs and outputs for a given
235
- exercise and storing them in JSON format in the x-common repository. We've accomplished this on a few exercises, but there are many more to do.
236
-
237
- Although this page is now implemented, you can still get this information from the raw data
238
- served by the API endpoint `http://x.exercism.io/v3/tracks/:track_id/todo`.
239
-
240
- For example, here's the list of exercises that have not yet been implemented
241
- in the Elm track: http://x.exercism.io/v3/tracks/elm/todo
242
-
243
- It can be pretty unwieldy to read the JSON directly. To make it easier,
244
- install a browser extension that formats the JSON nicely, or copy/paste the
245
- response body into [jsonlint.com](http://jsonlint.com/) and click "validate JSON", which not
246
- only validates it, but pretty-prints it.
247
-
248
- The description of the problem can be found in the
249
- [x-common](https://github.com/exercism/x-common) repository, in a folder named
250
- after the problem slug: `exercises/<slug>/description.md`.
251
-
252
- **When you decide to implement an exercise**
253
-
254
- * check that there are no open pull requests for the same exercise
255
- * open a "work in progress" (WIP) pull request
256
-
257
- The way to open a WIP pull request even if you haven't done any work yet is:
258
-
259
- * Fork and clone the repository
260
- * Check out a branch for your the exercise
261
- * Add an empty commit `git commit --allow-empty -m "dibs: I will implement exercise <slug>"`
262
- (replace <slug> with the actual name of the exercise).
263
- * Push the new branch to your repository, and open a pull request against that branch.
264
-
265
- Once you have added the actual exercise, then you can rebase your branch onto the upstream
266
- master, which will make the WIP commit go away.
267
-
268
- The exercise should consist of, at minimum:
269
-
270
- * A test suite
271
- * A reference solution that passes the test (see [#reference-solution](#reference-solution))
272
-
273
- You will need to add the exercise to `"exercises"` section of the `config.json` file in the track.
274
- The order in which the exercises are listed there is the order in which they are fetched by default by `exercism fetch`.
275
- Typically, exercises are ordered by difficulty, unless there is a particular reason to do otherwise.
276
-
277
- Each language track might have additional guidance on how to order their
278
- exercises or additional requirements on new exercise files; check the README in
279
- the repository for the track.
280
-
281
- ### Providing Feedback on the Site for an Exercise You Implemented
282
-
283
- Once you've created an exercise, you'll probably want to provide feedback to people who
284
- submit solutions to it. By default you only get access to exercises you've submitted
285
- a solution for.
286
-
287
- You can fetch the problem directly using the CLI:
288
-
289
- ```bash
290
- $ exercism fetch <track_id> <slug>
291
- ```
292
-
293
- Go ahead and submit the reference solution that you wrote when creating the problem.
294
- Remember to archive it if you don't want other people to comment on it.
295
-
296
219
  ## Implementing a Completely New Exercise
297
220
 
298
221
  A problem must have a unique slug. This slug is used as
@@ -405,93 +328,6 @@ satisfy the tests provided for each problem.
405
328
  You can include advice and helpful links for your language track in the
406
329
  `SETUP.md` file.
407
330
 
408
- ## Maintaining a Track
409
-
410
- Maintaining a language track generally consists of:
411
-
412
- - Reviewing/merging pull requests.
413
- - Discussing improvements in the exercises.
414
- - Implementing or porting new exercises.
415
- - Improving the development tooling (e.g. implementing continuous
416
- integration).
417
- - Language-Specific support.
418
- - Adding/improving language-specific documentation.
419
-
420
- Ideally a track will have several maintainers, for two reasons:
421
-
422
- - more lively
423
- - spread the workload
424
-
425
- **More Lively**
426
-
427
- We've noticed that as soon as there are at least two people maintaining
428
- the same track we get rich discussions about quality and idioms. There's a lot
429
- more activity, and it's a lot more fun.
430
-
431
- **Spread the Workload**
432
-
433
- We don't want to burn people out, and it's really nice to be able to
434
- go on vacation or get busy at work without worrying too much about a growing
435
- backlog of unanswered issues and unreviewed and unmerged pull requests.
436
-
437
- **Caveat**
438
-
439
- There's a small chance that when more people are involved there's a bit of
440
- diffusion of responsibility (worth googling and reading about if you haven't
441
- heard the term before).
442
-
443
- ### Reviewing/Merging Pull Requests
444
-
445
- In general:
446
-
447
- - Avoid merging your own pull requests (but it's fine if it's really simple).
448
- - If the change is significant, get a second opinion.
449
- - If it's insignificant or simple or uncontroversial, go ahead and merge.
450
- - If nobody else responds within a certain amount of time, go ahead and merge
451
- it anyway, if you feel like it's good enough (we can always fix things
452
- later).
453
-
454
- Many maintainers have mentioned that they like to get a second pair of eyes
455
- even for simple fixes, because it's so easy to for typos and really silly
456
- things to slip in.
457
-
458
- ### Use Branches (Probably, Mostly)
459
-
460
- Even for simple fixes (documentation, typos) branches let others see what's
461
- going on in the repository. If it's insignificant, go ahead and merge it
462
- yourself.
463
-
464
- Sometimes it's just silly to create a branch. In that case, go ahead and put
465
- it in master, unless there's a track-level policy about not doing that.
466
-
467
- ### Claiming Issues
468
-
469
- When you start working on an issue, claim it (either assign it to yourself
470
- or just add a comment that you're taking it).
471
-
472
- If you have a big list of similar, related things, it's fine to create
473
- a single issue with a todo list, and people can claim individual things
474
- in the comment thread.
475
-
476
- ### Implementing / Reviewing New Exercises
477
-
478
- The tracks should implement the exercise idiomatically in the language
479
- at hand, without veering too far from the README as described (does expanding
480
- the exercise introduce new ideas or just add more work? Is this better off
481
- treated as a new, separate exercise?).
482
-
483
- If there are interesting corner cases, then these should be added to the
484
- README, they help make the discussions better.
485
-
486
- Exercises should not enforce a single way to solve the problem, if possible.
487
- The more interesting exercises allow several approaches, and create rich
488
- opportunities for discussing trade-offs when people submit their solutions.
489
-
490
- ### Skipping Uninteresting Exercises
491
-
492
- Don't be afraid to 'forego' exercises that don't make sense in the language,
493
- or that are not particularly interesting.
494
-
495
331
  ## Useful Tidbits
496
332
 
497
333
  Here are a few bits and pieces that are referenced from some of the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "collatz-conjecture",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "cases": [
5
5
  {
6
6
  "description": "zero steps for one",
@@ -20,6 +20,12 @@
20
20
  "number": 12,
21
21
  "expected": 9
22
22
  },
23
+ {
24
+ "description": "Large number of even and odd steps",
25
+ "property": "steps",
26
+ "number": 1000000,
27
+ "expected": 152
28
+ },
23
29
  {
24
30
  "description": "zero is an error",
25
31
  "property": "steps",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "dominoes",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "comments": [
5
5
  "Inputs are given as lists of two-element lists.",
6
6
  "Feel free to convert the input to a sensible type in the specific language",
@@ -41,37 +41,37 @@
41
41
  "description": "empty input = empty output",
42
42
  "property": "canChain",
43
43
  "input": [],
44
- "can_chain": true
44
+ "expected": true
45
45
  },
46
46
  {
47
47
  "description": "singleton input = singleton output",
48
48
  "property": "canChain",
49
49
  "input": [[1, 1]],
50
- "can_chain": true
50
+ "expected": true
51
51
  },
52
52
  {
53
53
  "description": "singleton that can't be chained",
54
54
  "property": "canChain",
55
55
  "input": [[1, 2]],
56
- "can_chain": false
56
+ "expected": false
57
57
  },
58
58
  {
59
59
  "description": "three elements",
60
60
  "property": "canChain",
61
61
  "input": [[1, 2], [3, 1], [2, 3]],
62
- "can_chain": true
62
+ "expected": true
63
63
  },
64
64
  {
65
65
  "description": "can reverse dominoes",
66
66
  "property": "canChain",
67
67
  "input": [[1, 2], [1, 3], [2, 3]],
68
- "can_chain": true
68
+ "expected": true
69
69
  },
70
70
  {
71
71
  "description": "can't be chained",
72
72
  "property": "canChain",
73
73
  "input": [[1, 2], [4, 1], [2, 3]],
74
- "can_chain": false
74
+ "expected": false
75
75
  },
76
76
  {
77
77
  "description": "disconnected - simple",
@@ -84,19 +84,19 @@
84
84
  ],
85
85
  "property": "canChain",
86
86
  "input": [[1, 1], [2, 2]],
87
- "can_chain": false
87
+ "expected": false
88
88
  },
89
89
  {
90
90
  "description": "disconnected - double loop",
91
91
  "property": "canChain",
92
92
  "input": [[1, 2], [2, 1], [3, 4], [4, 3]],
93
- "can_chain": false
93
+ "expected": false
94
94
  },
95
95
  {
96
96
  "description": "disconnected - single isolated",
97
97
  "property": "canChain",
98
98
  "input": [[1, 2], [2, 3], [3, 1], [4, 4]],
99
- "can_chain": false
99
+ "expected": false
100
100
  },
101
101
  {
102
102
  "description": "need backtrack",
@@ -109,19 +109,19 @@
109
109
  ],
110
110
  "property": "canChain",
111
111
  "input": [[1, 2], [2, 3], [3, 1], [2, 4], [2, 4]],
112
- "can_chain": true
112
+ "expected": true
113
113
  },
114
114
  {
115
115
  "description": "separate loops",
116
116
  "property": "canChain",
117
117
  "input": [[1, 2], [2, 3], [3, 1], [1, 1], [2, 2], [3, 3]],
118
- "can_chain": true
118
+ "expected": true
119
119
  },
120
120
  {
121
121
  "description": "nine elements",
122
122
  "property": "canChain",
123
123
  "input": [[1, 2], [5, 3], [3, 1], [1, 2], [2, 4], [1, 6], [2, 3], [3, 4], [5, 6]],
124
- "can_chain": true
124
+ "expected": true
125
125
  }
126
126
  ]
127
127
  }
@@ -1,10 +1,10 @@
1
1
  For want of a horseshoe nail, a kingdom was lost, or so the saying goes. Output
2
- the full text of this proverbial rhyme.
2
+ the full text of this proverbial rhyme:
3
3
 
4
- For want of a nail the shoe was lost.
5
- For want of a shoe the horse was lost.
6
- For want of a horse the rider was lost.
7
- For want of a rider the message was lost.
8
- For want of a message the battle was lost.
9
- For want of a battle the kingdom was lost.
10
- And all for the want of a horseshoe nail.
4
+ > For want of a nail the shoe was lost.
5
+ > For want of a shoe the horse was lost.
6
+ > For want of a horse the rider was lost.
7
+ > For want of a rider the message was lost.
8
+ > For want of a message the battle was lost.
9
+ > For want of a battle the kingdom was lost.
10
+ > And all for the want of a horseshoe nail.
@@ -48,17 +48,8 @@ Sometimes they may be smaller than usual (diminished, written "D"), or larger
48
48
 
49
49
  Here is a table of pitches with the names of their interval distance from the tonic (A).
50
50
 
51
- A | A# | B | C | C# | D | D# |
52
- ----------------------------------------------------------------------
53
- Unison | Min 2nd | Maj 2nd | Min 3rd | Maj 3rd | Per 4th | Tritone |
54
- | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th |
55
- | Dim 5th |
56
-
57
-
58
- E | F | F# | G | G# | A |
59
- -----------------------------------------------------------
60
- Per 5th | Min 6th | Maj 6th | Min 7th | Maj 7th | Octave |
61
- Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | |
62
-
63
-
64
-
51
+ | A | A# | B | C | C# | D | D# | E | F | F# | G | G# | A |
52
+ |:------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:------:|
53
+ | Unison | Min 2nd | Maj 2nd | Min 3rd | Maj 3rd | Per 4th | Tritone | Per 5th | Min 6th | Maj 6th | Min 7th | Maj 7th | Octave |
54
+ | | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th | Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | |
55
+ | | | | | | | Dim 5th | | | | | | |
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.1.0.30"
2
+ VERSION = "2.1.0.31"
3
3
  end
@@ -270,11 +270,6 @@
270
270
  "difficulty": 7,
271
271
  "topics": []
272
272
  },
273
- {
274
- "slug": "rectangles",
275
- "difficulty": 7,
276
- "topics": []
277
- },
278
273
  {
279
274
  "slug": "meetup",
280
275
  "difficulty": 7,
@@ -290,6 +285,16 @@
290
285
  "difficulty": 7,
291
286
  "topics": []
292
287
  },
288
+ {
289
+ "slug": "ocr-numbers",
290
+ "difficulty": 8,
291
+ "topics": []
292
+ },
293
+ {
294
+ "slug": "rectangles",
295
+ "difficulty": 8,
296
+ "topics": []
297
+ },
293
298
  {
294
299
  "slug": "book-store",
295
300
  "difficulty": 8,
@@ -325,11 +330,6 @@
325
330
  "difficulty": 1,
326
331
  "topics": []
327
332
  },
328
- {
329
- "slug": "ocr-numbers",
330
- "difficulty": 1,
331
- "topics": []
332
- },
333
333
  {
334
334
  "slug": "run-length-encoding",
335
335
  "difficulty": 1,
@@ -8,7 +8,7 @@ import java.util.List;
8
8
  */
9
9
  final class OpticalCharacterReader {
10
10
 
11
- private static final int ROWS_PER_LINE = 4;
11
+ private static final int ROWS_PER_LINE = 4;
12
12
 
13
13
  private static final int COLS_PER_SSD = 3;
14
14
 
@@ -56,9 +56,9 @@ final class OpticalCharacterReader {
56
56
  "Number of input rows must be a positive multiple of " + ROWS_PER_LINE);
57
57
  }
58
58
 
59
- final int inputColumnCount = input.get(0).length();
59
+ final int inputColCount = input.get(0).length();
60
60
 
61
- if (inputColumnCount == 0 || inputColumnCount % 3 != 0) {
61
+ if (inputColCount == 0 || inputColCount % 3 != 0) {
62
62
  throw new IllegalArgumentException(
63
63
  "Number of input columns must be a positive multiple of " + COLS_PER_SSD);
64
64
  }
@@ -1,4 +1,4 @@
1
- (* Test/exercise version: "1.0.1" *)
1
+ (* Test/exercise version: "2.0.0" *)
2
2
 
3
3
  open Core
4
4
  open OUnit2
@@ -1,4 +1,4 @@
1
- (* Test/exercise version: "1.0.0" *)
1
+ (* Test/exercise version: "1.1.0" *)
2
2
 
3
3
  open Core
4
4
  open OUnit2
@@ -6,76 +6,68 @@ module L = List_ops
6
6
  let aei exp got _test_ctxt = assert_equal ~printer:Int.to_string exp got
7
7
 
8
8
  let ael exp got _test_ctxt =
9
- (* There's a little problem with the [List.to_string] function apparently
10
- getting a stack overflow on very long lists. *)
11
- if List.length exp < 1000 then
12
- assert_equal ~printer:(List.to_string ~f:Int.to_string) exp got
13
- else
14
- assert_equal exp got
9
+ assert_equal ~printer:(List.to_string ~f:Int.to_string) exp got
15
10
 
16
11
  let is_odd n = n % 2 = 1
17
12
 
18
- let tests =
19
- ["length of empty list">::
20
- aei 0 (L.length []);
13
+ let tests = [
14
+ "length of empty list">::
15
+ aei 0 (L.length []);
21
16
  "length of normal list">::
22
- aei 4 (L.length [1;3;5;7]);
17
+ aei 4 (L.length [1;3;5;7]);
23
18
  "length of huge list">::
24
- aei 1_000_000 (L.length (List.range 0 1_000_000));
19
+ aei 1_000_000 (L.length (List.range 0 1_000_000));
25
20
  "reverse of empty list">::
26
- ael [] (L.reverse []);
21
+ ael [] (L.reverse []);
27
22
  "reverse of normal list">::
28
- ael [7;5;3;1] (L.reverse [1;3;5;7]);
23
+ ael [7;5;3;1] (L.reverse [1;3;5;7]);
29
24
  "reverse of huge list">::
30
- ael (List.range ~start:`exclusive ~stop:`inclusive ~stride:(-1) 1_000_000 0)
31
- (L.reverse (List.range 0 1_000_000));
25
+ ael (List.range ~start:`exclusive ~stop:`inclusive ~stride:(-1) 1_000_000 0)
26
+ (L.reverse (List.range 0 1_000_000));
32
27
  "map of empty list">::
33
- ael [] (L.map ~f:((+) 1) []);
28
+ ael [] (L.map ~f:((+) 1) []);
34
29
  "map of normal list">::
35
- ael [2;4;6;8] (L.map ~f:((+) 1) [1;3;5;7]);
30
+ ael [2;4;6;8] (L.map ~f:((+) 1) [1;3;5;7]);
36
31
  "map of huge list">::
37
- ael (List.range 1 1_000_001) (L.map ~f:((+) 1) (List.range 0 1_000_000));
32
+ ael (List.range 1 1_000_001) (L.map ~f:((+) 1) (List.range 0 1_000_000));
38
33
  "filter of empty list">::
39
- ael [] (L.filter ~f:is_odd []);
34
+ ael [] (L.filter ~f:is_odd []);
40
35
  "filter of normal list">::
41
- ael [1;3] (L.filter ~f:is_odd [1;2;3;4]);
36
+ ael [1;3] (L.filter ~f:is_odd [1;2;3;4]);
42
37
  "filter of huge list">::
43
- ael (List.range ~stride:2 1 1_000_000)
44
- (L.filter ~f:is_odd (List.range 0 1_000_000));
38
+ ael (List.range ~stride:2 1 1_000_000)
39
+ (L.filter ~f:is_odd (List.range 0 1_000_000));
45
40
  "fold of empty list">::
46
- aei 0 (L.fold ~init:0 ~f:(+) []);
41
+ aei 0 (L.fold ~init:0 ~f:(+) []);
47
42
  "fold of normal list">::
48
- aei 7 (L.fold ~init:(-3) ~f:(+) [1;2;3;4]);
43
+ aei 7 (L.fold ~init:(-3) ~f:(+) [1;2;3;4]);
49
44
  "fold of huge list">::
50
- aei (List.fold ~init:0 ~f:(+) (List.range 0 1_000_000))
51
- (L.fold ~init:0 ~f:(+) (List.range 0 1_000_000));
45
+ aei (List.fold ~init:0 ~f:(+) (List.range 0 1_000_000))
46
+ (L.fold ~init:0 ~f:(+) (List.range 0 1_000_000));
52
47
  "append of empty lists">::
53
- ael [] (L.append [] []);
48
+ ael [] (L.append [] []);
54
49
  "append of empty and non-empty list">::
55
- ael [1;2;3;4] (L.append [] [1;2;3;4]);
50
+ ael [1;2;3;4] (L.append [] [1;2;3;4]);
56
51
  "append of non-empty and empty list">::
57
- ael [1;2;3;4] (L.append [1;2;3;4] []);
52
+ ael [1;2;3;4] (L.append [1;2;3;4] []);
58
53
  "append of non-empty lists">::
59
54
  ael [1;2;3;4;5] (L.append [1;2;3] [4;5]);
60
55
  "append of huge lists">::
61
- ael (List.range 0 2_000_000)
62
- (L.append (List.range 0 1_000_000) (List.range 1_000_000 2_000_000));
56
+ ael (List.range 0 2_000_000)
57
+ (L.append (List.range 0 1_000_000) (List.range 1_000_000 2_000_000));
63
58
  "concat of empty list of lists">::
64
- ael [] (L.concat []);
59
+ ael [] (L.concat []);
65
60
  "concat of normal list of lists">::
66
- ael [1;2;3;4;5;6] (L.concat [[1;2];[3];[];[4;5;6]]);
61
+ ael [1;2;3;4;5;6] (L.concat [[1;2];[3];[];[4;5;6]]);
67
62
  "concat of huge list of small lists">::
68
- ael (List.range 0 1_000_000)
69
- (L.concat (List.map ~f:(fun x -> [x]) (List.range 0 1_000_000)));
63
+ ael (List.range 0 1_000_000)
64
+ (L.concat (List.map ~f:(fun x -> [x]) (List.range 0 1_000_000)));
70
65
  "concat of small list of huge lists">::
71
- ael (List.range 0 1_000_000)
72
- (L.concat
73
- (List.map ~f:(fun x -> List.range (x*100_000) ((x+1)*100_000))
74
- (List.range 0 10)))
66
+ ael (List.range 0 1_000_000)
67
+ (L.concat
68
+ (List.map ~f:(fun x -> List.range (x*100_000) ((x+1)*100_000))
69
+ (List.range 0 10)))
75
70
  ]
76
71
 
77
72
  let () =
78
73
  run_test_tt_main ("list-ops tests" >::: tests)
79
-
80
- (* vim:et:ts=2:sw=2:sts=2
81
- *)
@@ -3,7 +3,6 @@ open Parser
3
3
  open Model
4
4
  open Utils
5
5
  open Codegen
6
- open Special_cases
7
6
  open Template
8
7
  open Files
9
8
  open Languages
@@ -40,13 +39,13 @@ let prepend_version (version_printer: string -> string) (v: string option) (str:
40
39
  let generate_code ~(lc: language_config) ~(slug: string) ~(template_file: content) ~(canonical_data_file: content): (content, string) Result.t =
41
40
  let open Result.Monad_infix in
42
41
  Result.of_option ~error:("cannot recognize file for " ^ slug ^ " as a template") @@ find_template template_file lc.test_start_marker lc.test_end_marker >>= fun template ->
43
- let edit_expected = edit_expected ~language:lc.name ~stringify:json_to_string ~slug in
42
+ let edit_expected = lc.edit_expected ~stringify:json_to_string ~slug in
44
43
  let edit_parameters = edit_parameters ~slug in
45
44
  let fill_in_template = fill_in_template edit_expected edit_parameters in
46
45
  let file_text = template.file_text in
47
46
  let file_lines = String.split_lines file_text |> List.to_array in
48
47
  let prepend_version = prepend_version lc.version_printer in
49
- parse_json_text canonical_data_file (expected_key_name slug) (cases_name slug)
48
+ parse_json_text canonical_data_file "expected" "cases"
50
49
  |> Result.map_error ~f:show_error >>| simplify_single_test_suite >>= fun cd -> (match cd.tests with
51
50
  | Single cases ->
52
51
  let template = to_single template.template in
@@ -90,7 +89,7 @@ let check_canonical_data canonical_data_folder =
90
89
  let canonical_data_files = List.sort canonical_data_files ~cmp:(fun (s1, _) (s2, _) -> String.compare s1 s2) in
91
90
  let total_count = List.length canonical_data_files in
92
91
  List.iter canonical_data_files ~f:(fun (slug, text) ->
93
- match parse_json_text text (expected_key_name slug) (cases_name slug) with
92
+ match parse_json_text text "expected" "cases" with
94
93
  | Error e -> print_endline @@ slug ^ ": " ^ (show_error e)
95
94
  | _ -> ok_count := !ok_count + 1
96
95
  );
@@ -1,30 +1,32 @@
1
1
  open Core
2
+ open Yojson.Basic
3
+ include Ocaml_special_cases
2
4
 
3
5
  type language_config = {
4
- name: string;
5
6
  template_file_name: string;
6
7
  default_base_folder: string;
7
8
  test_start_marker: string;
8
9
  test_end_marker: string;
9
- version_printer: string -> string
10
+ version_printer: string -> string;
11
+ edit_expected: stringify: (json -> string) -> slug: string -> value: json -> string;
10
12
  }
11
13
 
12
14
  let default_language_config = function
13
15
  | "ocaml" -> {
14
- name = "ocaml";
15
- template_file_name = "template.ml";
16
+ template_file_name = "test.ml";
16
17
  default_base_folder = "../..";
17
18
  test_start_marker = "(* TEST";
18
19
  test_end_marker = "END TEST";
19
- version_printer = fun v -> "(* Test/exercise version: \"" ^ v ^ "\" *)\n\n";
20
+ version_printer = (fun v -> "(* Test/exercise version: \"" ^ v ^ "\" *)\n\n");
21
+ edit_expected = ocaml_edit_expected;
20
22
  }
21
23
  | "purescript" -> {
22
- name = "purescript";
23
24
  template_file_name = "Main.purs";
24
25
  default_base_folder = "../../../xpurescript";
25
26
  test_start_marker = "--TEST";
26
27
  test_end_marker = "--END TEST";
27
- version_printer = fun v -> "-- Test/exercise version: \"" ^ v ^ "\"\n\n";
28
+ version_printer = (fun v -> "-- Test/exercise version: \"" ^ v ^ "\"\n\n");
29
+ edit_expected = Purescript_special_cases.edit_expected;
28
30
  }
29
31
  | x -> failwith @@ "unknown language " ^ x
30
32
 
@@ -129,9 +129,3 @@ let edit_parameters ~(slug: string) (parameters: (string * json) list) = match (
129
129
  | ("bowling", ps) -> edit_bowling ps
130
130
  | ("binary-search", ps) -> edit_binary_search ps
131
131
  | (_, ps) -> map_elements json_to_string ps
132
-
133
- let expected_key_name slug = match slug with
134
- | "dominoes" -> "can_chain"
135
- | _ -> "expected"
136
-
137
- let cases_name _slug = "cases"
@@ -5,38 +5,53 @@
5
5
 
6
6
  Exercism exercises in Python
7
7
 
8
+
8
9
  ## Contributing Guide
9
10
 
10
11
  Please see the [contributing guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md)
11
12
 
13
+
12
14
  ## Working on the Exercises
13
15
 
14
16
  We welcome both improvements to the existing exercises and new exercises.
15
- A pool of exercise ideas can be found in the [x-common repo](https://github.com/exercism/x-common).
17
+ A list of missing exercise can be found here: http://exercism.io/languages/python/todo
18
+
19
+
20
+ ### Conventions
21
+
22
+ - We use minimalistic stub files for all exercises (#272).
23
+ - We use `unittest` (Python Standard Library) and no 3rd-party-framework.
24
+ - We use the parameter order `self.assertEqual(actual, expected)` (#440).
25
+
26
+
27
+ ### Testing
16
28
 
17
29
  All exercises must be compatible with Python versions 2.7 and 3.3 upwards.
18
- Therefore please test your changes with these versions.
19
30
 
20
- Test a single exercise with Python 2.7:
31
+ To test a single exercise (e.g., with Python 2.7):
21
32
  ```
22
33
  python2.7 test/check-exercises.py [exercise-name]
23
34
  ```
24
35
 
25
- Test a single exercise with Python 3.3:
36
+ To test all exercises (e.g., with Python 3):
26
37
  ```
27
- python3.3 test/check-exercises.py [exercise-name]
38
+ python3 test/check-exercises.py
28
39
  ```
29
40
 
30
- Test all exercises:
31
- ```
32
- python test/check-exercises.py
33
- ```
34
41
 
35
- ## Code Style
42
+ ### Code Style
43
+
44
+ The Python code in this repo is meant to follow the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/) (a stylized version http://pep8.org).
45
+
46
+ This repo uses [flake8](http://flake8.readthedocs.org/en/latest/) with default settings to enforce the coding standard.
47
+
48
+
49
+ ### CI build
50
+
51
+ This repo uses `travis-ci` in the following configuration: [travis.yml](https://github.com/exercism/xpython/blob/master/.travis.yml)
36
52
 
37
- The Python code in this repo is meant to follow the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/).
53
+ It will check automatically the code style, the problem configuration and runns the unittests with all supported Python versions.
38
54
 
39
- This repo uses [flake8](http://flake8.readthedocs.org/en/latest/) with default settings to enforce the coding standard. When you submit a PR, it needs to pass the flake8 tool with no warnings, or it won't be accepted.
40
55
 
41
56
  ## Pull Requests
42
57
 
@@ -7,7 +7,7 @@ Exercism exercises in Rust
7
7
 
8
8
  ## Contributing Guide
9
9
 
10
- Please see the [contributing guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md)
10
+ Please see the [contributing guide](https://github.com/exercism/docs/tree/master/contributing-to-language-tracks)
11
11
 
12
12
 
13
13
  ## Rust icon
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.30
4
+ version: 2.1.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -6251,40 +6251,39 @@ files:
6251
6251
  - tracks/ocaml/tools/test-generator/src/ocaml_special_cases.ml
6252
6252
  - tracks/ocaml/tools/test-generator/src/parser.ml
6253
6253
  - tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
6254
- - tracks/ocaml/tools/test-generator/src/special_cases.ml
6255
6254
  - tracks/ocaml/tools/test-generator/src/template.ml
6256
6255
  - tracks/ocaml/tools/test-generator/src/test_gen.ml
6257
6256
  - tracks/ocaml/tools/test-generator/src/utils.ml
6258
- - tracks/ocaml/tools/test-generator/templates/ocaml/acronym/template.ml
6259
- - tracks/ocaml/tools/test-generator/templates/ocaml/all-your-base/template.ml
6260
- - tracks/ocaml/tools/test-generator/templates/ocaml/anagram/template.ml
6261
- - tracks/ocaml/tools/test-generator/templates/ocaml/atbash-cipher/template.ml
6262
- - tracks/ocaml/tools/test-generator/templates/ocaml/beer-song/template.ml
6263
- - tracks/ocaml/tools/test-generator/templates/ocaml/binary-search/template.ml
6264
- - tracks/ocaml/tools/test-generator/templates/ocaml/bob/template.ml
6265
- - tracks/ocaml/tools/test-generator/templates/ocaml/bowling/template.ml
6266
- - tracks/ocaml/tools/test-generator/templates/ocaml/bracket-push/template.ml
6267
- - tracks/ocaml/tools/test-generator/templates/ocaml/change/template.ml
6268
- - tracks/ocaml/tools/test-generator/templates/ocaml/connect/template.ml
6269
- - tracks/ocaml/tools/test-generator/templates/ocaml/difference-of-squares/template.ml
6270
- - tracks/ocaml/tools/test-generator/templates/ocaml/dominoes/template.ml
6271
- - tracks/ocaml/tools/test-generator/templates/ocaml/etl/template.ml
6272
- - tracks/ocaml/tools/test-generator/templates/ocaml/forth/template.ml
6273
- - tracks/ocaml/tools/test-generator/templates/ocaml/hamming/template.ml
6274
- - tracks/ocaml/tools/test-generator/templates/ocaml/hello-world/template.ml
6275
- - tracks/ocaml/tools/test-generator/templates/ocaml/leap/template.ml
6276
- - tracks/ocaml/tools/test-generator/templates/ocaml/luhn/template.ml
6277
- - tracks/ocaml/tools/test-generator/templates/ocaml/minesweeper/template.ml
6278
- - tracks/ocaml/tools/test-generator/templates/ocaml/pangram/template.ml
6279
- - tracks/ocaml/tools/test-generator/templates/ocaml/phone-number/template.ml
6280
- - tracks/ocaml/tools/test-generator/templates/ocaml/prime-factors/template.ml
6281
- - tracks/ocaml/tools/test-generator/templates/ocaml/raindrops/template.ml
6282
- - tracks/ocaml/tools/test-generator/templates/ocaml/roman-numerals/template.ml
6283
- - tracks/ocaml/tools/test-generator/templates/ocaml/run-length-encoding/template.ml
6284
- - tracks/ocaml/tools/test-generator/templates/ocaml/say/template.ml
6285
- - tracks/ocaml/tools/test-generator/templates/ocaml/space-age/template.ml
6286
- - tracks/ocaml/tools/test-generator/templates/ocaml/triangle/template.ml
6287
- - tracks/ocaml/tools/test-generator/templates/ocaml/word-count/template.ml
6257
+ - tracks/ocaml/tools/test-generator/templates/ocaml/acronym/test.ml
6258
+ - tracks/ocaml/tools/test-generator/templates/ocaml/all-your-base/test.ml
6259
+ - tracks/ocaml/tools/test-generator/templates/ocaml/anagram/test.ml
6260
+ - tracks/ocaml/tools/test-generator/templates/ocaml/atbash-cipher/test.ml
6261
+ - tracks/ocaml/tools/test-generator/templates/ocaml/beer-song/test.ml
6262
+ - tracks/ocaml/tools/test-generator/templates/ocaml/binary-search/test.ml
6263
+ - tracks/ocaml/tools/test-generator/templates/ocaml/bob/test.ml
6264
+ - tracks/ocaml/tools/test-generator/templates/ocaml/bowling/test.ml
6265
+ - tracks/ocaml/tools/test-generator/templates/ocaml/bracket-push/test.ml
6266
+ - tracks/ocaml/tools/test-generator/templates/ocaml/change/test.ml
6267
+ - tracks/ocaml/tools/test-generator/templates/ocaml/connect/test.ml
6268
+ - tracks/ocaml/tools/test-generator/templates/ocaml/difference-of-squares/test.ml
6269
+ - tracks/ocaml/tools/test-generator/templates/ocaml/dominoes/test.ml
6270
+ - tracks/ocaml/tools/test-generator/templates/ocaml/etl/test.ml
6271
+ - tracks/ocaml/tools/test-generator/templates/ocaml/forth/test.ml
6272
+ - tracks/ocaml/tools/test-generator/templates/ocaml/hamming/test.ml
6273
+ - tracks/ocaml/tools/test-generator/templates/ocaml/hello-world/test.ml
6274
+ - tracks/ocaml/tools/test-generator/templates/ocaml/leap/test.ml
6275
+ - tracks/ocaml/tools/test-generator/templates/ocaml/luhn/test.ml
6276
+ - tracks/ocaml/tools/test-generator/templates/ocaml/minesweeper/test.ml
6277
+ - tracks/ocaml/tools/test-generator/templates/ocaml/pangram/test.ml
6278
+ - tracks/ocaml/tools/test-generator/templates/ocaml/phone-number/test.ml
6279
+ - tracks/ocaml/tools/test-generator/templates/ocaml/prime-factors/test.ml
6280
+ - tracks/ocaml/tools/test-generator/templates/ocaml/raindrops/test.ml
6281
+ - tracks/ocaml/tools/test-generator/templates/ocaml/roman-numerals/test.ml
6282
+ - tracks/ocaml/tools/test-generator/templates/ocaml/run-length-encoding/test.ml
6283
+ - tracks/ocaml/tools/test-generator/templates/ocaml/say/test.ml
6284
+ - tracks/ocaml/tools/test-generator/templates/ocaml/space-age/test.ml
6285
+ - tracks/ocaml/tools/test-generator/templates/ocaml/triangle/test.ml
6286
+ - tracks/ocaml/tools/test-generator/templates/ocaml/word-count/test.ml
6288
6287
  - tracks/ocaml/tools/test-generator/templates/purescript/hamming/Main.purs
6289
6288
  - tracks/ocaml/tools/test-generator/test/all_tests.ml
6290
6289
  - tracks/ocaml/tools/test-generator/test/beer-song.json
@@ -1,12 +0,0 @@
1
- open Core
2
-
3
- open Yojson.Basic
4
- open Ocaml_special_cases
5
- open Purescript_special_cases
6
-
7
- let edit_expected ~(language: string) ~(stringify: json -> string) ~(slug: string) ~(value: json) = match language with
8
- | "ocaml" -> Ocaml_special_cases.ocaml_edit_expected ~stringify ~slug ~value
9
- | "purescript" -> Purescript_special_cases.edit_expected ~stringify ~slug ~value
10
- | _ -> failwith "unknown language"
11
-
12
- include Ocaml_special_cases