trackler 2.0.0.9 → 2.0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/ecmascript/SETUP.md +1 -11
  4. data/tracks/ecmascript/exercises/accumulate/package.json +2 -1
  5. data/tracks/ecmascript/exercises/acronym/package.json +2 -1
  6. data/tracks/ecmascript/exercises/allergies/package.json +2 -1
  7. data/tracks/ecmascript/exercises/anagram/package.json +2 -1
  8. data/tracks/ecmascript/exercises/atbash-cipher/package.json +2 -1
  9. data/tracks/ecmascript/exercises/beer-song/package.json +2 -1
  10. data/tracks/ecmascript/exercises/binary/package.json +2 -1
  11. data/tracks/ecmascript/exercises/binary-search/package.json +2 -1
  12. data/tracks/ecmascript/exercises/binary-search-tree/package.json +2 -1
  13. data/tracks/ecmascript/exercises/bob/package.json +2 -1
  14. data/tracks/ecmascript/exercises/bracket-push/package.json +2 -1
  15. data/tracks/ecmascript/exercises/circular-buffer/package.json +2 -1
  16. data/tracks/ecmascript/exercises/clock/package.json +2 -1
  17. data/tracks/ecmascript/exercises/crypto-square/package.json +2 -1
  18. data/tracks/ecmascript/exercises/custom-set/package.json +2 -2
  19. data/tracks/ecmascript/exercises/diamond/package.json +2 -1
  20. data/tracks/ecmascript/exercises/difference-of-squares/package.json +2 -1
  21. data/tracks/ecmascript/exercises/etl/package.json +2 -1
  22. data/tracks/ecmascript/exercises/food-chain/package.json +2 -1
  23. data/tracks/ecmascript/exercises/gigasecond/package.json +2 -1
  24. data/tracks/ecmascript/exercises/grade-school/package.json +2 -1
  25. data/tracks/ecmascript/exercises/grains/package.json +2 -1
  26. data/tracks/ecmascript/exercises/hamming/package.json +2 -1
  27. data/tracks/ecmascript/exercises/hello-world/package.json +2 -1
  28. data/tracks/ecmascript/exercises/hexadecimal/package.json +2 -1
  29. data/tracks/ecmascript/exercises/isogram/package.json +2 -1
  30. data/tracks/ecmascript/exercises/kindergarten-garden/package.json +2 -1
  31. data/tracks/ecmascript/exercises/largest-series-product/package.json +2 -1
  32. data/tracks/ecmascript/exercises/leap/package.json +2 -1
  33. data/tracks/ecmascript/exercises/linked-list/package.json +2 -1
  34. data/tracks/ecmascript/exercises/luhn/package.json +2 -1
  35. data/tracks/ecmascript/exercises/matrix/package.json +2 -1
  36. data/tracks/ecmascript/exercises/meetup/package.json +2 -1
  37. data/tracks/ecmascript/exercises/nth-prime/package.json +2 -1
  38. data/tracks/ecmascript/exercises/ocr-numbers/package.json +2 -1
  39. data/tracks/ecmascript/exercises/octal/package.json +2 -1
  40. data/tracks/ecmascript/exercises/palindrome-products/package.json +2 -1
  41. data/tracks/ecmascript/exercises/pangram/package.json +2 -1
  42. data/tracks/ecmascript/exercises/pascals-triangle/package.json +2 -1
  43. data/tracks/ecmascript/exercises/phone-number/package.json +2 -1
  44. data/tracks/ecmascript/exercises/pig-latin/package.json +2 -1
  45. data/tracks/ecmascript/exercises/prime-factors/package.json +2 -1
  46. data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +2 -1
  47. data/tracks/ecmascript/exercises/queen-attack/package.json +2 -1
  48. data/tracks/ecmascript/exercises/raindrops/package.json +2 -1
  49. data/tracks/ecmascript/exercises/rna-transcription/package.json +2 -1
  50. data/tracks/ecmascript/exercises/robot-name/package.json +2 -1
  51. data/tracks/ecmascript/exercises/robot-simulator/package.json +2 -1
  52. data/tracks/ecmascript/exercises/roman-numerals/package.json +2 -1
  53. data/tracks/ecmascript/exercises/saddle-points/package.json +2 -1
  54. data/tracks/ecmascript/exercises/say/package.json +2 -1
  55. data/tracks/ecmascript/exercises/scrabble-score/package.json +2 -1
  56. data/tracks/ecmascript/exercises/secret-handshake/package.json +2 -1
  57. data/tracks/ecmascript/exercises/series/package.json +2 -1
  58. data/tracks/ecmascript/exercises/sieve/package.json +2 -1
  59. data/tracks/ecmascript/exercises/simple-cipher/package.json +2 -1
  60. data/tracks/ecmascript/exercises/space-age/package.json +2 -1
  61. data/tracks/ecmascript/exercises/strain/package.json +2 -1
  62. data/tracks/ecmascript/exercises/sum-of-multiples/package.json +2 -1
  63. data/tracks/ecmascript/exercises/triangle/package.json +2 -1
  64. data/tracks/ecmascript/exercises/trinary/package.json +2 -1
  65. data/tracks/ecmascript/exercises/two-bucket/package.json +2 -1
  66. data/tracks/ecmascript/exercises/word-count/package.json +2 -1
  67. data/tracks/ecmascript/exercises/wordy/package.json +2 -1
  68. data/tracks/ecmascript/package.json +2 -1
  69. data/tracks/go/.travis.yml +1 -1
  70. data/tracks/go/docs/LEARNING.md +1 -0
  71. data/tracks/java/config.json +6 -0
  72. data/tracks/java/exercises/settings.gradle +1 -0
  73. data/tracks/java/exercises/sum-of-multiples/build.gradle +17 -0
  74. data/tracks/java/exercises/sum-of-multiples/src/example/java/SumOfMultiples.java +27 -0
  75. data/tracks/java/exercises/sum-of-multiples/src/main/java/SumOfMultiples.java +4 -0
  76. data/tracks/java/exercises/sum-of-multiples/src/test/SumOfMultiplesTest.java +187 -0
  77. data/tracks/ocaml/exercises/word-count/example.ml +14 -19
  78. data/tracks/ocaml/exercises/word-count/test.ml +33 -18
  79. data/tracks/ocaml/tools/test-generator/src/codegen.ml +13 -6
  80. data/tracks/ocaml/tools/test-generator/src/codegen.mli +4 -2
  81. data/tracks/ocaml/tools/test-generator/src/model.ml +1 -1
  82. data/tracks/ocaml/tools/test-generator/src/parser.ml +1 -1
  83. data/tracks/ocaml/tools/test-generator/src/special_cases.ml +19 -0
  84. data/tracks/ocaml/tools/test-generator/src/special_cases.mli +6 -0
  85. data/tracks/ocaml/tools/test-generator/src/test_generator.ml +2 -2
  86. data/tracks/ocaml/tools/test-generator/templates/anagram/template.ml +1 -1
  87. data/tracks/ocaml/tools/test-generator/templates/bob/template.ml +1 -1
  88. data/tracks/ocaml/tools/test-generator/templates/hamming/template.ml +1 -1
  89. data/tracks/ocaml/tools/test-generator/templates/hello-world/template.ml +14 -0
  90. data/tracks/ocaml/tools/test-generator/templates/leap/template.ml +1 -1
  91. data/tracks/ocaml/tools/test-generator/templates/raindrops/template.ml +1 -1
  92. data/tracks/ocaml/tools/test-generator/templates/word-count/template.ml +3 -2
  93. data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +6 -3
  94. data/tracks/ocaml/tools/test-generator/{src → test}/leap.json +0 -0
  95. data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -9
  96. data/tracks/ocaml/tools/test-generator/test/special_cases_test.ml +25 -5
  97. data/tracks/perl5/.travis.yml +13 -3
  98. data/tracks/perl5/README.md +7 -2
  99. data/tracks/perl5/cpanfile +4 -0
  100. data/tracks/perl5/{accumulate → exercises/accumulate}/Example.pm +0 -0
  101. data/tracks/perl5/{accumulate → exercises/accumulate}/accumulate.t +6 -1
  102. data/tracks/perl5/{allergies → exercises/allergies}/Example.pm +0 -0
  103. data/tracks/perl5/{allergies → exercises/allergies}/allergies.t +7 -2
  104. data/tracks/perl5/{allergies → exercises/allergies}/cases.json +0 -0
  105. data/tracks/perl5/{anagram → exercises/anagram}/Example.pm +0 -0
  106. data/tracks/perl5/{anagram → exercises/anagram}/anagram.t +7 -2
  107. data/tracks/perl5/{anagram → exercises/anagram}/cases.json +0 -0
  108. data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/Example.pm +0 -0
  109. data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/cases.json +0 -0
  110. data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/cipher.t +7 -2
  111. data/tracks/perl5/{beer-song → exercises/beer-song}/Example.pm +0 -0
  112. data/tracks/perl5/{beer-song → exercises/beer-song}/beer.t +7 -2
  113. data/tracks/perl5/{beer-song → exercises/beer-song}/cases.json +0 -0
  114. data/tracks/perl5/{binary → exercises/binary}/Example.pm +0 -0
  115. data/tracks/perl5/{binary → exercises/binary}/binary.t +6 -1
  116. data/tracks/perl5/{binary-search → exercises/binary-search}/Example.pm +0 -0
  117. data/tracks/perl5/{binary-search → exercises/binary-search}/binary-search.t +6 -3
  118. data/tracks/perl5/{binary-search-tree → exercises/binary-search-tree}/Example.pm +0 -0
  119. data/tracks/perl5/{binary-search-tree → exercises/binary-search-tree}/binary_search_tree.t +5 -0
  120. data/tracks/perl5/{bob → exercises/bob}/Bob.pm +0 -0
  121. data/tracks/perl5/{bob → exercises/bob}/Example.pm +0 -0
  122. data/tracks/perl5/{bob → exercises/bob}/bob.t +6 -1
  123. data/tracks/perl5/{clock → exercises/clock}/Example.pm +0 -0
  124. data/tracks/perl5/{clock → exercises/clock}/clock.t +6 -1
  125. data/tracks/perl5/{crypto-square → exercises/crypto-square}/Example.pm +0 -0
  126. data/tracks/perl5/{crypto-square → exercises/crypto-square}/crypto.t +6 -1
  127. data/tracks/perl5/{custom-set → exercises/custom-set}/Example.pm +0 -0
  128. data/tracks/perl5/{custom-set → exercises/custom-set}/custom-set.t +5 -0
  129. data/tracks/perl5/{difference-of-squares → exercises/difference-of-squares}/Example.pm +0 -0
  130. data/tracks/perl5/{difference-of-squares → exercises/difference-of-squares}/difference_of_squares.t +6 -1
  131. data/tracks/perl5/{etl → exercises/etl}/Example.pm +0 -0
  132. data/tracks/perl5/{etl → exercises/etl}/etl.t +6 -1
  133. data/tracks/perl5/{food-chain → exercises/food-chain}/Example.pm +0 -0
  134. data/tracks/perl5/{food-chain → exercises/food-chain}/food_chain.t +7 -2
  135. data/tracks/perl5/{gigasecond → exercises/gigasecond}/Example.pm +0 -0
  136. data/tracks/perl5/{gigasecond → exercises/gigasecond}/gigasecond.t +5 -0
  137. data/tracks/perl5/{grade-school → exercises/grade-school}/Example.pm +0 -0
  138. data/tracks/perl5/{grade-school → exercises/grade-school}/grade_school.t +5 -0
  139. data/tracks/perl5/{grains → exercises/grains}/Example.pm +0 -0
  140. data/tracks/perl5/{grains → exercises/grains}/cases.json +0 -0
  141. data/tracks/perl5/{grains → exercises/grains}/grains.t +7 -2
  142. data/tracks/perl5/{hamming → exercises/hamming}/Example.pm +0 -0
  143. data/tracks/perl5/{hamming → exercises/hamming}/hamming.t +6 -1
  144. data/tracks/perl5/{hexadecimal → exercises/hexadecimal}/Example.pm +0 -0
  145. data/tracks/perl5/{hexadecimal → exercises/hexadecimal}/hexadecimal.t +6 -1
  146. data/tracks/perl5/{house → exercises/house}/Example.pm +0 -0
  147. data/tracks/perl5/{house → exercises/house}/house.t +6 -1
  148. data/tracks/perl5/{kindergarten-garden → exercises/kindergarten-garden}/Example.pm +0 -0
  149. data/tracks/perl5/{kindergarten-garden → exercises/kindergarten-garden}/kindergarten.t +6 -1
  150. data/tracks/perl5/{largest-series-product → exercises/largest-series-product}/Example.pm +0 -0
  151. data/tracks/perl5/{largest-series-product → exercises/largest-series-product}/series_product.t +6 -1
  152. data/tracks/perl5/{leap → exercises/leap}/Example.pm +0 -0
  153. data/tracks/perl5/{leap → exercises/leap}/leap.t +6 -0
  154. data/tracks/perl5/{linked-list → exercises/linked-list}/Example.pm +0 -0
  155. data/tracks/perl5/{linked-list → exercises/linked-list}/cases.json +0 -0
  156. data/tracks/perl5/{linked-list → exercises/linked-list}/deque.t +9 -4
  157. data/tracks/perl5/{list-ops → exercises/list-ops}/Example.pm +0 -0
  158. data/tracks/perl5/{list-ops → exercises/list-ops}/list-ops.t +6 -3
  159. data/tracks/perl5/{luhn → exercises/luhn}/Example.pm +0 -0
  160. data/tracks/perl5/{luhn → exercises/luhn}/luhn.t +7 -2
  161. data/tracks/perl5/{matrix → exercises/matrix}/Example.pm +0 -0
  162. data/tracks/perl5/{matrix → exercises/matrix}/matrix.t +6 -1
  163. data/tracks/perl5/{meetup → exercises/meetup}/Example.pm +0 -0
  164. data/tracks/perl5/{meetup → exercises/meetup}/meetup.t +7 -1
  165. data/tracks/perl5/{minesweeper → exercises/minesweeper}/Example.pm +0 -0
  166. data/tracks/perl5/{minesweeper → exercises/minesweeper}/minesweeper.t +5 -0
  167. data/tracks/perl5/{nucleotide-count → exercises/nucleotide-count}/Example.pm +0 -0
  168. data/tracks/perl5/{nucleotide-count → exercises/nucleotide-count}/nucleotide_count.t +5 -0
  169. data/tracks/perl5/{ocr-numbers → exercises/ocr-numbers}/Example.pm +0 -0
  170. data/tracks/perl5/{ocr-numbers → exercises/ocr-numbers}/ocr.t +7 -2
  171. data/tracks/perl5/{palindrome-products → exercises/palindrome-products}/Example.pm +0 -0
  172. data/tracks/perl5/{palindrome-products → exercises/palindrome-products}/palindrome.t +6 -1
  173. data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/Example.pm +0 -0
  174. data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/cases.json +0 -0
  175. data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/triangle.t +7 -2
  176. data/tracks/perl5/{phone-number → exercises/phone-number}/Example.pm +0 -0
  177. data/tracks/perl5/{phone-number → exercises/phone-number}/cases.json +0 -0
  178. data/tracks/perl5/{phone-number → exercises/phone-number}/phone.t +7 -2
  179. data/tracks/perl5/{pig-latin → exercises/pig-latin}/Example.pm +0 -0
  180. data/tracks/perl5/{pig-latin → exercises/pig-latin}/piglatin.t +6 -1
  181. data/tracks/perl5/{point-mutations → exercises/point-mutations}/Example.pm +0 -0
  182. data/tracks/perl5/{point-mutations → exercises/point-mutations}/cases.json +0 -0
  183. data/tracks/perl5/{point-mutations → exercises/point-mutations}/dna.t +7 -2
  184. data/tracks/perl5/{prime-factors → exercises/prime-factors}/Example.pm +0 -0
  185. data/tracks/perl5/{prime-factors → exercises/prime-factors}/cases.json +0 -0
  186. data/tracks/perl5/{prime-factors → exercises/prime-factors}/prime.t +7 -2
  187. data/tracks/perl5/{proverb → exercises/proverb}/Example.pm +0 -0
  188. data/tracks/perl5/{proverb → exercises/proverb}/cases.json +0 -0
  189. data/tracks/perl5/{proverb → exercises/proverb}/proverb.t +8 -2
  190. data/tracks/perl5/{pythagorean-triplet → exercises/pythagorean-triplet}/Example.pm +0 -0
  191. data/tracks/perl5/{pythagorean-triplet → exercises/pythagorean-triplet}/triplet.t +7 -2
  192. data/tracks/perl5/{queen-attack → exercises/queen-attack}/Example.pm +0 -0
  193. data/tracks/perl5/{queen-attack → exercises/queen-attack}/cases.json +0 -0
  194. data/tracks/perl5/{queen-attack → exercises/queen-attack}/queen.t +9 -4
  195. data/tracks/perl5/{raindrops → exercises/raindrops}/Example.pm +0 -0
  196. data/tracks/perl5/{raindrops → exercises/raindrops}/cases.json +0 -0
  197. data/tracks/perl5/{raindrops → exercises/raindrops}/raindrops.t +9 -4
  198. data/tracks/perl5/{rna-transcription → exercises/rna-transcription}/Example.pm +0 -0
  199. data/tracks/perl5/{rna-transcription → exercises/rna-transcription}/rna.t +8 -3
  200. data/tracks/perl5/{robot-name → exercises/robot-name}/Example.pm +0 -0
  201. data/tracks/perl5/{robot-name → exercises/robot-name}/robot_name.t +7 -1
  202. data/tracks/perl5/{robot-simulator → exercises/robot-simulator}/Example.pm +0 -0
  203. data/tracks/perl5/{robot-simulator → exercises/robot-simulator}/robot_simulator.t +6 -1
  204. data/tracks/perl5/{roman-numerals → exercises/roman-numerals}/Example.pm +0 -0
  205. data/tracks/perl5/{roman-numerals → exercises/roman-numerals}/roman.t +6 -1
  206. data/tracks/perl5/{saddle-points → exercises/saddle-points}/Example.pm +0 -0
  207. data/tracks/perl5/{saddle-points → exercises/saddle-points}/saddle_points.t +6 -1
  208. data/tracks/perl5/{say → exercises/say}/Example.pm +0 -0
  209. data/tracks/perl5/{say → exercises/say}/say.t +6 -1
  210. data/tracks/perl5/{scrabble-score → exercises/scrabble-score}/Example.pm +0 -0
  211. data/tracks/perl5/{scrabble-score → exercises/scrabble-score}/scrabble.t +6 -2
  212. data/tracks/perl5/{secret-handshake → exercises/secret-handshake}/Example.pm +0 -0
  213. data/tracks/perl5/{secret-handshake → exercises/secret-handshake}/handshake.t +6 -1
  214. data/tracks/perl5/{series → exercises/series}/Example.pm +0 -0
  215. data/tracks/perl5/{series → exercises/series}/series.t +5 -0
  216. data/tracks/perl5/{sieve → exercises/sieve}/Example.pm +0 -0
  217. data/tracks/perl5/{sieve → exercises/sieve}/sieve.t +6 -1
  218. data/tracks/perl5/{simple-cipher → exercises/simple-cipher}/Example.pm +0 -0
  219. data/tracks/perl5/{simple-cipher → exercises/simple-cipher}/cipher.t +6 -1
  220. data/tracks/perl5/{simple-linked-list → exercises/simple-linked-list}/Example.pm +0 -0
  221. data/tracks/perl5/{simple-linked-list → exercises/simple-linked-list}/simple_linked_list.t +5 -0
  222. data/tracks/perl5/{space-age → exercises/space-age}/Example.pm +0 -0
  223. data/tracks/perl5/{space-age → exercises/space-age}/space.t +6 -1
  224. data/tracks/perl5/{strain → exercises/strain}/Example.pm +0 -0
  225. data/tracks/perl5/{strain → exercises/strain}/strain.t +6 -1
  226. data/tracks/perl5/{sublist → exercises/sublist}/Example.pm +0 -0
  227. data/tracks/perl5/{sublist → exercises/sublist}/sublist.t +5 -0
  228. data/tracks/perl5/{sum-of-multiples → exercises/sum-of-multiples}/Example.pm +0 -0
  229. data/tracks/perl5/{sum-of-multiples → exercises/sum-of-multiples}/sum_of_multiples.t +6 -1
  230. data/tracks/perl5/{triangle → exercises/triangle}/Example.pm +0 -0
  231. data/tracks/perl5/{triangle → exercises/triangle}/cases.json +0 -0
  232. data/tracks/perl5/{triangle → exercises/triangle}/triangle.t +9 -4
  233. data/tracks/perl5/{trinary → exercises/trinary}/Example.pm +0 -0
  234. data/tracks/perl5/{trinary → exercises/trinary}/trinary.t +6 -1
  235. data/tracks/perl5/{twelve-days → exercises/twelve-days}/Example.pm +0 -0
  236. data/tracks/perl5/{twelve-days → exercises/twelve-days}/song.t +7 -2
  237. data/tracks/perl5/{word-count → exercises/word-count}/Example.pm +0 -0
  238. data/tracks/perl5/{word-count → exercises/word-count}/word_count.t +8 -3
  239. data/tracks/perl5/{wordy → exercises/wordy}/Example.pm +0 -0
  240. data/tracks/perl5/{wordy → exercises/wordy}/cases.json +0 -0
  241. data/tracks/perl5/{wordy → exercises/wordy}/wordy.t +9 -4
  242. data/tracks/perl6/.travis.yml +10 -3
  243. data/tracks/perl6/SETUP.md +7 -0
  244. data/tracks/perl6/docs/LEARNING.md +1 -1
  245. data/tracks/perl6/docs/RESOURCES.md +1 -2
  246. data/tracks/perl6/docs/{TOOLS.md → TESTS.md} +0 -0
  247. data/tracks/perl6/{accumulate → exercises/accumulate}/Example.pm +0 -0
  248. data/tracks/perl6/{accumulate → exercises/accumulate}/accumulate.t +1 -0
  249. data/tracks/perl6/{anagram → exercises/anagram}/Example.pm +0 -0
  250. data/tracks/perl6/{anagram → exercises/anagram}/anagram.t +1 -0
  251. data/tracks/perl6/{binary → exercises/binary}/Example.pm +0 -0
  252. data/tracks/perl6/{binary → exercises/binary}/binary.t +1 -0
  253. data/tracks/perl6/{bob → exercises/bob}/Example.pm +0 -0
  254. data/tracks/perl6/{bob → exercises/bob}/bob.t +1 -0
  255. data/tracks/perl6/{grains → exercises/grains}/Example.pm +0 -0
  256. data/tracks/perl6/{grains → exercises/grains}/grains.t +1 -0
  257. data/tracks/perl6/{leap → exercises/leap}/Example.pm +0 -0
  258. data/tracks/perl6/{leap → exercises/leap}/leap.t +1 -0
  259. data/tracks/perl6/{raindrops → exercises/raindrops}/Example.pm +0 -0
  260. data/tracks/perl6/{raindrops → exercises/raindrops}/raindrops.t +1 -0
  261. data/tracks/perl6/{rna-transcription → exercises/rna-transcription}/Example.pm +0 -0
  262. data/tracks/perl6/{rna-transcription → exercises/rna-transcription}/rna_transcription.t +5 -4
  263. data/tracks/perl6/{robot-name → exercises/robot-name}/Example.pm +0 -0
  264. data/tracks/perl6/{robot-name → exercises/robot-name}/robot.t +1 -0
  265. data/tracks/perl6/{scrabble-score → exercises/scrabble-score}/Example.pm +0 -0
  266. data/tracks/perl6/{scrabble-score → exercises/scrabble-score}/scrabble_score.t +1 -0
  267. data/tracks/perl6/{word-count → exercises/word-count}/Example.pm +0 -0
  268. data/tracks/perl6/{word-count → exercises/word-count}/word_count.t +1 -0
  269. data/tracks/ruby/exercises/accumulate/accumulate_test.rb +21 -0
  270. data/tracks/ruby/exercises/accumulate/example.rb +4 -0
  271. data/tracks/ruby/exercises/bob/bob_test.rb +1 -1
  272. data/tracks/ruby/exercises/bob/example.rb +3 -1
  273. data/tracks/ruby/exercises/bowling/example.rb +4 -4
  274. metadata +174 -169
  275. data/tracks/perl5/testall.pl +0 -18
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -18,7 +18,8 @@
18
18
  "yargs": "~3.27.0"
19
19
  },
20
20
  "scripts": {
21
- "test": "gulp lint test"
21
+ "test": "gulp test",
22
+ "lint-test": "gulp lint test"
22
23
  },
23
24
  "licenses": [
24
25
  "MIT"
@@ -26,7 +26,7 @@ go:
26
26
  - tip
27
27
 
28
28
  # Travis runs in a 64 bit environment but beginning with Go 1.5, building a
29
- # 32 bit target is as easy as specifying GOARCH. We test both to accomodate
29
+ # 32 bit target is as easy as specifying GOARCH. We test both to accommodate
30
30
  # users that might be running 32 bit environments and make sure our code
31
31
  # works for them.
32
32
  #
@@ -7,3 +7,4 @@ Exercism provides exercises and feedback but can be difficult to jump into for t
7
7
  * [Go Standard Library](http://golang.org/pkg/)
8
8
  * [Go Resources](http://golang.org/help)
9
9
  * [StackOverflow](http://stackoverflow.com/questions/tagged/go)
10
+ * [Awesome Go](https://github.com/avelino/awesome-go): [E-Books](https://github.com/avelino/awesome-go#e-books) and [Tutorials](https://github.com/avelino/awesome-go#tutorials)
@@ -39,6 +39,7 @@
39
39
  "luhn",
40
40
  "pig-latin",
41
41
  "simple-linked-list",
42
+ "sum-of-multiples",
42
43
  "linked-list",
43
44
  "nth-prime",
44
45
  "pascals-triangle",
@@ -225,6 +226,11 @@
225
226
  "difficulty": 1,
226
227
  "topics": []
227
228
  },
229
+ {
230
+ "slug": "sum-of-multiples",
231
+ "difficulty": 1,
232
+ "topics": []
233
+ },
228
234
  {
229
235
  "slug": "linked-list",
230
236
  "difficulty": 1,
@@ -37,6 +37,7 @@ include 'series'
37
37
  include 'sieve'
38
38
  include 'simple-cipher'
39
39
  include 'simple-linked-list'
40
+ include 'sum-of-multiples'
40
41
  include 'space-age'
41
42
  include 'strain'
42
43
  include 'triangle'
@@ -0,0 +1,17 @@
1
+ apply plugin: "java"
2
+ apply plugin: "eclipse"
3
+ apply plugin: "idea"
4
+
5
+ repositories {
6
+ mavenCentral()
7
+ }
8
+
9
+ dependencies {
10
+ testCompile "junit:junit:4.12"
11
+ }
12
+ test {
13
+ testLogging {
14
+ exceptionFormat = 'full'
15
+ events = ["passed", "failed", "skipped"]
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ import java.util.Arrays;
2
+ public class SumOfMultiples {
3
+
4
+
5
+ public int Sum(int number, int[] set) {
6
+
7
+ int sum = 0;
8
+ int count = 0;
9
+
10
+ for (int i = 1; i < number; i++) {
11
+
12
+ for (int j = 0; j < set.length; j++) {
13
+ if (i % set[j] == 0) {
14
+ count++;
15
+ }
16
+ }
17
+
18
+ if (count > 0) {
19
+ sum = sum + i;
20
+ count = 0;
21
+ }
22
+ }
23
+
24
+ return sum;
25
+ }
26
+
27
+ }
@@ -0,0 +1,4 @@
1
+ import java.util.Arrays;
2
+ public class SumOfMultiples {
3
+
4
+ }
@@ -0,0 +1,187 @@
1
+ import static org.junit.Assert.*;
2
+
3
+ import org.junit.Ignore;
4
+ import org.junit.Test;
5
+
6
+ public class SumOfMultiplesTest {
7
+
8
+
9
+ @Test
10
+ public void testSumOfMultiplesOf3and4UpToOne() {
11
+
12
+ SumOfMultiples mySum = new SumOfMultiples();
13
+ int[] set = {
14
+ 3,
15
+ 5
16
+ };
17
+ int output = mySum.Sum(1, set);
18
+ assertEquals(0, output);
19
+
20
+ }
21
+
22
+
23
+ @Test
24
+ @Ignore
25
+ public void testSumOfMultiplesOf3and5UpToFour() {
26
+
27
+ SumOfMultiples mySum = new SumOfMultiples();
28
+ int[] set = {
29
+ 3,
30
+ 5
31
+ };
32
+ int output = mySum.Sum(4, set);
33
+ assertEquals(3, output);
34
+
35
+ }
36
+
37
+
38
+ @Test
39
+ @Ignore
40
+ public void testSumOfMultiplesOf3and5UpToTen() {
41
+
42
+ SumOfMultiples mySum = new SumOfMultiples();
43
+ int[] set = {
44
+ 3,
45
+ 5
46
+ };
47
+ int output = mySum.Sum(10, set);
48
+ assertEquals(23, output);
49
+
50
+ }
51
+
52
+
53
+ @Test
54
+ @Ignore
55
+ public void testSumOfMultiplesOf3and5UpToOneHundred() {
56
+
57
+ SumOfMultiples mySum = new SumOfMultiples();
58
+ int[] set = {
59
+ 3,
60
+ 5
61
+ };
62
+ int output = mySum.Sum(100, set);
63
+ assertEquals(2318, output);
64
+
65
+ }
66
+
67
+
68
+ @Test
69
+ @Ignore
70
+ public void testSumOfMultiplesOf3and5UpToOneThousand() {
71
+
72
+ SumOfMultiples mySum = new SumOfMultiples();
73
+ int[] set = {
74
+ 3,
75
+ 5
76
+ };
77
+ int output = mySum.Sum(1000, set);
78
+ assertEquals(233168, output);
79
+
80
+ }
81
+
82
+
83
+ @Test
84
+ @Ignore
85
+ public void testSumOfMultiplesOf7and13and17UpToTwenty() {
86
+
87
+ SumOfMultiples mySum = new SumOfMultiples();
88
+ int[] set = {
89
+ 7,
90
+ 13,
91
+ 17
92
+ };
93
+ int output = mySum.Sum(20, set);
94
+ assertEquals(51, output);
95
+
96
+ }
97
+
98
+
99
+ @Test
100
+ @Ignore
101
+ public void testSumOfMultiplesOf4and6UpToFifteen() {
102
+
103
+ SumOfMultiples mySum = new SumOfMultiples();
104
+ int[] set = {
105
+ 4,
106
+ 6
107
+ };
108
+ int output = mySum.Sum(15, set);
109
+ assertEquals(30, output);
110
+
111
+ }
112
+
113
+
114
+ @Test
115
+ @Ignore
116
+ public void testSumOfMultiplesOf5and6and8UpToOneHundredFifty() {
117
+
118
+ SumOfMultiples mySum = new SumOfMultiples();
119
+ int[] set = {
120
+ 5,
121
+ 6,
122
+ 8
123
+ };
124
+ int output = mySum.Sum(150, set);
125
+ assertEquals(4419, output);
126
+
127
+ }
128
+
129
+
130
+ @Test
131
+ @Ignore
132
+ public void testSumOfMultiplesOf5and25UpToTwoHundredSeventyFive() {
133
+
134
+ SumOfMultiples mySum = new SumOfMultiples();
135
+ int[] set = {
136
+ 5,
137
+ 25
138
+ };
139
+ int output = mySum.Sum(51, set);
140
+ assertEquals(275, output);
141
+
142
+ }
143
+
144
+
145
+ @Test
146
+ @Ignore
147
+ public void testSumOfMultiplesOf43and47UpToTenThousand() {
148
+
149
+ SumOfMultiples mySum = new SumOfMultiples();
150
+ int[] set = {
151
+ 43,
152
+ 47
153
+ };
154
+ int output = mySum.Sum(10000, set);
155
+ assertEquals(2203160, output);
156
+
157
+ }
158
+
159
+
160
+ @Test
161
+ @Ignore
162
+ public void testSumOfMultiplesOfOneUpToOneHundred() {
163
+
164
+ SumOfMultiples mySum = new SumOfMultiples();
165
+ int[] set = {
166
+ 1
167
+ };
168
+ int output = mySum.Sum(100, set);
169
+ assertEquals(4950, output);
170
+
171
+ }
172
+
173
+
174
+ @Test
175
+ @Ignore
176
+ public void testSumOfMultiplesOfNoneUpToTenThousand() {
177
+
178
+ SumOfMultiples mySum = new SumOfMultiples();
179
+ int[] set = {};
180
+ int output = mySum.Sum(10000, set);
181
+ assertEquals(0, output);
182
+
183
+ }
184
+
185
+
186
+
187
+ }
@@ -1,22 +1,17 @@
1
1
  open Core.Std
2
2
 
3
- (* Get a list of all the words in the string.
4
- *
5
- * The list is in reverse order (more efficient to construct).
6
- *
7
- * This uses manual string slicing to avoid depending on any regex package
8
- * and because regexes are best avoided for simple tasks.
9
- *)
10
- let words (s: string): string list =
11
- let f i ((osi, l) as acc) c = match (osi, c) with
12
- | (None, c) when Char.is_alphanum c -> (Some i, l)
13
- | (Some si, c) when not (Char.is_alphanum c) -> (None, String.slice s si i :: l)
14
- | _ -> acc
15
- in
16
- match String.foldi ~init:(None, []) ~f s with
17
- | (None, l) -> l
18
- | (Some si, l) -> String.drop_prefix s si :: l
3
+ module SMap = String.Map
19
4
 
20
- let word_count s = words s
21
- |> List.map ~f:(fun x -> String.lowercase x, 1)
22
- |> String.Map.of_alist_fold ~init:0 ~f:(+)
5
+ let add_to_map wcs w =
6
+ SMap.update wcs w ~f:(fun k -> Option.value_map k ~default:1 ~f:((+) 1))
7
+
8
+ let normalize = function
9
+ | ch when Char.is_alphanum ch || ch = '\'' -> Char.lowercase ch
10
+ | _ -> ' '
11
+
12
+ let word_count s =
13
+ let s = String.substr_replace_all s ~pattern:" \'" ~with_:" " in
14
+ let s = String.substr_replace_all s ~pattern:"\' " ~with_:" " in
15
+ let s = String.map s ~f:normalize in
16
+ let split = List.filter (String.split s ~on:' ') ~f:(Fn.non String.is_empty) in
17
+ List.fold ~init:SMap.empty ~f:add_to_map split
@@ -8,23 +8,38 @@ let ae exp got _test_ctxt =
8
8
  let printer m = SMap.sexp_of_t Int.sexp_of_t m |> Sexp.to_string_hum ~indent:1 in
9
9
  assert_equal (SMap.of_alist_exn exp) got ~cmp:(SMap.equal (=)) ~printer
10
10
 
11
- let tests =
12
- ["one word">::
13
- ae [("word", 1)] (word_count "word");
14
- "one of each">::
15
- ae [("one", 1); ("of", 1); ("each", 1)] (word_count "one of each");
16
- "multiple occurences">::
17
- ae [("one", 1); ("fish", 4); ("two", 1); ("red", 1); ("blue", 1)]
18
- (word_count "one fish two fish red fish blue fish");
19
- "ignore punctuation">::
20
- ae [("car", 1); ("carpet", 1); ("as", 1); ("java", 1); ("javascript", 1)]
21
- (word_count "car : carpet@as'java : javascript!!&@$%^&");
22
- "include numbers">::
23
- ae [("testing", 2); ("1", 1); ("2", 1)]
24
- (word_count "testing, 1, 2 testing");
25
- "normalize case">::
26
- ae [("go", 3)] (word_count "go Go GO");
27
- ]
11
+ let tests = [
12
+ "count one word" >::
13
+ ae [("word", 1)]
14
+ (word_count "word");
15
+ "count one of each word" >::
16
+ ae [("one", 1); ("of", 1); ("each", 1)]
17
+ (word_count "one of each");
18
+ "multiple occurrences of a word" >::
19
+ ae [("one", 1); ("fish", 4); ("two", 1); ("red", 1); ("blue", 1)]
20
+ (word_count "one fish two fish red fish blue fish");
21
+ "handles cramped lists" >::
22
+ ae [("one", 1); ("two", 1); ("three", 1)]
23
+ (word_count "one,two,three");
24
+ "handles expanded lists" >::
25
+ ae [("one", 1); ("two", 1); ("three", 1)]
26
+ (word_count "one,\ntwo,\nthree");
27
+ "ignore punctuation" >::
28
+ ae [("car", 1); ("carpet", 1); ("as", 1); ("java", 1); ("javascript", 1)]
29
+ (word_count "car: carpet as java: javascript!!&@$%^&");
30
+ "include numbers" >::
31
+ ae [("testing", 2); ("1", 1); ("2", 1)]
32
+ (word_count "testing, 1, 2 testing");
33
+ "normalize case" >::
34
+ ae [("go", 3); ("stop", 2)]
35
+ (word_count "go Go GO Stop stop");
36
+ "with apostrophes" >::
37
+ ae [("first", 1); ("don't", 2); ("laugh", 1); ("then", 1); ("cry", 1)]
38
+ (word_count "First: don't laugh. Then: don't cry.");
39
+ "with_quotations" >::
40
+ ae [("joe", 1); ("can't", 1); ("tell", 1); ("between", 1); ("large", 2); ("and", 1)]
41
+ (word_count "Joe can't tell between 'large' and large.");
42
+ ]
28
43
 
29
44
  let () =
30
- run_test_tt_main ("word_count tests" >::: tests)
45
+ run_test_tt_main ("word_count tests" >::: tests)
@@ -2,16 +2,23 @@ open Core.Std
2
2
 
3
3
  open Model
4
4
 
5
- type fixup_function = key: string -> value: parameter -> string
5
+ type fixup_parameter_function = key: string -> value: parameter -> string
6
+
7
+ type edit_parameters_function = (string * string) list -> (string * string) list
8
+
9
+ let parameters_to_string pp: string =
10
+ List.map ~f:(fun (k,v) -> "(" ^ k ^ "," ^ v ^ ")") pp
11
+ |> String.concat ~sep:";"
6
12
 
7
13
  let replace_key (key: string) (value: string) (target: string): string =
8
14
  String.substr_replace_all target ~pattern:("$" ^ key) ~with_:value
9
15
 
10
- let rec replace_keys (f: fixup_function) (s: string) (c: case): string =
11
- let s = replace_key "name" c.name s in
16
+ let rec replace_keys (f: fixup_parameter_function) (ed: edit_parameters_function) (s: string) (c: case): string =
17
+ let s = replace_key "description" c.description s in
12
18
  let expected = f ~key:"expected" ~value:c.expected in
13
19
  let s = replace_key "expected" expected s in
14
- List.fold c.parameters ~init:s ~f:(fun s (k,v) -> replace_key k (parameter_to_string v) s)
20
+ let parameter_strings = ed @@ List.map ~f:(fun (k,p) -> (k,parameter_to_string p)) c.parameters in
21
+ List.fold parameter_strings ~init:s ~f:(fun s (k,v) -> replace_key k v s)
15
22
 
16
- let generate_code (f: fixup_function) template cases =
17
- Ok (List.map cases ~f:(replace_keys f template))
23
+ let generate_code (f: fixup_parameter_function) (ed: edit_parameters_function) template cases =
24
+ Ok (List.map cases ~f:(replace_keys f ed template))
@@ -2,6 +2,8 @@ open Core.Std
2
2
 
3
3
  open Model
4
4
 
5
- type fixup_function = key: string -> value: parameter -> string
5
+ type fixup_parameter_function = key: string -> value: parameter -> string
6
6
 
7
- val generate_code : fixup_function -> string -> case list -> (string list, string) Result.t
7
+ type edit_parameters_function = (string * string) list -> (string * string) list
8
+
9
+ val generate_code : fixup_parameter_function -> edit_parameters_function -> string -> case list -> (string list, string) Result.t
@@ -13,7 +13,7 @@ type parameter =
13
13
  type 'a elements = (string * 'a) list [@@deriving eq, show]
14
14
 
15
15
  type case = {
16
- name: string;
16
+ description: string;
17
17
  parameters: parameter elements;
18
18
  expected: parameter;
19
19
  } [@@deriving eq, show]
@@ -34,7 +34,7 @@ let parse_case_assoc (parameters: (string * json) list): (case, error) Result.t
34
34
  to_string_note BadDescription >>= fun description ->
35
35
  find "expected" BadExpected >>= fun expectedJson ->
36
36
  to_parameter expectedJson |> Result.of_option ~error:BadExpected >>= fun expected ->
37
- Ok {name = description; parameters = parse_parameters test_parameters; expected = expected}
37
+ Ok {description = description; parameters = parse_parameters test_parameters; expected = expected}
38
38
 
39
39
  let parse_case (s: json): (case, error) Result.t = match s with
40
40
  | `Assoc assoc -> parse_case_assoc assoc
@@ -7,6 +7,25 @@ let optional_int ~(none: int) = function
7
7
  | Int n -> "(Some " ^ Int.to_string n ^ ")"
8
8
  | _ -> failwith "can't handle non-int parameter"
9
9
 
10
+ let default_value ~(key: string) ~(value: string) (parameters: (string * string) list): (string * string) list =
11
+ if List.exists ~f:(fun (k, _) -> k = key) parameters
12
+ then parameters
13
+ else (key, value) :: parameters
14
+
15
+ let optional_string ~(f: string -> bool) (parameters: (string * string) list): (string * string) list =
16
+ let replace parameter =
17
+ let (k, v) = parameter in
18
+ if f k
19
+ then (k, "(Some \"" ^ v ^ "\")")
20
+ else parameter in
21
+ List.map ~f:replace parameters
22
+
10
23
  let fixup ~(stringify: parameter -> string) ~(slug: string) ~(key: string) ~(value: parameter) = match (slug, key) with
11
24
  | ("hamming", "expected") -> optional_int (-1) value
12
25
  | _ -> stringify value
26
+
27
+ let edit ~(slug: string) (parameters: (string * string) list) = match (slug, parameters) with
28
+ | ("hello-world", ps) -> default_value ~key:"name" ~value:"None"
29
+ @@ optional_string ~f:(fun _x -> true)
30
+ @@ parameters
31
+ | (_, ps) -> ps
@@ -2,6 +2,12 @@ open Core.Std
2
2
 
3
3
  open Model
4
4
 
5
+ val default_value : key: string -> value: string -> (string * string) list -> (string * string) list
6
+
5
7
  val optional_int : none: int -> parameter -> string
6
8
 
9
+ val optional_string : f: (string -> bool) -> (string * string) list -> (string * string) list
10
+
7
11
  val fixup : stringify:(parameter -> string) -> slug:string -> key:string -> value:parameter -> string
12
+
13
+ val edit : slug: string -> (string * string) list -> (string * string) list
@@ -45,13 +45,13 @@ let generate_code ~slug ~template_file ~canonical_data_file =
45
45
  let open Result.Monad_infix in
46
46
  template >>= fun (s,e,template) ->
47
47
  cases >>= fun cs ->
48
- let Ok substs = generate_code (fixup ~stringify:parameter_to_string ~slug) template cs in
48
+ let substs = Result.ok_or_failwith @@ generate_code (fixup ~stringify:parameter_to_string ~slug) (edit ~slug) template cs in
49
49
  Result.return (splice_in_filled_in_code s e ~template:template_file substs)
50
50
 
51
51
  let output_tests (files: (string * content * content) list) (output_folder: string): unit =
52
52
  let output_filepath name = output_folder ^ "/" ^ name ^ "/test.ml" in
53
53
  let output1 (slug,t,c) =
54
- let Ok code = generate_code slug t c in
54
+ let code = Result.ok_or_failwith @@ generate_code slug t c in
55
55
  Out_channel.write_all (output_filepath slug) code in
56
56
  List.iter files ~f:output1
57
57
 
@@ -8,7 +8,7 @@ let ae exp got _test_ctxt =
8
8
 
9
9
  let tests = [
10
10
  (* GENERATED-CODE
11
- "$name" >::
11
+ "$description" >::
12
12
  ae $expected (anagrams "$subject" $candidates);
13
13
  END GENERATED-CODE *)
14
14
  ]
@@ -6,7 +6,7 @@ let ae exp got _test_ctxt = assert_equal ~printer:String.to_string exp got
6
6
 
7
7
  let tests = [
8
8
  (* GENERATED-CODE
9
- "$name" >::
9
+ "$description" >::
10
10
  ae "$expected" (response_for "$input");
11
11
  END GENERATED-CODE *)
12
12
  ]
@@ -21,7 +21,7 @@ let hamdist a b = Hamming.hamming_distance (dna_of_string a) (dna_of_string b)
21
21
 
22
22
  let tests = [
23
23
  (* GENERATED-CODE
24
- "$name" >::
24
+ "$description" >::
25
25
  ae $expected (hamdist "$strand1" "$strand2");
26
26
  END GENERATED-CODE *)
27
27
  ]