trackler 2.2.1.71 → 2.2.1.72

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/book-store/canonical-data.json +9 -2
  4. data/problem-specifications/exercises/word-count/canonical-data.json +9 -0
  5. data/tracks/bash/CONTRIBUTING.md +199 -0
  6. data/tracks/bash/config.json +24 -11
  7. data/tracks/bash/exercises/triangle/README.md +38 -0
  8. data/tracks/bash/exercises/triangle/example.sh +56 -0
  9. data/tracks/bash/exercises/triangle/triangle_test.sh +126 -0
  10. data/tracks/bash/img/canonical-data-example.png +0 -0
  11. data/tracks/bash/img/create-pr.png +0 -0
  12. data/tracks/bash/img/fork-repository.png +0 -0
  13. data/tracks/c/exercises/acronym/makefile +1 -1
  14. data/tracks/c/exercises/all-your-base/makefile +1 -1
  15. data/tracks/c/exercises/allergies/makefile +1 -1
  16. data/tracks/c/exercises/anagram/makefile +1 -1
  17. data/tracks/c/exercises/atbash-cipher/makefile +1 -1
  18. data/tracks/c/exercises/beer-song/makefile +1 -1
  19. data/tracks/c/exercises/binary-search/makefile +1 -1
  20. data/tracks/c/exercises/binary/makefile +1 -1
  21. data/tracks/c/exercises/bob/makefile +1 -1
  22. data/tracks/c/exercises/clock/makefile +1 -1
  23. data/tracks/c/exercises/collatz-conjecture/makefile +1 -1
  24. data/tracks/c/exercises/difference-of-squares/makefile +1 -1
  25. data/tracks/c/exercises/gigasecond/makefile +1 -1
  26. data/tracks/c/exercises/grains/makefile +1 -1
  27. data/tracks/c/exercises/hamming/makefile +1 -1
  28. data/tracks/c/exercises/hamming/test/test_hamming.c +2 -2
  29. data/tracks/c/exercises/hello-world/makefile +1 -1
  30. data/tracks/c/exercises/isogram/makefile +1 -1
  31. data/tracks/c/exercises/largest-series-product/makefile +1 -1
  32. data/tracks/c/exercises/leap/makefile +1 -1
  33. data/tracks/c/exercises/meetup/makefile +1 -1
  34. data/tracks/c/exercises/nth-prime/makefile +1 -1
  35. data/tracks/c/exercises/nucleotide-count/makefile +1 -1
  36. data/tracks/c/exercises/palindrome-products/makefile +1 -1
  37. data/tracks/c/exercises/pangram/makefile +1 -1
  38. data/tracks/c/exercises/pascals-triangle/makefile +1 -1
  39. data/tracks/c/exercises/perfect-numbers/makefile +1 -1
  40. data/tracks/c/exercises/phone-number/makefile +1 -1
  41. data/tracks/c/exercises/queen-attack/makefile +1 -1
  42. data/tracks/c/exercises/raindrops/makefile +1 -1
  43. data/tracks/c/exercises/react/makefile +1 -1
  44. data/tracks/c/exercises/rna-transcription/makefile +1 -1
  45. data/tracks/c/exercises/robot-simulator/makefile +1 -1
  46. data/tracks/c/exercises/roman-numerals/makefile +1 -1
  47. data/tracks/c/exercises/scrabble-score/makefile +1 -1
  48. data/tracks/c/exercises/series/makefile +1 -1
  49. data/tracks/c/exercises/sieve/makefile +1 -1
  50. data/tracks/c/exercises/space-age/makefile +1 -1
  51. data/tracks/c/exercises/sublist/makefile +1 -1
  52. data/tracks/c/exercises/sum-of-multiples/makefile +1 -1
  53. data/tracks/c/exercises/triangle/makefile +1 -1
  54. data/tracks/c/exercises/word-count/makefile +1 -1
  55. data/tracks/delphi/exercises/allergies/README.md +1 -1
  56. data/tracks/delphi/exercises/bank-account/README.md +1 -1
  57. data/tracks/delphi/exercises/beer-song/README.md +1 -1
  58. data/tracks/delphi/exercises/binary-search/README.md +1 -1
  59. data/tracks/delphi/exercises/bob/README.md +1 -1
  60. data/tracks/delphi/exercises/book-store/README.md +1 -1
  61. data/tracks/delphi/exercises/book-store/uBookStoreExample.pas +34 -14
  62. data/tracks/delphi/exercises/book-store/uBookStoreTests.pas +36 -1
  63. data/tracks/delphi/exercises/bowling/README.md +1 -1
  64. data/tracks/delphi/exercises/circular-buffer/README.md +1 -1
  65. data/tracks/delphi/exercises/clock/README.md +1 -1
  66. data/tracks/delphi/exercises/collatz-conjecture/README.md +1 -1
  67. data/tracks/delphi/exercises/etl/README.md +1 -1
  68. data/tracks/delphi/exercises/grains/README.md +1 -1
  69. data/tracks/delphi/exercises/hamming/README.md +1 -1
  70. data/tracks/delphi/exercises/hello-world/README.md +1 -1
  71. data/tracks/delphi/exercises/leap/README.md +1 -1
  72. data/tracks/delphi/exercises/minesweeper/README.md +1 -1
  73. data/tracks/delphi/exercises/nucleotide-count/README.md +1 -1
  74. data/tracks/delphi/exercises/perfect-numbers/README.md +1 -1
  75. data/tracks/delphi/exercises/phone-number/README.md +1 -1
  76. data/tracks/delphi/exercises/pig-latin/README.md +1 -1
  77. data/tracks/delphi/exercises/poker/README.md +1 -1
  78. data/tracks/delphi/exercises/raindrops/README.md +1 -1
  79. data/tracks/delphi/exercises/reverse-string/README.md +1 -1
  80. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  81. data/tracks/delphi/exercises/roman-numerals/README.md +1 -1
  82. data/tracks/delphi/exercises/saddle-points/README.md +1 -1
  83. data/tracks/delphi/exercises/triangle/README.md +1 -1
  84. data/tracks/delphi/exercises/two-fer/README.md +1 -1
  85. data/tracks/delphi/exercises/wordy/README.md +1 -1
  86. data/tracks/ecmascript/.travis.yml +1 -1
  87. data/tracks/ecmascript/Makefile +4 -5
  88. data/tracks/ecmascript/README.md +2 -1
  89. data/tracks/ecmascript/config.json +12 -0
  90. data/tracks/ecmascript/exercises/change/package.json +5 -3
  91. data/tracks/ecmascript/exercises/protein-translation/package.json +2 -2
  92. data/tracks/ecmascript/exercises/react/README.md +41 -0
  93. data/tracks/ecmascript/exercises/react/example.js +101 -0
  94. data/tracks/ecmascript/exercises/react/package.json +71 -0
  95. data/tracks/ecmascript/exercises/react/react.spec.js +211 -0
  96. data/tracks/ecmascript/exercises/rectangles/package.json +1 -2
  97. data/tracks/ecmascript/exercises/rotational-cipher/package.json +1 -2
  98. data/tracks/ecmascript/exercises/spiral-matrix/package.json +1 -2
  99. data/tracks/ecmascript/exercises/transpose/package.json +2 -2
  100. data/tracks/erlang/docs/ABOUT.md +1 -1
  101. data/tracks/go/exercises/binary-search/.meta/gen.go +55 -0
  102. data/tracks/go/exercises/binary-search/binary_search_test.go +26 -167
  103. data/tracks/go/exercises/binary-search/cases_test.go +73 -0
  104. data/tracks/go/exercises/binary-search/example.go +8 -30
  105. data/tracks/go/exercises/nth-prime/.meta/gen.go +76 -0
  106. data/tracks/go/exercises/nth-prime/cases_test.go +43 -0
  107. data/tracks/go/exercises/nth-prime/nth_prime_test.go +4 -18
  108. data/tracks/go/exercises/prime-factors/.meta/gen.go +54 -0
  109. data/tracks/go/exercises/prime-factors/cases_test.go +48 -0
  110. data/tracks/go/exercises/prime-factors/prime_factors_test.go +4 -19
  111. data/tracks/groovy/config.json +13 -1
  112. data/tracks/groovy/exercises/linked-list/DoubleLinkedList.groovy +19 -0
  113. data/tracks/groovy/exercises/linked-list/DoubleLinkedListSpec.groovy +79 -0
  114. data/tracks/groovy/exercises/linked-list/Example.groovy +57 -0
  115. data/tracks/groovy/exercises/linked-list/README.md +49 -0
  116. data/tracks/java/bin/run-journey-test-from-ci.sh +1 -1
  117. data/tracks/java/config.json +10 -0
  118. data/tracks/java/config/maintainers.json +8 -1
  119. data/tracks/java/docs/MAINTAINING.md +3 -3
  120. data/tracks/java/exercises/accumulate/.meta/src/reference/java/Accumulate.java +2 -2
  121. data/tracks/java/exercises/binary/.meta/src/reference/java/Binary.java +3 -3
  122. data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/BufferIOException.java +1 -1
  123. data/tracks/java/exercises/circular-buffer/.meta/src/reference/java/CircularBuffer.java +6 -6
  124. data/tracks/java/exercises/circular-buffer/src/main/java/BufferIOException.java +1 -1
  125. data/tracks/java/exercises/clock/.meta/src/reference/java/Clock.java +3 -3
  126. data/tracks/java/exercises/crypto-square/.meta/src/reference/java/Crypto.java +7 -7
  127. data/tracks/java/exercises/etl/.meta/src/reference/java/Etl.java +2 -2
  128. data/tracks/java/exercises/etl/src/main/java/Etl.java +2 -2
  129. data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/KindergartenGarden.java +4 -4
  130. data/tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/Plant.java +2 -2
  131. data/tracks/java/exercises/kindergarten-garden/src/main/java/Plant.java +2 -2
  132. data/tracks/java/exercises/nth-prime/.meta/src/reference/java/PrimeCalculator.java +2 -2
  133. data/tracks/java/exercises/reverse-string/.meta/src/reference/java/ReverseString.java +7 -0
  134. data/tracks/java/exercises/reverse-string/.meta/version +1 -0
  135. data/tracks/java/exercises/reverse-string/README.md +25 -0
  136. data/tracks/java/exercises/reverse-string/build.gradle +17 -0
  137. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +7 -0
  138. data/tracks/java/exercises/reverse-string/src/test/java/ReverseStringTest.java +37 -0
  139. data/tracks/java/exercises/run-length-encoding/.meta/src/reference/java/RunLengthEncoding.java +4 -4
  140. data/tracks/java/exercises/settings.gradle +1 -0
  141. data/tracks/kotlin/docs/RESOURCES.md +1 -1
  142. data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
  143. data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
  144. data/tracks/kotlin/exercises/all-your-base/build.gradle +1 -1
  145. data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
  146. data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
  147. data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
  148. data/tracks/kotlin/exercises/bank-account/build.gradle +1 -1
  149. data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
  150. data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
  151. data/tracks/kotlin/exercises/binary/build.gradle +1 -1
  152. data/tracks/kotlin/exercises/bob/build.gradle +1 -1
  153. data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
  154. data/tracks/kotlin/exercises/change/build.gradle +1 -1
  155. data/tracks/kotlin/exercises/clock/build.gradle +1 -1
  156. data/tracks/kotlin/exercises/collatz-conjecture/build.gradle +1 -1
  157. data/tracks/kotlin/exercises/complex-numbers/build.gradle +1 -1
  158. data/tracks/kotlin/exercises/diamond/build.gradle +1 -1
  159. data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
  160. data/tracks/kotlin/exercises/etl/build.gradle +1 -1
  161. data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
  162. data/tracks/kotlin/exercises/forth/build.gradle +1 -1
  163. data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
  164. data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
  165. data/tracks/kotlin/exercises/grains/build.gradle +1 -1
  166. data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
  167. data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
  168. data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
  169. data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
  170. data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
  171. data/tracks/kotlin/exercises/leap/build.gradle +1 -1
  172. data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
  173. data/tracks/kotlin/exercises/list-ops/build.gradle +1 -1
  174. data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
  175. data/tracks/kotlin/exercises/meetup/build.gradle +1 -1
  176. data/tracks/kotlin/exercises/minesweeper/build.gradle +1 -1
  177. data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
  178. data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
  179. data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
  180. data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
  181. data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
  182. data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
  183. data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
  184. data/tracks/kotlin/exercises/prime-factors/build.gradle +1 -1
  185. data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
  186. data/tracks/kotlin/exercises/react/build.gradle +1 -1
  187. data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
  188. data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
  189. data/tracks/kotlin/exercises/robot-simulator/build.gradle +1 -1
  190. data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
  191. data/tracks/kotlin/exercises/rotational-cipher/build.gradle +1 -1
  192. data/tracks/kotlin/exercises/saddle-points/build.gradle +1 -1
  193. data/tracks/kotlin/exercises/say/build.gradle +1 -1
  194. data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
  195. data/tracks/kotlin/exercises/secret-handshake/build.gradle +1 -1
  196. data/tracks/kotlin/exercises/series/build.gradle +1 -1
  197. data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
  198. data/tracks/kotlin/exercises/simple-cipher/README.md +4 -6
  199. data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
  200. data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
  201. data/tracks/kotlin/exercises/spiral-matrix/build.gradle +1 -1
  202. data/tracks/kotlin/exercises/strain/build.gradle +1 -1
  203. data/tracks/kotlin/exercises/sublist/build.gradle +1 -1
  204. data/tracks/kotlin/exercises/sum-of-multiples/build.gradle +1 -1
  205. data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
  206. data/tracks/kotlin/exercises/two-fer/build.gradle +1 -1
  207. data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
  208. data/tracks/lua/.gitignore +1 -0
  209. data/tracks/lua/config.json +12 -0
  210. data/tracks/lua/exercises/isbn-verifier/README.md +52 -0
  211. data/tracks/lua/exercises/isbn-verifier/example.lua +16 -0
  212. data/tracks/lua/exercises/isbn-verifier/isbn-verifier_spec.lua +55 -0
  213. data/tracks/ocaml/.travis-ci.sh +1 -1
  214. data/tracks/ocaml/.travis.yml +1 -1
  215. data/tracks/ocaml/README.md +1 -1
  216. data/tracks/perl6/config.json +10 -0
  217. data/tracks/perl6/exercises/acronym/Acronym.pm6 +4 -0
  218. data/tracks/perl6/exercises/acronym/Example.pm6 +5 -0
  219. data/tracks/perl6/exercises/acronym/README.md +33 -0
  220. data/tracks/perl6/exercises/acronym/acronym.t +96 -0
  221. data/tracks/perl6/exercises/acronym/example.yaml +19 -0
  222. data/tracks/perl6/exercises/word-count/Example.pm6 +1 -1
  223. data/tracks/perl6/exercises/word-count/WordCount.pm6 +1 -1
  224. data/tracks/perl6/exercises/word-count/example.yaml +2 -2
  225. data/tracks/perl6/exercises/word-count/word-count.t +11 -2
  226. data/tracks/pony/docs/RESOURCES.md +1 -1
  227. data/tracks/purescript/docs/INSTALLATION.md +1 -3
  228. data/tracks/python/config.json +1 -1
  229. data/tracks/r/exercises/word-count/test_word-count.R +5 -0
  230. data/tracks/ruby/README.md +73 -10
  231. data/tracks/rust/config.json +34 -0
  232. data/tracks/rust/exercises/book-store/Cargo.toml +1 -1
  233. data/tracks/rust/exercises/book-store/tests/book-store.rs +7 -0
  234. data/tracks/rust/exercises/diffie-hellman/.gitignore +9 -0
  235. data/tracks/rust/exercises/diffie-hellman/Cargo-example.toml +6 -0
  236. data/tracks/rust/exercises/diffie-hellman/Cargo.toml +5 -0
  237. data/tracks/rust/exercises/diffie-hellman/README.md +77 -0
  238. data/tracks/rust/exercises/diffie-hellman/example.rs +15 -0
  239. data/tracks/rust/exercises/diffie-hellman/src/lib.rs +11 -0
  240. data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +60 -0
  241. data/tracks/rust/exercises/macros/.gitignore +3 -0
  242. data/tracks/rust/exercises/macros/.meta/description.md +29 -0
  243. data/tracks/rust/exercises/macros/.meta/metadata.yml +3 -0
  244. data/tracks/rust/exercises/macros/Cargo.toml +6 -0
  245. data/tracks/rust/exercises/macros/README.md +70 -0
  246. data/tracks/rust/exercises/macros/example.rs +16 -0
  247. data/tracks/rust/exercises/macros/src/lib.rs +6 -0
  248. data/tracks/rust/exercises/macros/tests/macros.rs +62 -0
  249. data/tracks/rust/exercises/simple-linked-list/.gitignore +7 -0
  250. data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +34 -0
  251. data/tracks/rust/exercises/simple-linked-list/Cargo.toml +5 -0
  252. data/tracks/rust/exercises/simple-linked-list/README.md +96 -0
  253. data/tracks/rust/exercises/simple-linked-list/example.rs +87 -0
  254. data/tracks/rust/exercises/simple-linked-list/src/lib.rs +46 -0
  255. data/tracks/rust/exercises/simple-linked-list/tests/simple-linked-list.rs +91 -0
  256. data/tracks/swift/.travis.yml +1 -1
  257. data/tracks/swift/config.json +24 -0
  258. data/tracks/swift/exercises/isbn-verifier/Package.swift +5 -0
  259. data/tracks/swift/exercises/isbn-verifier/README.md +39 -0
  260. data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifier.swift +1 -0
  261. data/tracks/swift/exercises/isbn-verifier/Sources/IsbnVerifierExample.swift +35 -0
  262. data/tracks/swift/exercises/isbn-verifier/Tests/IsbnVerifierTests/IsbnVerifierTests.swift +75 -0
  263. data/tracks/swift/exercises/isbn-verifier/Tests/LinuxMain.swift +6 -0
  264. data/tracks/swift/exercises/two-fer/Package.swift +5 -0
  265. data/tracks/swift/exercises/two-fer/README.md +54 -0
  266. data/tracks/swift/exercises/two-fer/Sources/TwoFer.swift +1 -0
  267. data/tracks/swift/exercises/two-fer/Sources/TwoFerExample.swift +6 -0
  268. data/tracks/swift/exercises/two-fer/Tests/LinuxMain.swift +6 -0
  269. data/tracks/swift/exercises/two-fer/Tests/TwoFerTests/TwoFerTests.swift +25 -0
  270. metadata +71 -2
@@ -0,0 +1,19 @@
1
+ exercise: Acronym
2
+ version: 1
3
+ plan: 8
4
+ imports: '&abbreviate'
5
+ tests: |-
6
+
7
+ for $c-data<cases>»<cases>».Array.flat {
8
+ is abbreviate(.<phrase>), |.<expected description>;
9
+ }
10
+
11
+ unit: module
12
+ example: |-
13
+ sub abbreviate ($phrase) is export {
14
+ [~] $phrase.uc.comb(/\w+/).map: *.substr(0, 1);
15
+ }
16
+
17
+ stub: |-
18
+ sub abbreviate ($phrase) is export {
19
+ }
@@ -1,4 +1,4 @@
1
- unit module WordCount:ver<1>;
1
+ unit module WordCount:ver<2>;
2
2
 
3
3
  sub count-words (Str:D $str --> Hash:D) is export {
4
4
  $str.lc.comb(/ <alnum>+ (\'<alnum>+)? /).Bag.hash
@@ -1,4 +1,4 @@
1
- unit module WordCount:ver<1>;
1
+ unit module WordCount:ver<2>;
2
2
 
3
3
  sub count-words ($str) is export {
4
4
  }
@@ -1,6 +1,6 @@
1
1
  exercise: WordCount
2
- version: 1
3
- plan: 12
2
+ version: 2
3
+ plan: 13
4
4
  imports: '&count-words'
5
5
  tests: |-
6
6
  is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<cases>);
@@ -5,9 +5,9 @@ use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
7
  my Str:D $exercise := 'WordCount';
8
- my Version:D $version = v1;
8
+ my Version:D $version = v2;
9
9
  my Str $module //= $exercise;
10
- plan 12;
10
+ plan 13;
11
11
 
12
12
  use-ok $module or bail-out;
13
13
  require ::($module);
@@ -140,6 +140,15 @@ is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<ca
140
140
  "large": 2,
141
141
  "and": 1
142
142
  }
143
+ },
144
+ {
145
+ "description": "multiple spaces not detected as a word",
146
+ "property": "countwords",
147
+ "input": " multiple whitespaces",
148
+ "expected": {
149
+ "multiple": 1,
150
+ "whitespaces": 1
151
+ }
143
152
  }
144
153
  ]
145
154
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  - [The Pony Tutorial](https://tutorial.ponylang.org/)
4
4
  - [Pony Patterns](https://patterns.ponylang.org/)
5
- - [Standard Library Documentation](http://www.ponylang.org/ponyc/)
5
+ - [Standard Library Documentation](https://stdlib.ponylang.org/)
6
6
  - [Mailing List](https://pony.groups.io/g/pony)
7
7
  - [IRC Channel](https://webchat.freenode.net/?channels=%23ponylang)
@@ -7,6 +7,4 @@ compiler, the Pulp build tool and the Bower package manager.
7
7
 
8
8
  npm install --global purescript pulp bower
9
9
 
10
- More information can be found in [the Purescript repository][ps-repo]
11
-
12
- [ps-repo]: (https://github.com/purescript/purescript/blob/master/INSTALL.md).
10
+ More information can be found in [the Purescript repository](https://github.com/purescript/purescript/blob/master/INSTALL.md).
@@ -169,7 +169,7 @@
169
169
  "unlocked_by": null,
170
170
  "difficulty": 1,
171
171
  "topics": [
172
-
172
+ "mathematics"
173
173
  ]
174
174
  },
175
175
  {
@@ -67,4 +67,9 @@ test_that("normalize case", {
67
67
  list("go" = 3, "stop" = 2))
68
68
  })
69
69
 
70
+ test_that("multiple whitespaces", {
71
+ expect_equal_pairs(word_count(" multiple whitespaces "),
72
+ list("multiple" = 1, "whitespaces" = 1))
73
+ })
74
+
70
75
  message("All tests passed for exercise: word-count")
@@ -33,9 +33,14 @@ A few exercises use a custom test template:
33
33
 
34
34
  ### BookKeeping::VERSION
35
35
 
36
- For some, even perhaps many, of the exercises, you will find a
37
- reference to the `BookKeeping` module, but this is only included when
38
- tests have been generated; see [Generated Test Suites](#generated-test-suites).
36
+ For some, even perhaps many, of the exercises, you will find a reference
37
+ to the `BookKeeping` module, but this is only included when tests have
38
+ been generated; see [Generated Test Suites](#generated-test-suites).
39
+ This `VERSION` number helps make sure exercise solvers and exercise
40
+ reviewers know which revision of the test suite they are talking
41
+ about, and it theoretically helps avoid reviewer feedback like
42
+ *"Your solution doesn't make the tests pass,"* if they are looking
43
+ at a different version of the tests than the solver used.
39
44
 
40
45
  ### Canonical Data
41
46
 
@@ -104,12 +109,67 @@ tree -L 1 ~/code/exercism
104
109
 
105
110
  #### Regenerating a Test Suite
106
111
 
107
- From within the ruby directory, run the following command:
112
+ From time to time, the [canonical data](https://github.com/exercism/problem-specifications/tree/master/exercises)
113
+ for an exercise's tests changes, and we need to keep the Ruby version's
114
+ tests synced up. Regenerating these tests is a quick and easy way to help
115
+ maintain the track and get involved!
108
116
 
109
- bin/generate --update <slug>
117
+ If it's your first time cloning/contributing to the repository, you'll
118
+ need to install any dependencies via `bundle`:
110
119
 
111
- Leaving out the --update option will cause the BookKeeping version number to remain the same.
112
- This can be useful when testing generators.
120
+ ```bash
121
+ bundle install
122
+ ```
123
+
124
+ Be sure that you're working on the most up-to-date version of the repo.
125
+ From the root of your copy of the repository:
126
+
127
+ ```bash
128
+ # Add the exercism repo as upstream if you haven't yet:
129
+ git remote add upstream https://github.com/exercism/ruby.git
130
+
131
+ # Pull down any changes
132
+ git fetch upstream
133
+
134
+ # Merge any upstream changes with your master branch
135
+ git checkout master
136
+ git merge upstream/master
137
+ ```
138
+
139
+ Depending on your git workflow preferences and the state of your local
140
+ repo, you may want to do some rebasing.
141
+ [See the rebasing documentation for more information.](https://help.github.com/articles/about-git-rebase/)
142
+
143
+ The generator also depends on the presence of Exercism's `problem-specifications`
144
+ repository (see the file tree in the section above). Make sure you've got
145
+ an *up-to-date* version of the specifications in a `problem-specifications`
146
+ folder that's in a parallel directory to your local copy of the `ruby` repository.
147
+
148
+ To check which problems have possibly been updated, run:
149
+
150
+ ```bash
151
+ bin/generate --all
152
+ ```
153
+
154
+ This will autogenerate all of the test cases for which generators exist.
155
+ Use `git diff` (or your preferred method) to find out which test files
156
+ have changed. Some exercises will update because someone updated the
157
+ description or other exercise metadata. Others will change because the
158
+ actual test suite has changed. If you find that an exercise's test suite
159
+ (i.e. the actual tests, not just the line at the test data version number
160
+ at the top of the tests) has changed, be sure to use `generate` to update
161
+ the [BookKeeping::VERSION](#bookkeeping-version) number by running:
162
+
163
+ ```bash
164
+ bin/generate --update <exercise-slug>
165
+ ```
166
+
167
+ Once everything has been regenerated and updated, you're almost ready to
168
+ submit your changes via pull request. Please be sure to only update one
169
+ exercise per pull request. Also, please follow the guidelines in the
170
+ [Pull Requests](#pull-requests) section, being sure to follow the pattern
171
+ of `<slug>: Regenerate Tests`, where slug is the slug of the exercise that
172
+ your pull request is regenerating.
113
173
 
114
174
  #### Changing a Generated Exercise
115
175
 
@@ -260,10 +320,13 @@ are constructed using shared metadata, which lives in the [problem-specification
260
320
 
261
321
  ## Contributing Guide
262
322
 
263
- For an in-depth discussion of how exercism language tracks and exercises work,
264
- please see the
265
- [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data)
323
+ For an in-depth discussion of how exercism language tracks and exercises work, please see the
324
+ [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data).
266
325
 
326
+ If you're just getting started and looking for a helpful way to get involved,
327
+ take a look at [regenerating the test suites](#regenerating-a-test-suite),
328
+ [porting an exercise from another language](https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md),
329
+ or [creating an automated test generator](#implementing-a-generator).
267
330
 
268
331
  ## Ruby icon
269
332
  The Ruby icon is the Vienna.rb logo, and is used with permission. Thanks Floor Dress :)
@@ -164,6 +164,16 @@
164
164
  "error handling with Result<T, E>"
165
165
  ]
166
166
  },
167
+ {
168
+ "uuid": "23d82e48-d074-11e7-8fab-cec278b6b50a",
169
+ "slug": "diffie-hellman",
170
+ "core": false,
171
+ "unlocked_by": null,
172
+ "difficulty": 1,
173
+ "topics": [
174
+ "mathematics"
175
+ ]
176
+ },
167
177
  {
168
178
  "uuid": "79613fd8-b7da-11e7-abc4-cec278b6b50a",
169
179
  "slug": "isogram",
@@ -244,6 +254,18 @@
244
254
  "Result"
245
255
  ]
246
256
  },
257
+ {
258
+ "uuid": "10923b0b-c726-44a7-9e02-b775e7b8b237",
259
+ "slug": "simple-linked-list",
260
+ "core": false,
261
+ "unlocked_by": null,
262
+ "difficulty": 4,
263
+ "topics": [
264
+ "lists",
265
+ "type_conversion",
266
+ "struct"
267
+ ]
268
+ },
247
269
  {
248
270
  "uuid": "ddc0c1da-6b65-4ed1-8bdc-5e71cd05f720",
249
271
  "slug": "pascals-triangle",
@@ -589,6 +611,18 @@
589
611
  "higher-order functions"
590
612
  ]
591
613
  },
614
+ {
615
+ "uuid": "29583cc6-d56d-4bee-847d-93d74e5a30e7",
616
+ "slug": "macros",
617
+ "core": false,
618
+ "unlocked_by": null,
619
+ "difficulty": 4,
620
+ "topics": [
621
+ "macros",
622
+ "macros-by-example",
623
+ "hashmap"
624
+ ]
625
+ },
592
626
  {
593
627
  "uuid": "94f040d6-3f41-4950-8fe6-acf0945ac83d",
594
628
  "slug": "allergies",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "book_store"
3
- version = "1.0.1"
3
+ version = "1.1.0"
4
4
  authors = ["Peter Goodspeed-Niklaus <peter.r.goodspeedniklaus@gmail.com>"]
5
5
 
6
6
  [dependencies]
@@ -128,3 +128,10 @@ fn test_three_copies_of_first_book_and_2_each_of_remaining() {
128
128
  fn test_three_each_of_first_2_books_and_2_each_of_remaining_books() {
129
129
  process_total_case((vec![1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2], vec![vec![1, 2, 3, 4, 5], vec![1, 2, 3, 4, 5], vec![1, 2]]), 75.2);
130
130
  }
131
+
132
+ #[test]
133
+ #[ignore]
134
+ /// Four groups of four are cheaper than two groups each of five and three
135
+ fn test_four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three() {
136
+ process_total_case((vec![1,1,2,2,3,3,4,5,1,1,2,2,3,3,4,5], vec![vec![1,2,3,4],vec![1,2,3,5],vec![1,2,3,4],vec![1,2,3,5]]), 102.4);
137
+ }
@@ -0,0 +1,9 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ /target/
4
+ **/*.rs.bk
5
+
6
+ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7
+ # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
8
+ Cargo.lock
9
+
@@ -0,0 +1,6 @@
1
+ [package]
2
+ name = "diffie-hellman"
3
+ version = "0.1.0"
4
+
5
+ [dependencies]
6
+ rand = "0.3.18"
@@ -0,0 +1,5 @@
1
+ [package]
2
+ name = "diffie-hellman"
3
+ version = "0.1.0"
4
+
5
+ [dependencies]
@@ -0,0 +1,77 @@
1
+ # Diffie Hellman
2
+
3
+ Diffie-Hellman key exchange.
4
+
5
+ Alice and Bob use Diffie-Hellman key exchange to share secrets. They
6
+ start with prime numbers, pick private keys, generate and share public
7
+ keys, and then generate a shared secret key.
8
+
9
+ ## Step 0
10
+
11
+ The test program supplies prime numbers p and g.
12
+
13
+ ## Step 1
14
+
15
+ Alice picks a private key, a, greater than 1 and less than p. Bob does
16
+ the same to pick a private key b.
17
+
18
+ ## Step 2
19
+
20
+ Alice calculates a public key A.
21
+
22
+ A = g**a mod p
23
+
24
+ Using the same p and g, Bob similarly calculates a public key B from his
25
+ private key b.
26
+
27
+ ## Step 3
28
+
29
+ Alice and Bob exchange public keys. Alice calculates secret key s.
30
+
31
+ s = B**a mod p
32
+
33
+ Bob calculates
34
+
35
+ s = A**b mod p
36
+
37
+ The calculations produce the same result! Alice and Bob now share
38
+ secret s.
39
+
40
+ ## Rust Installation
41
+
42
+ Refer to the [exercism help page][help-page] for Rust installation and learning
43
+ resources.
44
+
45
+ ## Writing the Code
46
+
47
+ Execute the tests with:
48
+
49
+ ```bash
50
+ $ cargo test
51
+ ```
52
+
53
+ All but the first test have been ignored. After you get the first test to
54
+ pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
55
+ to pass again. The test file is located in the `tests` directory. You can
56
+ also remove the ignore flag from all the tests to get them to run all at once
57
+ if you wish.
58
+
59
+ Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
60
+ haven't already, it will help you with organizing your files.
61
+
62
+ ## Feedback, Issues, Pull Requests
63
+
64
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
65
+
66
+ If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
67
+
68
+ [help-page]: http://exercism.io/languages/rust
69
+ [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
70
+ [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
71
+
72
+ ## Source
73
+
74
+ Wikipedia, 1024 bit key from www.cryptopp.com/wiki. [http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange](http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)
75
+
76
+ ## Submitting Incomplete Solutions
77
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,15 @@
1
+ extern crate rand;
2
+
3
+ use rand::distributions::{IndependentSample, Range};
4
+
5
+ pub fn private_key(p: u64) -> u64 {
6
+ Range::new(2, p).ind_sample(&mut rand::thread_rng())
7
+ }
8
+
9
+ pub fn public_key(p: u64, g: u64, a: u64) -> u64 {
10
+ g.pow(a as u32) % p
11
+ }
12
+
13
+ pub fn secret(p: u64, b_pub: u64, a: u64) -> u64 {
14
+ b_pub.pow(a as u32) % p
15
+ }
@@ -0,0 +1,11 @@
1
+ pub fn private_key(_p: u64) -> u64 {
2
+ unimplemented!()
3
+ }
4
+
5
+ pub fn public_key(_p: u64, _g: u64, _a: u64) -> u64 {
6
+ unimplemented!()
7
+ }
8
+
9
+ pub fn secret(_p: u64, _b_pub: u64, _a: u64) -> u64 {
10
+ unimplemented!()
11
+ }
@@ -0,0 +1,60 @@
1
+ extern crate diffie_hellman;
2
+
3
+ use diffie_hellman::*;
4
+
5
+ #[test]
6
+ fn test_private_key_in_range_key() {
7
+ let primes: Vec<u64> = vec![5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 773, 967,
8
+ 3461, 6131];
9
+ let private_keys: Vec<u64> = primes.iter().map(|x| private_key(*x)).collect();
10
+
11
+ for i in 0..primes.len() {
12
+ assert!(1 < private_keys[i] && private_keys[i] < primes[i]);
13
+ }
14
+ }
15
+
16
+ #[test]
17
+ #[ignore]
18
+ fn test_public_key_correct() {
19
+ let p: u64 = 23;
20
+ let g: u64 = 5;
21
+
22
+ let private_key: u64 = 6;
23
+ let expected: u64 = 8;
24
+
25
+ assert_eq!(public_key(p, g, private_key), expected);
26
+ }
27
+
28
+
29
+ #[test]
30
+ #[ignore]
31
+ fn test_secret_key_correct() {
32
+ let p: u64 = 11;
33
+ let g: u64 = 7;
34
+
35
+ let private_key_a = 7;
36
+ let public_key_b = 8;
37
+ let secret = secret(p, public_key_b, private_key_a);
38
+ let expected = 2;
39
+
40
+ assert_eq!(secret, expected);
41
+ }
42
+
43
+ #[test]
44
+ #[ignore]
45
+ fn test_changed_secret_key() {
46
+ let p: u64 = 13;
47
+ let g: u64 = 11;
48
+
49
+ let private_key_a = private_key(p);
50
+ let private_key_b = private_key(p);
51
+
52
+ let public_key_a = public_key(p, g, private_key_a);
53
+ let public_key_b = public_key(p, g, private_key_b);
54
+
55
+ // Key exchange
56
+ let secret_a = secret(p, public_key_b, private_key_a);
57
+ let secret_b = secret(p, public_key_a, private_key_b);
58
+
59
+ assert_eq!(secret_a, secret_b);
60
+ }