trackler 2.2.1.40 → 2.2.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/exercises/dot-dsl/metadata.yml +1 -0
  5. data/problem-specifications/exercises/etl/metadata.yml +1 -0
  6. data/problem-specifications/exercises/isogram/canonical-data.json +3 -3
  7. data/problem-specifications/exercises/ocr-numbers/metadata.yml +1 -0
  8. data/problem-specifications/exercises/pascals-triangle/metadata.yml +1 -0
  9. data/problem-specifications/exercises/pov/metadata.yml +1 -0
  10. data/problem-specifications/exercises/rna-transcription/metadata.yml +1 -0
  11. data/problem-specifications/exercises/sgf-parsing/metadata.yml +1 -0
  12. data/tracks/c/exercises/all-your-base/src/example.c +14 -14
  13. data/tracks/c/exercises/all-your-base/src/example.h +2 -2
  14. data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +1 -1
  15. data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/{RNAtest.ceylon → RNATest.ceylon} +0 -0
  16. data/tracks/cfml/.git +1 -0
  17. data/tracks/cfml/.gitignore +5 -0
  18. data/tracks/cfml/.travis.yml +18 -0
  19. data/tracks/cfml/CONTRIBUTING.md +10 -0
  20. data/tracks/cfml/LICENSE +21 -0
  21. data/tracks/cfml/README.md +92 -0
  22. data/tracks/cfml/bin/fetch-configlet +32 -0
  23. data/tracks/cfml/config/exercise_readme.go.tmpl +16 -0
  24. data/tracks/cfml/config/maintainers.json +13 -0
  25. data/tracks/cfml/config.json +223 -0
  26. data/tracks/cfml/docs/ABOUT.md +10 -0
  27. data/tracks/cfml/docs/EXERCISE_README_INSERT.md +15 -0
  28. data/tracks/cfml/docs/INSTALLATION.md +35 -0
  29. data/tracks/cfml/docs/LEARNING.md +37 -0
  30. data/tracks/cfml/docs/RESOURCES.md +29 -0
  31. data/tracks/cfml/docs/SNIPPET.txt +8 -0
  32. data/tracks/cfml/docs/TESTS.md +13 -0
  33. data/tracks/cfml/exercises/acronym/.meta/HINTS.md +0 -0
  34. data/tracks/cfml/exercises/acronym/Acronym.cfc +13 -0
  35. data/tracks/cfml/exercises/acronym/AcronymTest.cfc +43 -0
  36. data/tracks/cfml/exercises/acronym/Solution.cfc +22 -0
  37. data/tracks/cfml/exercises/acronym/SolutionTest.cfc +7 -0
  38. data/tracks/cfml/exercises/acronym/TestRunner.cfc +103 -0
  39. data/tracks/cfml/exercises/acronym/box.json +8 -0
  40. data/tracks/cfml/exercises/acronym/index.cfm +37 -0
  41. data/tracks/cfml/exercises/atbash-cipher/.meta/HINTS.md +0 -0
  42. data/tracks/cfml/exercises/atbash-cipher/AtbashCipher.cfc +14 -0
  43. data/tracks/cfml/exercises/atbash-cipher/AtbashCipherTest.cfc +71 -0
  44. data/tracks/cfml/exercises/atbash-cipher/Solution.cfc +56 -0
  45. data/tracks/cfml/exercises/atbash-cipher/SolutionTest.cfc +7 -0
  46. data/tracks/cfml/exercises/atbash-cipher/TestRunner.cfc +103 -0
  47. data/tracks/cfml/exercises/atbash-cipher/box.json +8 -0
  48. data/tracks/cfml/exercises/atbash-cipher/index.cfm +37 -0
  49. data/tracks/cfml/exercises/bob/.meta/HINTS.md +0 -0
  50. data/tracks/cfml/exercises/bob/Bob.cfc +13 -0
  51. data/tracks/cfml/exercises/bob/BobTest.cfc +115 -0
  52. data/tracks/cfml/exercises/bob/Solution.cfc +27 -0
  53. data/tracks/cfml/exercises/bob/SolutionTest.cfc +7 -0
  54. data/tracks/cfml/exercises/bob/TestRunner.cfc +103 -0
  55. data/tracks/cfml/exercises/bob/box.json +8 -0
  56. data/tracks/cfml/exercises/bob/index.cfm +37 -0
  57. data/tracks/cfml/exercises/diamond/.meta/HINTS.md +0 -0
  58. data/tracks/cfml/exercises/diamond/Diamond.cfc +13 -0
  59. data/tracks/cfml/exercises/diamond/DiamondTest.cfc +35 -0
  60. data/tracks/cfml/exercises/diamond/Solution.cfc +35 -0
  61. data/tracks/cfml/exercises/diamond/SolutionTest.cfc +7 -0
  62. data/tracks/cfml/exercises/diamond/TestRunner.cfc +103 -0
  63. data/tracks/cfml/exercises/diamond/box.json +8 -0
  64. data/tracks/cfml/exercises/diamond/index.cfm +37 -0
  65. data/tracks/cfml/exercises/difference-of-squares/.meta/HINTS.md +0 -0
  66. data/tracks/cfml/exercises/difference-of-squares/DifferenceOfSquares.cfc +18 -0
  67. data/tracks/cfml/exercises/difference-of-squares/DifferenceOfSquaresTest.cfc +63 -0
  68. data/tracks/cfml/exercises/difference-of-squares/Solution.cfc +28 -0
  69. data/tracks/cfml/exercises/difference-of-squares/SolutionTest.cfc +7 -0
  70. data/tracks/cfml/exercises/difference-of-squares/TestRunner.cfc +103 -0
  71. data/tracks/cfml/exercises/difference-of-squares/box.json +8 -0
  72. data/tracks/cfml/exercises/difference-of-squares/index.cfm +37 -0
  73. data/tracks/cfml/exercises/flatten-array/.meta/HINTS.md +0 -0
  74. data/tracks/cfml/exercises/flatten-array/FlattenArray.cfc +13 -0
  75. data/tracks/cfml/exercises/flatten-array/FlattenArrayTest.cfc +42 -0
  76. data/tracks/cfml/exercises/flatten-array/Solution.cfc +26 -0
  77. data/tracks/cfml/exercises/flatten-array/SolutionTest.cfc +7 -0
  78. data/tracks/cfml/exercises/flatten-array/TestRunner.cfc +103 -0
  79. data/tracks/cfml/exercises/flatten-array/box.json +8 -0
  80. data/tracks/cfml/exercises/flatten-array/index.cfm +37 -0
  81. data/tracks/cfml/exercises/gigasecond/.meta/HINTS.md +0 -0
  82. data/tracks/cfml/exercises/gigasecond/Gigasecond.cfc +13 -0
  83. data/tracks/cfml/exercises/gigasecond/GigasecondTest.cfc +39 -0
  84. data/tracks/cfml/exercises/gigasecond/Solution.cfc +16 -0
  85. data/tracks/cfml/exercises/gigasecond/SolutionTest.cfc +7 -0
  86. data/tracks/cfml/exercises/gigasecond/TestRunner.cfc +103 -0
  87. data/tracks/cfml/exercises/gigasecond/box.json +8 -0
  88. data/tracks/cfml/exercises/gigasecond/index.cfm +37 -0
  89. data/tracks/cfml/exercises/grains/.meta/HINTS.md +0 -0
  90. data/tracks/cfml/exercises/grains/Grains.cfc +14 -0
  91. data/tracks/cfml/exercises/grains/GrainsTest.cfc +63 -0
  92. data/tracks/cfml/exercises/grains/Solution.cfc +22 -0
  93. data/tracks/cfml/exercises/grains/SolutionTest.cfc +7 -0
  94. data/tracks/cfml/exercises/grains/TestRunner.cfc +103 -0
  95. data/tracks/cfml/exercises/grains/box.json +8 -0
  96. data/tracks/cfml/exercises/grains/index.cfm +37 -0
  97. data/tracks/cfml/exercises/hamming/.meta/HINTS.md +0 -0
  98. data/tracks/cfml/exercises/hamming/Hamming.cfc +13 -0
  99. data/tracks/cfml/exercises/hamming/HammingTest.cfc +75 -0
  100. data/tracks/cfml/exercises/hamming/Solution.cfc +25 -0
  101. data/tracks/cfml/exercises/hamming/SolutionTest.cfc +7 -0
  102. data/tracks/cfml/exercises/hamming/TestRunner.cfc +103 -0
  103. data/tracks/cfml/exercises/hamming/box.json +8 -0
  104. data/tracks/cfml/exercises/hamming/index.cfm +37 -0
  105. data/tracks/cfml/exercises/hello-world/HelloWorld.cfc +13 -0
  106. data/tracks/cfml/exercises/hello-world/HelloWorldTest.cfc +18 -0
  107. data/tracks/cfml/exercises/hello-world/Solution.cfc +13 -0
  108. data/tracks/cfml/exercises/hello-world/SolutionTest.cfc +7 -0
  109. data/tracks/cfml/exercises/hello-world/TestRunner.cfc +103 -0
  110. data/tracks/cfml/exercises/hello-world/box.json +8 -0
  111. data/tracks/cfml/exercises/hello-world/index.cfm +37 -0
  112. data/tracks/cfml/exercises/isogram/.meta/HINTS.md +0 -0
  113. data/tracks/cfml/exercises/isogram/Isogram.cfc +13 -0
  114. data/tracks/cfml/exercises/isogram/IsogramTest.cfc +55 -0
  115. data/tracks/cfml/exercises/isogram/Solution.cfc +23 -0
  116. data/tracks/cfml/exercises/isogram/SolutionTest.cfc +7 -0
  117. data/tracks/cfml/exercises/isogram/TestRunner.cfc +103 -0
  118. data/tracks/cfml/exercises/isogram/box.json +8 -0
  119. data/tracks/cfml/exercises/isogram/index.cfm +37 -0
  120. data/tracks/cfml/exercises/largest-series-product/.meta/HINTS.md +0 -0
  121. data/tracks/cfml/exercises/largest-series-product/LargestSeriesProduct.cfc +13 -0
  122. data/tracks/cfml/exercises/largest-series-product/LargestSeriesProductTest.cfc +75 -0
  123. data/tracks/cfml/exercises/largest-series-product/Solution.cfc +41 -0
  124. data/tracks/cfml/exercises/largest-series-product/SolutionTest.cfc +7 -0
  125. data/tracks/cfml/exercises/largest-series-product/TestRunner.cfc +103 -0
  126. data/tracks/cfml/exercises/largest-series-product/box.json +8 -0
  127. data/tracks/cfml/exercises/largest-series-product/index.cfm +37 -0
  128. data/tracks/cfml/exercises/leap/Leap.cfc +15 -0
  129. data/tracks/cfml/exercises/leap/LeapTest.cfc +39 -0
  130. data/tracks/cfml/exercises/leap/README.md +33 -0
  131. data/tracks/cfml/exercises/leap/Solution.cfc +19 -0
  132. data/tracks/cfml/exercises/leap/SolutionTest.cfc +7 -0
  133. data/tracks/cfml/exercises/leap/TestRunner.cfc +103 -0
  134. data/tracks/cfml/exercises/leap/box.json +8 -0
  135. data/tracks/cfml/exercises/leap/index.cfm +37 -0
  136. data/tracks/cfml/exercises/luhn/.meta/HINTS.md +0 -0
  137. data/tracks/cfml/exercises/luhn/Luhn.cfc +13 -0
  138. data/tracks/cfml/exercises/luhn/LuhnTest.cfc +67 -0
  139. data/tracks/cfml/exercises/luhn/Solution.cfc +38 -0
  140. data/tracks/cfml/exercises/luhn/SolutionTest.cfc +7 -0
  141. data/tracks/cfml/exercises/luhn/TestRunner.cfc +103 -0
  142. data/tracks/cfml/exercises/luhn/box.json +8 -0
  143. data/tracks/cfml/exercises/luhn/index.cfm +37 -0
  144. data/tracks/cfml/exercises/nth-prime/.meta/HINTS.md +0 -0
  145. data/tracks/cfml/exercises/nth-prime/NthPrime.cfc +13 -0
  146. data/tracks/cfml/exercises/nth-prime/NthPrimeTest.cfc +35 -0
  147. data/tracks/cfml/exercises/nth-prime/Solution.cfc +33 -0
  148. data/tracks/cfml/exercises/nth-prime/SolutionTest.cfc +7 -0
  149. data/tracks/cfml/exercises/nth-prime/TestRunner.cfc +103 -0
  150. data/tracks/cfml/exercises/nth-prime/box.json +8 -0
  151. data/tracks/cfml/exercises/nth-prime/index.cfm +37 -0
  152. data/tracks/cfml/exercises/pangram/.meta/HINTS.md +0 -0
  153. data/tracks/cfml/exercises/pangram/Pangram.cfc +13 -0
  154. data/tracks/cfml/exercises/pangram/PangramTest.cfc +55 -0
  155. data/tracks/cfml/exercises/pangram/Solution.cfc +21 -0
  156. data/tracks/cfml/exercises/pangram/SolutionTest.cfc +7 -0
  157. data/tracks/cfml/exercises/pangram/TestRunner.cfc +103 -0
  158. data/tracks/cfml/exercises/pangram/box.json +8 -0
  159. data/tracks/cfml/exercises/pangram/index.cfm +37 -0
  160. data/tracks/cfml/exercises/pig-latin/.meta/HINTS.md +0 -0
  161. data/tracks/cfml/exercises/pig-latin/PigLatin.cfc +13 -0
  162. data/tracks/cfml/exercises/pig-latin/PigLatinTest.cfc +115 -0
  163. data/tracks/cfml/exercises/pig-latin/Solution.cfc +30 -0
  164. data/tracks/cfml/exercises/pig-latin/SolutionTest.cfc +7 -0
  165. data/tracks/cfml/exercises/pig-latin/TestRunner.cfc +103 -0
  166. data/tracks/cfml/exercises/pig-latin/box.json +8 -0
  167. data/tracks/cfml/exercises/pig-latin/index.cfm +37 -0
  168. data/tracks/cfml/exercises/raindrops/.meta/HINTS.md +0 -0
  169. data/tracks/cfml/exercises/raindrops/Raindrops.cfc +13 -0
  170. data/tracks/cfml/exercises/raindrops/RaindropsTest.cfc +87 -0
  171. data/tracks/cfml/exercises/raindrops/Solution.cfc +33 -0
  172. data/tracks/cfml/exercises/raindrops/SolutionTest.cfc +7 -0
  173. data/tracks/cfml/exercises/raindrops/TestRunner.cfc +103 -0
  174. data/tracks/cfml/exercises/raindrops/box.json +8 -0
  175. data/tracks/cfml/exercises/raindrops/index.cfm +37 -0
  176. data/tracks/cfml/exercises/rna-transcription/.meta/HINTS.md +0 -0
  177. data/tracks/cfml/exercises/rna-transcription/RnaTranscription.cfc +13 -0
  178. data/tracks/cfml/exercises/rna-transcription/RnaTranscriptionTest.cfc +47 -0
  179. data/tracks/cfml/exercises/rna-transcription/Solution.cfc +35 -0
  180. data/tracks/cfml/exercises/rna-transcription/SolutionTest.cfc +7 -0
  181. data/tracks/cfml/exercises/rna-transcription/TestRunner.cfc +103 -0
  182. data/tracks/cfml/exercises/rna-transcription/box.json +8 -0
  183. data/tracks/cfml/exercises/rna-transcription/index.cfm +37 -0
  184. data/tracks/cfml/exercises/saddle-points/.meta/HINTS.md +0 -0
  185. data/tracks/cfml/exercises/saddle-points/SaddlePoints.cfc +13 -0
  186. data/tracks/cfml/exercises/saddle-points/SaddlePointsTest.cfc +35 -0
  187. data/tracks/cfml/exercises/saddle-points/Solution.cfc +59 -0
  188. data/tracks/cfml/exercises/saddle-points/SolutionTest.cfc +7 -0
  189. data/tracks/cfml/exercises/saddle-points/TestRunner.cfc +103 -0
  190. data/tracks/cfml/exercises/saddle-points/box.json +8 -0
  191. data/tracks/cfml/exercises/saddle-points/index.cfm +37 -0
  192. data/tracks/cfml/exercises/scrabble-score/.meta/HINTS.md +0 -0
  193. data/tracks/cfml/exercises/scrabble-score/ScrabbleScore.cfc +13 -0
  194. data/tracks/cfml/exercises/scrabble-score/ScrabbleScoreTest.cfc +59 -0
  195. data/tracks/cfml/exercises/scrabble-score/Solution.cfc +50 -0
  196. data/tracks/cfml/exercises/scrabble-score/SolutionTest.cfc +7 -0
  197. data/tracks/cfml/exercises/scrabble-score/TestRunner.cfc +103 -0
  198. data/tracks/cfml/exercises/scrabble-score/box.json +8 -0
  199. data/tracks/cfml/exercises/scrabble-score/index.cfm +37 -0
  200. data/tracks/cfml/exercises/secret-handshake/.meta/HINTS.md +0 -0
  201. data/tracks/cfml/exercises/secret-handshake/SecretHandshake.cfc +13 -0
  202. data/tracks/cfml/exercises/secret-handshake/SecretHandshakeTest.cfc +63 -0
  203. data/tracks/cfml/exercises/secret-handshake/Solution.cfc +31 -0
  204. data/tracks/cfml/exercises/secret-handshake/SolutionTest.cfc +7 -0
  205. data/tracks/cfml/exercises/secret-handshake/TestRunner.cfc +103 -0
  206. data/tracks/cfml/exercises/secret-handshake/box.json +8 -0
  207. data/tracks/cfml/exercises/secret-handshake/index.cfm +37 -0
  208. data/tracks/cfml/exercises/space-age/.meta/HINTS.md +0 -0
  209. data/tracks/cfml/exercises/space-age/Solution.cfc +28 -0
  210. data/tracks/cfml/exercises/space-age/SolutionTest.cfc +7 -0
  211. data/tracks/cfml/exercises/space-age/SpaceAge.cfc +13 -0
  212. data/tracks/cfml/exercises/space-age/SpaceAgeTest.cfc +47 -0
  213. data/tracks/cfml/exercises/space-age/TestRunner.cfc +103 -0
  214. data/tracks/cfml/exercises/space-age/box.json +8 -0
  215. data/tracks/cfml/exercises/space-age/index.cfm +37 -0
  216. data/tracks/cfml/exercises/sum-of-multiples/.meta/HINTS.md +0 -0
  217. data/tracks/cfml/exercises/sum-of-multiples/Solution.cfc +27 -0
  218. data/tracks/cfml/exercises/sum-of-multiples/SolutionTest.cfc +7 -0
  219. data/tracks/cfml/exercises/sum-of-multiples/SumOfMultiples.cfc +13 -0
  220. data/tracks/cfml/exercises/sum-of-multiples/SumOfMultiplesTest.cfc +63 -0
  221. data/tracks/cfml/exercises/sum-of-multiples/TestRunner.cfc +103 -0
  222. data/tracks/cfml/exercises/sum-of-multiples/box.json +8 -0
  223. data/tracks/cfml/exercises/sum-of-multiples/index.cfm +37 -0
  224. data/tracks/cfml/exercises/triangle/.meta/HINTS.md +0 -0
  225. data/tracks/cfml/exercises/triangle/Solution.cfc +53 -0
  226. data/tracks/cfml/exercises/triangle/SolutionTest.cfc +7 -0
  227. data/tracks/cfml/exercises/triangle/TestRunner.cfc +103 -0
  228. data/tracks/cfml/exercises/triangle/Triangle.cfc +18 -0
  229. data/tracks/cfml/exercises/triangle/TriangleTest.cfc +95 -0
  230. data/tracks/cfml/exercises/triangle/box.json +8 -0
  231. data/tracks/cfml/exercises/triangle/index.cfm +37 -0
  232. data/tracks/cfml/exercises/word-count/.meta/HINTS.md +0 -0
  233. data/tracks/cfml/exercises/word-count/Solution.cfc +22 -0
  234. data/tracks/cfml/exercises/word-count/SolutionTest.cfc +7 -0
  235. data/tracks/cfml/exercises/word-count/TestRunner.cfc +103 -0
  236. data/tracks/cfml/exercises/word-count/WordCount.cfc +13 -0
  237. data/tracks/cfml/exercises/word-count/WordCountTest.cfc +55 -0
  238. data/tracks/cfml/exercises/word-count/box.json +8 -0
  239. data/tracks/cfml/exercises/word-count/index.cfm +37 -0
  240. data/tracks/cfml/img/icon.png +0 -0
  241. data/tracks/cfml/tasks/GenerateTests.cfc +179 -0
  242. data/tracks/cfml/tasks/ScaffoldExercise.cfc +85 -0
  243. data/tracks/cfml/tasks/TestAllSolutions.cfc +24 -0
  244. data/tracks/cfml/tasks/exercise_template/.meta/HINTS.md +0 -0
  245. data/tracks/cfml/tasks/exercise_template/@@name@@.cfc +13 -0
  246. data/tracks/cfml/tasks/exercise_template/@@name@@Test.cfc +15 -0
  247. data/tracks/cfml/tasks/exercise_template/Solution.cfc +6 -0
  248. data/tracks/cfml/tasks/exercise_template/SolutionTest.cfc +7 -0
  249. data/tracks/cfml/tasks/exercise_template/TestRunner.cfc +103 -0
  250. data/tracks/cfml/tasks/exercise_template/box.json +8 -0
  251. data/tracks/cfml/tasks/exercise_template/index.cfm +37 -0
  252. data/tracks/coldfusion/docs/ABOUT.md +8 -6
  253. data/tracks/csharp/docs/GENERATORS.md +7 -0
  254. data/tracks/csharp/exercises/clock/ClockTest.cs +15 -15
  255. data/tracks/csharp/exercises/nucleotide-count/Example.cs +10 -11
  256. data/tracks/csharp/exercises/nucleotide-count/NucleotideCount.cs +2 -7
  257. data/tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs +37 -47
  258. data/tracks/csharp/exercises/pig-latin/Example.cs +1 -1
  259. data/tracks/csharp/exercises/pig-latin/PigLatinTest.cs +19 -7
  260. data/tracks/csharp/exercises/sum-of-multiples/SumOfMultiplesTest.cs +7 -1
  261. data/tracks/csharp/exercises/tournament/Example.cs +1 -1
  262. data/tracks/csharp/exercises/tournament/TournamentTest.cs +151 -68
  263. data/tracks/csharp/exercises/triangle/Example.cs +26 -8
  264. data/tracks/csharp/exercises/triangle/Triangle.cs +16 -1
  265. data/tracks/csharp/exercises/triangle/TriangleTest.cs +44 -30
  266. data/tracks/csharp/generators/Exercise.cs +6 -1
  267. data/tracks/csharp/generators/Exercises/Clock.cs +17 -1
  268. data/tracks/csharp/generators/Exercises/NucleotideCount.cs +61 -0
  269. data/tracks/csharp/generators/Exercises/Tournament.cs +66 -0
  270. data/tracks/csharp/generators/Exercises/Triangle.cs +36 -0
  271. data/tracks/dart/config.json +15 -2
  272. data/tracks/dart/exercises/raindrops/lib/example.dart +23 -0
  273. data/tracks/dart/exercises/raindrops/lib/raindrops.dart +3 -0
  274. data/tracks/dart/exercises/raindrops/pubspec.lock +281 -0
  275. data/tracks/dart/exercises/raindrops/pubspec.yaml +3 -0
  276. data/tracks/dart/exercises/raindrops/test/raindrops_test.dart +94 -0
  277. data/tracks/delphi/exercises/pig-latin/uPigLatinExample.pas +1 -25
  278. data/tracks/haskell/config.json +9 -0
  279. data/tracks/haskell/exercises/acronym/README.md +0 -1
  280. data/tracks/haskell/exercises/all-your-base/README.md +1 -1
  281. data/tracks/haskell/exercises/allergies/README.md +0 -1
  282. data/tracks/haskell/exercises/alphametics/README.md +2 -2
  283. data/tracks/haskell/exercises/atbash-cipher/README.md +2 -1
  284. data/tracks/haskell/exercises/beer-song/README.md +1 -1
  285. data/tracks/haskell/exercises/binary/README.md +2 -0
  286. data/tracks/haskell/exercises/bowling/README.md +20 -6
  287. data/tracks/haskell/exercises/collatz-conjecture/README.md +1 -1
  288. data/tracks/haskell/exercises/connect/README.md +1 -1
  289. data/tracks/haskell/exercises/crypto-square/README.md +4 -4
  290. data/tracks/haskell/exercises/diamond/README.md +113 -0
  291. data/tracks/haskell/exercises/diamond/examples/success-standard/package.yaml +16 -0
  292. data/tracks/haskell/exercises/diamond/examples/success-standard/src/Diamond.hs +16 -0
  293. data/tracks/haskell/exercises/diamond/package.yaml +20 -0
  294. data/tracks/haskell/exercises/diamond/src/Diamond.hs +4 -0
  295. data/tracks/haskell/exercises/diamond/stack.yaml +1 -0
  296. data/tracks/haskell/exercises/diamond/test/Tests.hs +109 -0
  297. data/tracks/haskell/exercises/etl/README.md +3 -1
  298. data/tracks/haskell/exercises/food-chain/README.md +1 -1
  299. data/tracks/haskell/exercises/go-counting/README.md +1 -1
  300. data/tracks/haskell/exercises/grade-school/README.md +0 -1
  301. data/tracks/haskell/exercises/grains/README.md +0 -1
  302. data/tracks/haskell/exercises/house/README.md +1 -2
  303. data/tracks/haskell/exercises/isogram/README.md +2 -1
  304. data/tracks/haskell/exercises/kindergarten-garden/README.md +3 -3
  305. data/tracks/haskell/exercises/leap/README.md +1 -1
  306. data/tracks/haskell/exercises/linked-list/README.md +10 -10
  307. data/tracks/haskell/exercises/luhn/README.md +7 -7
  308. data/tracks/haskell/exercises/matrix/README.md +6 -4
  309. data/tracks/haskell/exercises/meetup/README.md +1 -2
  310. data/tracks/haskell/exercises/nucleotide-count/README.md +8 -22
  311. data/tracks/haskell/exercises/ocr-numbers/README.md +6 -6
  312. data/tracks/haskell/exercises/octal/README.md +6 -2
  313. data/tracks/haskell/exercises/palindrome-products/README.md +12 -6
  314. data/tracks/haskell/exercises/pangram/README.md +1 -1
  315. data/tracks/haskell/exercises/pascals-triangle/README.md +2 -2
  316. data/tracks/haskell/exercises/phone-number/README.md +3 -2
  317. data/tracks/haskell/exercises/pov/README.md +3 -3
  318. data/tracks/haskell/exercises/pythagorean-triplet/README.md +3 -3
  319. data/tracks/haskell/exercises/queen-attack/README.md +1 -1
  320. data/tracks/haskell/exercises/rna-transcription/README.md +1 -1
  321. data/tracks/haskell/exercises/roman-numerals/README.md +1 -1
  322. data/tracks/haskell/exercises/run-length-encoding/README.md +4 -4
  323. data/tracks/haskell/exercises/saddle-points/README.md +1 -1
  324. data/tracks/haskell/exercises/scrabble-score/README.md +3 -1
  325. data/tracks/haskell/exercises/secret-handshake/README.md +1 -1
  326. data/tracks/haskell/exercises/sgf-parsing/README.md +4 -4
  327. data/tracks/haskell/exercises/simple-cipher/README.md +1 -1
  328. data/tracks/haskell/exercises/spiral-matrix/README.md +2 -2
  329. data/tracks/haskell/exercises/triangle/README.md +9 -6
  330. data/tracks/haskell/exercises/trinary/README.md +1 -1
  331. data/tracks/haskell/exercises/word-count/README.md +1 -2
  332. data/tracks/haskell/exercises/wordy/README.md +0 -5
  333. data/tracks/java/config.json +56 -9
  334. data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +4 -4
  335. data/tracks/javascript/exercises/two-bucket/example.js +66 -69
  336. data/tracks/javascript/exercises/two-bucket/two-bucket.spec.js +18 -18
  337. data/tracks/julia/config.json +1 -0
  338. data/tracks/julia/docs/ABOUT.md +3 -8
  339. data/tracks/prolog/README.md +1 -1
  340. data/tracks/purescript/.travis.yml +1 -0
  341. data/tracks/purescript/README.md +9 -0
  342. data/tracks/purescript/bin/check-bower.sh +42 -0
  343. data/tracks/purescript/bin/test-separate.sh +46 -0
  344. data/tracks/python/README.md +2 -2
  345. data/tracks/python/exercises/all-your-base/all_your_base.py +2 -0
  346. data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +2 -2
  347. data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +2 -2
  348. data/tracks/python/exercises/complex-numbers/example.py +2 -2
  349. data/tracks/python/exercises/gigasecond/gigasecond.py +1 -1
  350. data/tracks/python/exercises/hamming/hamming.py +1 -1
  351. data/tracks/python/exercises/hexadecimal/hexadecimal.py +1 -1
  352. data/tracks/python/exercises/leap/leap.py +1 -1
  353. data/tracks/python/exercises/meetup/meetup.py +1 -1
  354. data/tracks/python/exercises/phone-number/example.py +4 -2
  355. data/tracks/python/exercises/phone-number/phone_number_test.py +47 -16
  356. data/tracks/python/exercises/pig-latin/pig_latin.py +1 -1
  357. data/tracks/python/exercises/scrabble-score/scrabble_score.py +1 -1
  358. data/tracks/python/exercises/wordy/wordy.py +1 -1
  359. data/tracks/scala/exercises/meetup/example.scala +29 -10
  360. data/tracks/scala/exercises/meetup/src/main/scala/Meetup.scala +23 -0
  361. data/tracks/scala/exercises/meetup/src/test/scala/MeetupTest.scala +273 -183
  362. data/tracks/sml/config.json +13 -0
  363. data/tracks/sml/exercises/anagram/README.md +21 -5
  364. data/tracks/sml/exercises/anagram/anagram.sml +2 -6
  365. data/tracks/sml/exercises/anagram/example.sml +29 -24
  366. data/tracks/sml/exercises/anagram/test.sml +56 -50
  367. data/tracks/sml/exercises/anagram/testlib.sml +159 -0
  368. data/tracks/sml/exercises/diamond/README.md +89 -0
  369. data/tracks/sml/exercises/diamond/diamond.sml +2 -0
  370. data/tracks/sml/exercises/diamond/example.sml +25 -0
  371. data/tracks/sml/exercises/diamond/test.sml +27 -0
  372. data/tracks/sml/exercises/diamond/testlib.sml +159 -0
  373. data/tracks/sml/exercises/raindrops/raindrops.sml +2 -2
  374. data/tracks/sml/exercises/raindrops/test.sml +66 -95
  375. data/tracks/sml/exercises/raindrops/testlib.sml +159 -0
  376. metadata +265 -3
@@ -1,11 +1,11 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
 
4
- public class DNA
4
+ public class NucleotideCount
5
5
  {
6
6
  public IDictionary<char, int> NucleotideCounts { get; private set; }
7
7
 
8
- public DNA(string sequence)
8
+ public NucleotideCount(string sequence)
9
9
  {
10
10
  InitializeNucleotideCounts(sequence);
11
11
  }
@@ -13,16 +13,15 @@ public class DNA
13
13
  private void InitializeNucleotideCounts(string sequence)
14
14
  {
15
15
  NucleotideCounts = new Dictionary<char, int> { { 'A', 0 }, { 'T', 0 }, { 'C', 0 }, { 'G', 0 } };
16
- foreach (var s in sequence)
17
- NucleotideCounts[s] += 1;
18
- }
19
-
20
- public int Count(char nucleotide)
21
- {
22
- int count;
23
- if (!NucleotideCounts.TryGetValue(nucleotide, out count))
16
+ try
17
+ {
18
+ foreach (var s in sequence)
19
+ NucleotideCounts[s] += 1;
20
+ }
21
+ catch (KeyNotFoundException)
22
+ {
24
23
  throw new InvalidNucleotideException();
25
- return count;
24
+ }
26
25
  }
27
26
  }
28
27
 
@@ -1,9 +1,9 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
 
4
- public class DNA
4
+ public class NucleotideCount
5
5
  {
6
- public DNA(string sequence)
6
+ public NucleotideCount(string sequence)
7
7
  {
8
8
  }
9
9
 
@@ -14,11 +14,6 @@ public class DNA
14
14
  throw new NotImplementedException("You need to implement this function.");
15
15
  }
16
16
  }
17
-
18
- public int Count(char nucleotide)
19
- {
20
- throw new NotImplementedException("You need to implement this function.");
21
- }
22
17
  }
23
18
 
24
19
  public class InvalidNucleotideException : Exception { }
@@ -1,65 +1,55 @@
1
- using System.Collections.Generic;
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
2
3
  using Xunit;
4
+ using System.Collections.Generic;
3
5
 
4
- public class NucleoTideCountTest
6
+ public class NucleotideCountTest
5
7
  {
6
8
  [Fact]
7
- public void Has_no_nucleotides()
8
- {
9
- var dna = new DNA("");
10
- var expected = new Dictionary<char, int> { { 'A', 0 }, { 'T', 0 }, { 'C', 0 }, { 'G', 0 } };
11
- Assert.Equal(expected, dna.NucleotideCounts);
12
- }
13
-
14
- [Fact(Skip = "Remove to run test")]
15
- public void Has_no_adenosine()
16
- {
17
- var dna = new DNA("");
18
- Assert.Equal(0, dna.Count('A'));
19
- }
20
-
21
- [Fact(Skip = "Remove to run test")]
22
- public void Repetitive_cytidine_gets_counts()
23
- {
24
- var dna = new DNA("CCCCC");
25
- Assert.Equal(5, dna.Count('C'));
26
- }
27
-
28
- [Fact(Skip = "Remove to run test")]
29
- public void Repetitive_sequence_has_only_guanosine()
30
- {
31
- var dna = new DNA("GGGGGGGG");
32
- var expected = new Dictionary<char, int> { { 'A', 0 }, { 'T', 0 }, { 'C', 0 }, { 'G', 8 } };
33
- Assert.Equal(expected, dna.NucleotideCounts);
34
- }
35
-
36
- [Fact(Skip = "Remove to run test")]
37
- public void Counts_only_thymidine()
9
+ public void Empty_strand()
38
10
  {
39
- var dna = new DNA("GGGGTAACCCGG");
40
- Assert.Equal(1, dna.Count('T'));
11
+ var sut = new NucleotideCount("");
12
+ var expected = new Dictionary<char, int>
13
+ {
14
+ ['A'] = 0,
15
+ ['C'] = 0,
16
+ ['G'] = 0,
17
+ ['T'] = 0
18
+ };
19
+ Assert.Equal(expected, sut.NucleotideCounts);
41
20
  }
42
21
 
43
22
  [Fact(Skip = "Remove to run test")]
44
- public void Counts_a_nucleotide_only_once()
23
+ public void Strand_with_repeated_nucleotide()
45
24
  {
46
- var dna = new DNA("GGTTGG");
47
- dna.Count('T');
48
- Assert.Equal(2, dna.Count('T'));
25
+ var sut = new NucleotideCount("GGGGGGG");
26
+ var expected = new Dictionary<char, int>
27
+ {
28
+ ['A'] = 0,
29
+ ['C'] = 0,
30
+ ['G'] = 7,
31
+ ['T'] = 0
32
+ };
33
+ Assert.Equal(expected, sut.NucleotideCounts);
49
34
  }
50
35
 
51
36
  [Fact(Skip = "Remove to run test")]
52
- public void Validates_nucleotides()
37
+ public void Strand_with_multiple_nucleotides()
53
38
  {
54
- var dna = new DNA("GGTTGG");
55
- Assert.Throws<InvalidNucleotideException>(() => dna.Count('X'));
39
+ var sut = new NucleotideCount("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
40
+ var expected = new Dictionary<char, int>
41
+ {
42
+ ['A'] = 20,
43
+ ['C'] = 12,
44
+ ['G'] = 17,
45
+ ['T'] = 21
46
+ };
47
+ Assert.Equal(expected, sut.NucleotideCounts);
56
48
  }
57
49
 
58
50
  [Fact(Skip = "Remove to run test")]
59
- public void Counts_all_nucleotides()
51
+ public void Strand_with_invalid_nucleotides()
60
52
  {
61
- var dna = new DNA("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
62
- var expected = new Dictionary<char, int> { { 'A', 20 }, { 'T', 21 }, { 'C', 12 }, { 'G', 17 } };
63
- Assert.Equal(expected, dna.NucleotideCounts);
53
+ Assert.Throws<InvalidNucleotideException>(() => new NucleotideCount("AGXXACT"));
64
54
  }
65
- }
55
+ }
@@ -14,7 +14,7 @@ public class PigLatin
14
14
  return word + "ay";
15
15
  if (WordStartsWithPrefixes(word, "thr", "sch"))
16
16
  return word.Substring(3) + word.Substring(0, 3) + "ay";
17
- if (WordStartsWithPrefixes(word, "ch", "qu", "th"))
17
+ if (WordStartsWithPrefixes(word, "ch", "qu", "th", "rh"))
18
18
  return word.Substring(2) + word.Substring(0, 2) + "ay";
19
19
  if (WordStartsWithConsonantAndQu(word))
20
20
  return word.Substring(3) + word[0] + "quay";
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -52,12 +52,6 @@ public class PigLatinTest
52
52
  Assert.Equal("oalakay", PigLatin.Translate("koala"));
53
53
  }
54
54
 
55
- [Fact(Skip = "Remove to run test")]
56
- public void Word_beginning_with_y()
57
- {
58
- Assert.Equal("ellowyay", PigLatin.Translate("yellow"));
59
- }
60
-
61
55
  [Fact(Skip = "Remove to run test")]
62
56
  public void Word_beginning_with_x()
63
57
  {
@@ -118,6 +112,24 @@ public class PigLatinTest
118
112
  Assert.Equal("xrayay", PigLatin.Translate("xray"));
119
113
  }
120
114
 
115
+ [Fact(Skip = "Remove to run test")]
116
+ public void Y_is_treated_like_a_consonant_at_the_beginning_of_a_word()
117
+ {
118
+ Assert.Equal("ellowyay", PigLatin.Translate("yellow"));
119
+ }
120
+
121
+ [Fact(Skip = "Remove to run test")]
122
+ public void Y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster()
123
+ {
124
+ Assert.Equal("ythmrhay", PigLatin.Translate("rhythm"));
125
+ }
126
+
127
+ [Fact(Skip = "Remove to run test")]
128
+ public void Y_as_second_letter_in_two_letter_word()
129
+ {
130
+ Assert.Equal("ymay", PigLatin.Translate("my"));
131
+ }
132
+
121
133
  [Fact(Skip = "Remove to run test")]
122
134
  public void A_whole_phrase()
123
135
  {
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -16,6 +16,12 @@ public class SumOfMultiplesTest
16
16
  Assert.Equal(3, SumOfMultiples.Sum(new[] { 3, 5 }, 4));
17
17
  }
18
18
 
19
+ [Fact(Skip = "Remove to run test")]
20
+ public void Multiples_of_3_up_to_7()
21
+ {
22
+ Assert.Equal(9, SumOfMultiples.Sum(new[] { 3 }, 7));
23
+ }
24
+
19
25
  [Fact(Skip = "Remove to run test")]
20
26
  public void Multiples_of_3_or_5_up_to_10()
21
27
  {
@@ -84,7 +84,7 @@ public class Tournament
84
84
  writer.WriteLine(
85
85
  "{0,-30:S} | {1,2:D} | {2,2:D} | {3,2:D} | {4,2:D} | {5,2:D}",
86
86
  "Team", "MP", "W", "D", "L", "P");
87
- foreach (var pair in this.teams.OrderByDescending(pair => pair.Value.Score)) {
87
+ foreach (var pair in this.teams.OrderByDescending(pair => pair.Value.Score).ThenBy(pair => pair.Key)) {
88
88
  writer.WriteLine(
89
89
  "{0,-30:S} | {1,2:D} | {2,2:D} | {3,2:D} | {4,2:D} | {5,2:D}",
90
90
  pair.Key, pair.Value.Played, pair.Value.Wins,
@@ -1,87 +1,170 @@
1
- using System;
1
+ // This file was auto-generated based on version 1.3.0 of the canonical data.
2
+
3
+ using Xunit;
4
+ using System;
2
5
  using System.IO;
3
6
  using System.Text;
4
- using Xunit;
5
7
 
6
8
  public class TournamentTest
7
9
  {
8
- readonly string input1 =
9
- "Αllegoric Alaskians;Blithering Badgers;win" + Environment.NewLine +
10
- "Devastating Donkeys;Courageous Californians;draw" + Environment.NewLine +
11
- "Devastating Donkeys;Αllegoric Alaskians;win" + Environment.NewLine +
12
- "Courageous Californians;Blithering Badgers;loss" + Environment.NewLine +
13
- "Blithering Badgers;Devastating Donkeys;loss" + Environment.NewLine +
14
- "Αllegoric Alaskians;Courageous Californians;win".Trim();
15
-
16
- private readonly string input2 =
17
- "Allegoric Alaskians;Blithering Badgers;win" + Environment.NewLine +
18
- "Devastating Donkeys_Courageous Californians;draw" + Environment.NewLine +
19
- "Devastating Donkeys;Allegoric Alaskians;win" + Environment.NewLine +
20
- "" + Environment.NewLine +
21
- "Courageous Californians;Blithering Badgers;loss" + Environment.NewLine +
22
- "Bla;Bla;Bla" + Environment.NewLine +
23
- "Blithering Badgers;Devastating Donkeys;loss" + Environment.NewLine +
24
- "# Yackity yackity yack" + Environment.NewLine +
25
- "Allegoric Alaskians;Courageous Californians;win" + Environment.NewLine +
26
- "Devastating Donkeys;Courageous Californians;draw" + Environment.NewLine +
27
- "Devastating Donkeys@Courageous Californians;draw"; // Trim() omitted by design
28
-
29
- private readonly string input3 =
30
- "Allegoric Alaskians;Blithering Badgers;win" + Environment.NewLine +
31
- "Devastating Donkeys;Allegoric Alaskians;win" + Environment.NewLine +
32
- "Courageous Californians;Blithering Badgers;loss" + Environment.NewLine +
33
- "Allegoric Alaskians;Courageous Californians;win".Trim();
34
-
35
- readonly string expected1 =
36
- "Team | MP | W | D | L | P" + Environment.NewLine +
37
- "Devastating Donkeys | 3 | 2 | 1 | 0 | 7" + Environment.NewLine +
38
- "Αllegoric Alaskians | 3 | 2 | 0 | 1 | 6" + Environment.NewLine +
39
- "Blithering Badgers | 3 | 1 | 0 | 2 | 3" + Environment.NewLine +
40
- "Courageous Californians | 3 | 0 | 1 | 2 | 1".Trim();
41
-
42
- private readonly string expected2 =
43
- "Team | MP | W | D | L | P" + Environment.NewLine +
44
- "Devastating Donkeys | 3 | 2 | 1 | 0 | 7" + Environment.NewLine +
45
- "Allegoric Alaskians | 3 | 2 | 0 | 1 | 6" + Environment.NewLine +
46
- "Blithering Badgers | 3 | 1 | 0 | 2 | 3" + Environment.NewLine +
47
- "Courageous Californians | 3 | 0 | 1 | 2 | 1".Trim();
48
-
49
- private readonly string expected3 =
50
- "Team | MP | W | D | L | P" + Environment.NewLine +
51
- "Allegoric Alaskians | 3 | 2 | 0 | 1 | 6" + Environment.NewLine +
52
- "Blithering Badgers | 2 | 1 | 0 | 1 | 3" + Environment.NewLine +
53
- "Devastating Donkeys | 1 | 1 | 0 | 0 | 3" + Environment.NewLine +
54
- "Courageous Californians | 2 | 0 | 0 | 2 | 0".Trim();
10
+ [Fact]
11
+ public void Just_the_header_if_no_input()
12
+ {
13
+ var input = string.Empty;
14
+ var expected = "Team | MP | W | D | L | P".Trim();
15
+ Assert.Equal(expected, RunTally(input).Trim());
16
+ }
55
17
 
56
- private string RunTally(string input)
18
+ [Fact(Skip = "Remove to run test")]
19
+ public void A_win_is_three_points_a_loss_is_zero_points()
57
20
  {
58
- var encoding = new UTF8Encoding();
59
-
60
- using (var inStream = new MemoryStream(encoding.GetBytes(input)))
61
- {
62
- using (var outStream = new MemoryStream())
63
- {
64
- Tournament.Tally(inStream, outStream);
65
- return encoding.GetString(outStream.ToArray());
66
- }
67
- }
21
+ var input = "Allegoric Alaskans;Blithering Badgers;win".Trim();
22
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
23
+ "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3" + Environment.NewLine +
24
+ "Blithering Badgers | 1 | 0 | 0 | 1 | 0"
25
+ .Trim();
26
+ Assert.Equal(expected, RunTally(input).Trim());
68
27
  }
69
28
 
70
- [Fact]
71
- public void Test_good()
29
+ [Fact(Skip = "Remove to run test")]
30
+ public void A_win_can_also_be_expressed_as_a_loss()
31
+ {
32
+ var input = "Blithering Badgers;Allegoric Alaskans;loss".Trim();
33
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
34
+ "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3" + Environment.NewLine +
35
+ "Blithering Badgers | 1 | 0 | 0 | 1 | 0"
36
+ .Trim();
37
+ Assert.Equal(expected, RunTally(input).Trim());
38
+ }
39
+
40
+ [Fact(Skip = "Remove to run test")]
41
+ public void A_different_team_can_win()
42
+ {
43
+ var input = "Blithering Badgers;Allegoric Alaskans;win".Trim();
44
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
45
+ "Blithering Badgers | 1 | 1 | 0 | 0 | 3" + Environment.NewLine +
46
+ "Allegoric Alaskans | 1 | 0 | 0 | 1 | 0"
47
+ .Trim();
48
+ Assert.Equal(expected, RunTally(input).Trim());
49
+ }
50
+
51
+ [Fact(Skip = "Remove to run test")]
52
+ public void A_draw_is_one_point_each()
53
+ {
54
+ var input = "Allegoric Alaskans;Blithering Badgers;draw".Trim();
55
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
56
+ "Allegoric Alaskans | 1 | 0 | 1 | 0 | 1" + Environment.NewLine +
57
+ "Blithering Badgers | 1 | 0 | 1 | 0 | 1"
58
+ .Trim();
59
+ Assert.Equal(expected, RunTally(input).Trim());
60
+ }
61
+
62
+ [Fact(Skip = "Remove to run test")]
63
+ public void There_can_be_more_than_one_match()
64
+ {
65
+ var input = "Allegoric Alaskans;Blithering Badgers;win" + Environment.NewLine +
66
+ "Allegoric Alaskans;Blithering Badgers;win"
67
+ .Trim();
68
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
69
+ "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6" + Environment.NewLine +
70
+ "Blithering Badgers | 2 | 0 | 0 | 2 | 0"
71
+ .Trim();
72
+ Assert.Equal(expected, RunTally(input).Trim());
73
+ }
74
+
75
+ [Fact(Skip = "Remove to run test")]
76
+ public void There_can_be_more_than_one_winner()
77
+ {
78
+ var input = "Allegoric Alaskans;Blithering Badgers;loss" + Environment.NewLine +
79
+ "Allegoric Alaskans;Blithering Badgers;win"
80
+ .Trim();
81
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
82
+ "Allegoric Alaskans | 2 | 1 | 0 | 1 | 3" + Environment.NewLine +
83
+ "Blithering Badgers | 2 | 1 | 0 | 1 | 3"
84
+ .Trim();
85
+ Assert.Equal(expected, RunTally(input).Trim());
86
+ }
87
+
88
+ [Fact(Skip = "Remove to run test")]
89
+ public void There_can_be_more_than_two_teams()
90
+ {
91
+ var input = "Allegoric Alaskans;Blithering Badgers;win" + Environment.NewLine +
92
+ "Blithering Badgers;Courageous Californians;win" + Environment.NewLine +
93
+ "Courageous Californians;Allegoric Alaskans;loss"
94
+ .Trim();
95
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
96
+ "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6" + Environment.NewLine +
97
+ "Blithering Badgers | 2 | 1 | 0 | 1 | 3" + Environment.NewLine +
98
+ "Courageous Californians | 2 | 0 | 0 | 2 | 0"
99
+ .Trim();
100
+ Assert.Equal(expected, RunTally(input).Trim());
101
+ }
102
+
103
+ [Fact(Skip = "Remove to run test")]
104
+ public void Typical_input()
72
105
  {
73
- Assert.Equal(expected1, RunTally(input1).Trim());
106
+ var input = "Allegoric Alaskans;Blithering Badgers;win" + Environment.NewLine +
107
+ "Devastating Donkeys;Courageous Californians;draw" + Environment.NewLine +
108
+ "Devastating Donkeys;Allegoric Alaskans;win" + Environment.NewLine +
109
+ "Courageous Californians;Blithering Badgers;loss" + Environment.NewLine +
110
+ "Blithering Badgers;Devastating Donkeys;loss" + Environment.NewLine +
111
+ "Allegoric Alaskans;Courageous Californians;win"
112
+ .Trim();
113
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
114
+ "Devastating Donkeys | 3 | 2 | 1 | 0 | 7" + Environment.NewLine +
115
+ "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6" + Environment.NewLine +
116
+ "Blithering Badgers | 3 | 1 | 0 | 2 | 3" + Environment.NewLine +
117
+ "Courageous Californians | 3 | 0 | 1 | 2 | 1"
118
+ .Trim();
119
+ Assert.Equal(expected, RunTally(input).Trim());
74
120
  }
75
121
 
76
122
  [Fact(Skip = "Remove to run test")]
77
- public void Test_ignore_bad_lines()
123
+ public void Incomplete_competition_not_all_pairs_have_played_()
78
124
  {
79
- Assert.Equal(expected2, RunTally(input2).Trim());
125
+ var input = "Allegoric Alaskans;Blithering Badgers;loss" + Environment.NewLine +
126
+ "Devastating Donkeys;Allegoric Alaskans;loss" + Environment.NewLine +
127
+ "Courageous Californians;Blithering Badgers;draw" + Environment.NewLine +
128
+ "Allegoric Alaskans;Courageous Californians;win"
129
+ .Trim();
130
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
131
+ "Allegoric Alaskans | 3 | 2 | 0 | 1 | 6" + Environment.NewLine +
132
+ "Blithering Badgers | 2 | 1 | 1 | 0 | 4" + Environment.NewLine +
133
+ "Courageous Californians | 2 | 0 | 1 | 1 | 1" + Environment.NewLine +
134
+ "Devastating Donkeys | 1 | 0 | 0 | 1 | 0"
135
+ .Trim();
136
+ Assert.Equal(expected, RunTally(input).Trim());
80
137
  }
81
138
 
82
139
  [Fact(Skip = "Remove to run test")]
83
- public void Test_incomplete_competition()
140
+ public void Ties_broken_alphabetically()
84
141
  {
85
- Assert.Equal(expected3, RunTally(input3).Trim());
142
+ var input = "Courageous Californians;Devastating Donkeys;win" + Environment.NewLine +
143
+ "Allegoric Alaskans;Blithering Badgers;win" + Environment.NewLine +
144
+ "Devastating Donkeys;Allegoric Alaskans;loss" + Environment.NewLine +
145
+ "Courageous Californians;Blithering Badgers;win" + Environment.NewLine +
146
+ "Blithering Badgers;Devastating Donkeys;draw" + Environment.NewLine +
147
+ "Allegoric Alaskans;Courageous Californians;draw"
148
+ .Trim();
149
+ var expected = "Team | MP | W | D | L | P" + Environment.NewLine +
150
+ "Allegoric Alaskans | 3 | 2 | 1 | 0 | 7" + Environment.NewLine +
151
+ "Courageous Californians | 3 | 2 | 1 | 0 | 7" + Environment.NewLine +
152
+ "Blithering Badgers | 3 | 0 | 1 | 2 | 1" + Environment.NewLine +
153
+ "Devastating Donkeys | 3 | 0 | 1 | 2 | 1"
154
+ .Trim();
155
+ Assert.Equal(expected, RunTally(input).Trim());
156
+ }
157
+
158
+ private string RunTally(string input)
159
+ {
160
+ var encoding = new UTF8Encoding();
161
+ using (var inStream = new MemoryStream(encoding.GetBytes(input)))
162
+ {
163
+ using (var outStream = new MemoryStream())
164
+ {
165
+ Tournament.Tally(inStream, outStream);
166
+ return encoding.GetString(outStream.ToArray());
167
+ }
168
+ }
86
169
  }
87
- }
170
+ }
@@ -5,18 +5,36 @@ public enum TriangleKind
5
5
  {
6
6
  Equilateral,
7
7
  Isosceles,
8
- Scalene
8
+ Scalene,
9
+ Invalid
9
10
  }
10
11
 
11
12
  public static class Triangle
12
13
  {
13
- public static TriangleKind Kind(decimal side1, decimal side2, decimal side3)
14
+
15
+ public static bool IsScalene(double side1, double side2, double side3)
16
+ {
17
+ return Kind(side1, side2, side3) == TriangleKind.Scalene;
18
+ }
19
+
20
+ public static bool IsIsosceles(double side1, double side2, double side3)
21
+ {
22
+ var triangle = Kind(side1, side2, side3);
23
+ return triangle == TriangleKind.Isosceles || triangle == TriangleKind.Equilateral;
24
+ }
25
+
26
+ public static bool IsEquilateral(double side1, double side2, double side3)
27
+ {
28
+ return Kind(side1, side2, side3) == TriangleKind.Equilateral;
29
+ }
30
+
31
+ private static TriangleKind Kind(double side1, double side2, double side3)
14
32
  {
15
33
  if (AllSidesAreZero(side1, side2, side3) ||
16
34
  HasImpossibleSides(side1, side2, side3) ||
17
35
  ViolatesTriangleInequality(side1, side2, side3))
18
36
  {
19
- throw new TriangleException();
37
+ return TriangleKind.Invalid;
20
38
  }
21
39
 
22
40
  int uniqueSides = UniqueSides(side1, side2, side3);
@@ -27,24 +45,24 @@ public static class Triangle
27
45
  return TriangleKind.Scalene;
28
46
  }
29
47
 
30
- private static bool AllSidesAreZero(decimal side1, decimal side2, decimal side3)
48
+ private static bool AllSidesAreZero(double side1, double side2, double side3)
31
49
  {
32
50
  return side1 == 0 && side2 == 0 && side3 == 0;
33
51
  }
34
52
 
35
- private static bool HasImpossibleSides(decimal side1, decimal side2, decimal side3)
53
+ private static bool HasImpossibleSides(double side1, double side2, double side3)
36
54
  {
37
55
  return side1 < 0 || side2 < 0 || side3 < 0;
38
56
  }
39
57
 
40
- private static bool ViolatesTriangleInequality(decimal side1, decimal side2, decimal side3)
58
+ private static bool ViolatesTriangleInequality(double side1, double side2, double side3)
41
59
  {
42
60
  return side1 + side2 <= side3 || side1 + side3 <= side2 || side2 + side3 <= side1;
43
61
  }
44
62
 
45
- private static int UniqueSides(decimal side1, decimal side2, decimal side3)
63
+ private static int UniqueSides(double side1, double side2, double side3)
46
64
  {
47
- decimal[] sides = { side1, side2, side3 };
65
+ double[] sides = { side1, side2, side3 };
48
66
  return sides.Distinct().Count();
49
67
  }
50
68
  }
@@ -9,7 +9,22 @@ public enum TriangleKind
9
9
 
10
10
  public static class Triangle
11
11
  {
12
- public static TriangleKind Kind(decimal side1, decimal side2, decimal side3)
12
+ public static bool IsScalene(double side1, double side2, double side3)
13
+ {
14
+ throw new NotImplementedException("You need to implement this function.");
15
+ }
16
+
17
+ public static bool IsIsosceles(double side1, double side2, double side3)
18
+ {
19
+ throw new NotImplementedException("You need to implement this function.");
20
+ }
21
+
22
+ public static bool IsEquilateral(double side1, double side2, double side3)
23
+ {
24
+ throw new NotImplementedException("You need to implement this function.");
25
+ }
26
+
27
+ private static TriangleKind Kind(double side1, double side2, double side3)
13
28
  {
14
29
  throw new NotImplementedException("You need to implement this function.");
15
30
  }