trackler 2.2.1.33 → 2.2.1.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/README.md +1 -1
  4. data/problem-specifications/exercises/palindrome-products/description.md +9 -3
  5. data/tracks/c/exercises/hamming/src/example.c +9 -8
  6. data/tracks/c/exercises/hamming/src/example.h +1 -1
  7. data/tracks/c/exercises/hamming/test/test_hamming.c +31 -7
  8. data/tracks/clojure/config.json +10 -0
  9. data/tracks/clojure/exercises/collatz-conjecture/README.md +34 -0
  10. data/tracks/clojure/exercises/collatz-conjecture/project.clj +4 -0
  11. data/tracks/clojure/exercises/collatz-conjecture/src/collatz_conjecture.clj +3 -0
  12. data/tracks/clojure/exercises/collatz-conjecture/src/example.clj +13 -0
  13. data/tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj +29 -0
  14. data/tracks/coldfusion/.gitignore +1 -0
  15. data/tracks/coldfusion/.travis.yml +16 -4
  16. data/tracks/coldfusion/CONTRIBUTING.md +10 -0
  17. data/tracks/coldfusion/README.md +85 -6
  18. data/tracks/coldfusion/config.json +195 -10
  19. data/tracks/coldfusion/config/maintainers.json +8 -1
  20. data/tracks/coldfusion/docs/ABOUT.md +8 -0
  21. data/tracks/coldfusion/docs/EXERCISE_README_INSERT.md +15 -0
  22. data/tracks/coldfusion/docs/INSTALLATION.md +35 -0
  23. data/tracks/coldfusion/docs/LEARNING.md +37 -0
  24. data/tracks/coldfusion/docs/RESOURCES.md +29 -0
  25. data/tracks/coldfusion/docs/SNIPPET.txt +8 -0
  26. data/tracks/coldfusion/docs/TESTS.md +19 -0
  27. data/tracks/coldfusion/exercises/acronym/.meta/HINTS.md +0 -0
  28. data/tracks/coldfusion/exercises/acronym/Acronym.cfc +13 -0
  29. data/tracks/coldfusion/exercises/acronym/AcronymTest.cfc +43 -0
  30. data/tracks/coldfusion/exercises/acronym/Solution.cfc +22 -0
  31. data/tracks/coldfusion/exercises/acronym/SolutionTest.cfc +7 -0
  32. data/tracks/coldfusion/exercises/acronym/TestRunner.cfc +103 -0
  33. data/tracks/coldfusion/exercises/acronym/box.json +8 -0
  34. data/tracks/coldfusion/exercises/acronym/index.cfm +37 -0
  35. data/tracks/coldfusion/exercises/atbash-cipher/.meta/HINTS.md +0 -0
  36. data/tracks/coldfusion/exercises/atbash-cipher/AtbashCipher.cfc +14 -0
  37. data/tracks/coldfusion/exercises/atbash-cipher/AtbashCipherTest.cfc +71 -0
  38. data/tracks/coldfusion/exercises/atbash-cipher/Solution.cfc +56 -0
  39. data/tracks/coldfusion/exercises/atbash-cipher/SolutionTest.cfc +7 -0
  40. data/tracks/coldfusion/exercises/atbash-cipher/TestRunner.cfc +103 -0
  41. data/tracks/coldfusion/exercises/atbash-cipher/box.json +8 -0
  42. data/tracks/coldfusion/exercises/atbash-cipher/index.cfm +37 -0
  43. data/tracks/coldfusion/exercises/diamond/.meta/HINTS.md +0 -0
  44. data/tracks/coldfusion/exercises/diamond/Diamond.cfc +13 -0
  45. data/tracks/coldfusion/exercises/diamond/DiamondTest.cfc +35 -0
  46. data/tracks/coldfusion/exercises/diamond/Solution.cfc +35 -0
  47. data/tracks/coldfusion/exercises/diamond/SolutionTest.cfc +7 -0
  48. data/tracks/coldfusion/exercises/diamond/TestRunner.cfc +103 -0
  49. data/tracks/coldfusion/exercises/diamond/box.json +8 -0
  50. data/tracks/coldfusion/exercises/diamond/index.cfm +37 -0
  51. data/tracks/coldfusion/exercises/difference-of-squares/.meta/HINTS.md +0 -0
  52. data/tracks/coldfusion/exercises/difference-of-squares/DifferenceOfSquares.cfc +18 -0
  53. data/tracks/coldfusion/exercises/difference-of-squares/DifferenceOfSquaresTest.cfc +63 -0
  54. data/tracks/coldfusion/exercises/difference-of-squares/Solution.cfc +28 -0
  55. data/tracks/coldfusion/exercises/difference-of-squares/SolutionTest.cfc +7 -0
  56. data/tracks/coldfusion/exercises/difference-of-squares/TestRunner.cfc +103 -0
  57. data/tracks/coldfusion/exercises/difference-of-squares/box.json +8 -0
  58. data/tracks/coldfusion/exercises/difference-of-squares/index.cfm +37 -0
  59. data/tracks/coldfusion/exercises/flatten-array/.meta/HINTS.md +0 -0
  60. data/tracks/coldfusion/exercises/flatten-array/FlattenArray.cfc +13 -0
  61. data/tracks/coldfusion/exercises/flatten-array/FlattenArrayTest.cfc +42 -0
  62. data/tracks/coldfusion/exercises/flatten-array/Solution.cfc +26 -0
  63. data/tracks/coldfusion/exercises/flatten-array/SolutionTest.cfc +7 -0
  64. data/tracks/coldfusion/exercises/flatten-array/TestRunner.cfc +103 -0
  65. data/tracks/coldfusion/exercises/flatten-array/box.json +8 -0
  66. data/tracks/coldfusion/exercises/flatten-array/index.cfm +37 -0
  67. data/tracks/coldfusion/exercises/gigasecond/.meta/HINTS.md +0 -0
  68. data/tracks/coldfusion/exercises/gigasecond/Gigasecond.cfc +13 -0
  69. data/tracks/coldfusion/exercises/gigasecond/GigasecondTest.cfc +39 -0
  70. data/tracks/coldfusion/exercises/gigasecond/Solution.cfc +16 -0
  71. data/tracks/coldfusion/exercises/gigasecond/SolutionTest.cfc +7 -0
  72. data/tracks/coldfusion/exercises/gigasecond/TestRunner.cfc +103 -0
  73. data/tracks/coldfusion/exercises/gigasecond/box.json +8 -0
  74. data/tracks/coldfusion/exercises/gigasecond/index.cfm +37 -0
  75. data/tracks/coldfusion/exercises/grains/.meta/HINTS.md +0 -0
  76. data/tracks/coldfusion/exercises/grains/Grains.cfc +14 -0
  77. data/tracks/coldfusion/exercises/grains/GrainsTest.cfc +63 -0
  78. data/tracks/coldfusion/exercises/grains/Solution.cfc +22 -0
  79. data/tracks/coldfusion/exercises/grains/SolutionTest.cfc +7 -0
  80. data/tracks/coldfusion/exercises/grains/TestRunner.cfc +103 -0
  81. data/tracks/coldfusion/exercises/grains/box.json +8 -0
  82. data/tracks/coldfusion/exercises/grains/index.cfm +37 -0
  83. data/tracks/coldfusion/exercises/hamming/.meta/HINTS.md +0 -0
  84. data/tracks/coldfusion/exercises/hamming/Hamming.cfc +13 -0
  85. data/tracks/coldfusion/exercises/hamming/HammingTest.cfc +75 -0
  86. data/tracks/coldfusion/exercises/hamming/Solution.cfc +25 -0
  87. data/tracks/coldfusion/exercises/hamming/SolutionTest.cfc +7 -0
  88. data/tracks/coldfusion/exercises/hamming/TestRunner.cfc +103 -0
  89. data/tracks/coldfusion/exercises/hamming/box.json +8 -0
  90. data/tracks/coldfusion/exercises/hamming/index.cfm +37 -0
  91. data/tracks/coldfusion/exercises/hello-world/HelloWorld.cfc +13 -0
  92. data/tracks/coldfusion/exercises/hello-world/HelloWorldTest.cfc +18 -0
  93. data/tracks/coldfusion/exercises/hello-world/Solution.cfc +13 -0
  94. data/tracks/coldfusion/exercises/hello-world/SolutionTest.cfc +7 -0
  95. data/tracks/coldfusion/exercises/hello-world/TestRunner.cfc +103 -0
  96. data/tracks/coldfusion/exercises/hello-world/box.json +8 -0
  97. data/tracks/coldfusion/exercises/hello-world/index.cfm +37 -0
  98. data/tracks/coldfusion/exercises/isogram/.meta/HINTS.md +0 -0
  99. data/tracks/coldfusion/exercises/isogram/Isogram.cfc +13 -0
  100. data/tracks/coldfusion/exercises/isogram/IsogramTest.cfc +55 -0
  101. data/tracks/coldfusion/exercises/isogram/Solution.cfc +23 -0
  102. data/tracks/coldfusion/exercises/isogram/SolutionTest.cfc +7 -0
  103. data/tracks/coldfusion/exercises/isogram/TestRunner.cfc +103 -0
  104. data/tracks/coldfusion/exercises/isogram/box.json +8 -0
  105. data/tracks/coldfusion/exercises/isogram/index.cfm +37 -0
  106. data/tracks/coldfusion/exercises/largest-series-product/.meta/HINTS.md +0 -0
  107. data/tracks/coldfusion/exercises/largest-series-product/LargestSeriesProduct.cfc +13 -0
  108. data/tracks/coldfusion/exercises/largest-series-product/LargestSeriesProductTest.cfc +75 -0
  109. data/tracks/coldfusion/exercises/largest-series-product/Solution.cfc +41 -0
  110. data/tracks/coldfusion/exercises/largest-series-product/SolutionTest.cfc +7 -0
  111. data/tracks/coldfusion/exercises/largest-series-product/TestRunner.cfc +103 -0
  112. data/tracks/coldfusion/exercises/largest-series-product/box.json +8 -0
  113. data/tracks/coldfusion/exercises/largest-series-product/index.cfm +37 -0
  114. data/tracks/coldfusion/exercises/leap/Leap.cfc +15 -0
  115. data/tracks/coldfusion/exercises/leap/LeapTest.cfc +39 -0
  116. data/tracks/coldfusion/exercises/leap/Solution.cfc +19 -0
  117. data/tracks/coldfusion/exercises/leap/SolutionTest.cfc +7 -0
  118. data/tracks/coldfusion/exercises/leap/TestRunner.cfc +103 -0
  119. data/tracks/coldfusion/exercises/leap/box.json +8 -0
  120. data/tracks/coldfusion/exercises/leap/index.cfm +37 -0
  121. data/tracks/coldfusion/exercises/luhn/.meta/HINTS.md +0 -0
  122. data/tracks/coldfusion/exercises/luhn/Luhn.cfc +13 -0
  123. data/tracks/coldfusion/exercises/luhn/LuhnTest.cfc +67 -0
  124. data/tracks/coldfusion/exercises/luhn/Solution.cfc +38 -0
  125. data/tracks/coldfusion/exercises/luhn/SolutionTest.cfc +7 -0
  126. data/tracks/coldfusion/exercises/luhn/TestRunner.cfc +103 -0
  127. data/tracks/coldfusion/exercises/luhn/box.json +8 -0
  128. data/tracks/coldfusion/exercises/luhn/index.cfm +37 -0
  129. data/tracks/coldfusion/exercises/nth-prime/.meta/HINTS.md +0 -0
  130. data/tracks/coldfusion/exercises/nth-prime/NthPrime.cfc +13 -0
  131. data/tracks/coldfusion/exercises/nth-prime/NthPrimeTest.cfc +35 -0
  132. data/tracks/coldfusion/exercises/nth-prime/Solution.cfc +33 -0
  133. data/tracks/coldfusion/exercises/nth-prime/SolutionTest.cfc +7 -0
  134. data/tracks/coldfusion/exercises/nth-prime/TestRunner.cfc +103 -0
  135. data/tracks/coldfusion/exercises/nth-prime/box.json +8 -0
  136. data/tracks/coldfusion/exercises/nth-prime/index.cfm +37 -0
  137. data/tracks/coldfusion/exercises/pangram/.meta/HINTS.md +0 -0
  138. data/tracks/coldfusion/exercises/pangram/Pangram.cfc +13 -0
  139. data/tracks/coldfusion/exercises/pangram/PangramTest.cfc +55 -0
  140. data/tracks/coldfusion/exercises/pangram/Solution.cfc +21 -0
  141. data/tracks/coldfusion/exercises/pangram/SolutionTest.cfc +7 -0
  142. data/tracks/coldfusion/exercises/pangram/TestRunner.cfc +103 -0
  143. data/tracks/coldfusion/exercises/pangram/box.json +8 -0
  144. data/tracks/coldfusion/exercises/pangram/index.cfm +37 -0
  145. data/tracks/coldfusion/exercises/pig-latin/.meta/HINTS.md +0 -0
  146. data/tracks/coldfusion/exercises/pig-latin/PigLatin.cfc +13 -0
  147. data/tracks/coldfusion/exercises/pig-latin/PigLatinTest.cfc +115 -0
  148. data/tracks/coldfusion/exercises/pig-latin/Solution.cfc +30 -0
  149. data/tracks/coldfusion/exercises/pig-latin/SolutionTest.cfc +7 -0
  150. data/tracks/coldfusion/exercises/pig-latin/TestRunner.cfc +103 -0
  151. data/tracks/coldfusion/exercises/pig-latin/box.json +8 -0
  152. data/tracks/coldfusion/exercises/pig-latin/index.cfm +37 -0
  153. data/tracks/coldfusion/exercises/raindrops/.meta/HINTS.md +0 -0
  154. data/tracks/coldfusion/exercises/raindrops/Raindrops.cfc +13 -0
  155. data/tracks/coldfusion/exercises/raindrops/RaindropsTest.cfc +87 -0
  156. data/tracks/coldfusion/exercises/raindrops/Solution.cfc +33 -0
  157. data/tracks/coldfusion/exercises/raindrops/SolutionTest.cfc +7 -0
  158. data/tracks/coldfusion/exercises/raindrops/TestRunner.cfc +103 -0
  159. data/tracks/coldfusion/exercises/raindrops/box.json +8 -0
  160. data/tracks/coldfusion/exercises/raindrops/index.cfm +37 -0
  161. data/tracks/coldfusion/exercises/rna-transcription/.meta/HINTS.md +0 -0
  162. data/tracks/coldfusion/exercises/rna-transcription/RnaTranscription.cfc +13 -0
  163. data/tracks/coldfusion/exercises/rna-transcription/RnaTranscriptionTest.cfc +47 -0
  164. data/tracks/coldfusion/exercises/rna-transcription/Solution.cfc +35 -0
  165. data/tracks/coldfusion/exercises/rna-transcription/SolutionTest.cfc +7 -0
  166. data/tracks/coldfusion/exercises/rna-transcription/TestRunner.cfc +103 -0
  167. data/tracks/coldfusion/exercises/rna-transcription/box.json +8 -0
  168. data/tracks/coldfusion/exercises/rna-transcription/index.cfm +37 -0
  169. data/tracks/coldfusion/exercises/saddle-points/.meta/HINTS.md +0 -0
  170. data/tracks/coldfusion/exercises/saddle-points/SaddlePoints.cfc +13 -0
  171. data/tracks/coldfusion/exercises/saddle-points/SaddlePointsTest.cfc +35 -0
  172. data/tracks/coldfusion/exercises/saddle-points/Solution.cfc +59 -0
  173. data/tracks/coldfusion/exercises/saddle-points/SolutionTest.cfc +7 -0
  174. data/tracks/coldfusion/exercises/saddle-points/TestRunner.cfc +103 -0
  175. data/tracks/coldfusion/exercises/saddle-points/box.json +8 -0
  176. data/tracks/coldfusion/exercises/saddle-points/index.cfm +37 -0
  177. data/tracks/coldfusion/exercises/scrabble-score/.meta/HINTS.md +0 -0
  178. data/tracks/coldfusion/exercises/scrabble-score/ScrabbleScore.cfc +13 -0
  179. data/tracks/coldfusion/exercises/scrabble-score/ScrabbleScoreTest.cfc +59 -0
  180. data/tracks/coldfusion/exercises/scrabble-score/Solution.cfc +50 -0
  181. data/tracks/coldfusion/exercises/scrabble-score/SolutionTest.cfc +7 -0
  182. data/tracks/coldfusion/exercises/scrabble-score/TestRunner.cfc +103 -0
  183. data/tracks/coldfusion/exercises/scrabble-score/box.json +8 -0
  184. data/tracks/coldfusion/exercises/scrabble-score/index.cfm +37 -0
  185. data/tracks/coldfusion/exercises/secret-handshake/.meta/HINTS.md +0 -0
  186. data/tracks/coldfusion/exercises/secret-handshake/SecretHandshake.cfc +13 -0
  187. data/tracks/coldfusion/exercises/secret-handshake/SecretHandshakeTest.cfc +63 -0
  188. data/tracks/coldfusion/exercises/secret-handshake/Solution.cfc +31 -0
  189. data/tracks/coldfusion/exercises/secret-handshake/SolutionTest.cfc +7 -0
  190. data/tracks/coldfusion/exercises/secret-handshake/TestRunner.cfc +103 -0
  191. data/tracks/coldfusion/exercises/secret-handshake/box.json +8 -0
  192. data/tracks/coldfusion/exercises/secret-handshake/index.cfm +37 -0
  193. data/tracks/coldfusion/exercises/space-age/.meta/HINTS.md +0 -0
  194. data/tracks/coldfusion/exercises/space-age/Solution.cfc +28 -0
  195. data/tracks/coldfusion/exercises/space-age/SolutionTest.cfc +7 -0
  196. data/tracks/coldfusion/exercises/space-age/SpaceAge.cfc +13 -0
  197. data/tracks/coldfusion/exercises/space-age/SpaceAgeTest.cfc +47 -0
  198. data/tracks/coldfusion/exercises/space-age/TestRunner.cfc +103 -0
  199. data/tracks/coldfusion/exercises/space-age/box.json +8 -0
  200. data/tracks/coldfusion/exercises/space-age/index.cfm +37 -0
  201. data/tracks/coldfusion/exercises/sum-of-multiples/.meta/HINTS.md +0 -0
  202. data/tracks/coldfusion/exercises/sum-of-multiples/Solution.cfc +27 -0
  203. data/tracks/coldfusion/exercises/sum-of-multiples/SolutionTest.cfc +7 -0
  204. data/tracks/coldfusion/exercises/sum-of-multiples/SumOfMultiples.cfc +13 -0
  205. data/tracks/coldfusion/exercises/sum-of-multiples/SumOfMultiplesTest.cfc +63 -0
  206. data/tracks/coldfusion/exercises/sum-of-multiples/TestRunner.cfc +103 -0
  207. data/tracks/coldfusion/exercises/sum-of-multiples/box.json +8 -0
  208. data/tracks/coldfusion/exercises/sum-of-multiples/index.cfm +37 -0
  209. data/tracks/coldfusion/exercises/triangle/.meta/HINTS.md +0 -0
  210. data/tracks/coldfusion/exercises/triangle/Solution.cfc +53 -0
  211. data/tracks/coldfusion/exercises/triangle/SolutionTest.cfc +7 -0
  212. data/tracks/coldfusion/exercises/triangle/TestRunner.cfc +103 -0
  213. data/tracks/coldfusion/exercises/triangle/Triangle.cfc +18 -0
  214. data/tracks/coldfusion/exercises/triangle/TriangleTest.cfc +95 -0
  215. data/tracks/coldfusion/exercises/triangle/box.json +8 -0
  216. data/tracks/coldfusion/exercises/triangle/index.cfm +37 -0
  217. data/tracks/coldfusion/tasks/GenerateTests.cfc +179 -0
  218. data/tracks/coldfusion/tasks/ScaffoldExercise.cfc +85 -0
  219. data/tracks/coldfusion/tasks/TestAllSolutions.cfc +24 -0
  220. data/tracks/coldfusion/tasks/exercise_template/.meta/HINTS.md +0 -0
  221. data/tracks/coldfusion/tasks/exercise_template/@@name@@.cfc +13 -0
  222. data/tracks/coldfusion/tasks/exercise_template/@@name@@Test.cfc +15 -0
  223. data/tracks/coldfusion/tasks/exercise_template/Solution.cfc +6 -0
  224. data/tracks/coldfusion/tasks/exercise_template/SolutionTest.cfc +7 -0
  225. data/tracks/coldfusion/tasks/exercise_template/TestRunner.cfc +103 -0
  226. data/tracks/coldfusion/tasks/exercise_template/box.json +8 -0
  227. data/tracks/coldfusion/tasks/exercise_template/index.cfm +37 -0
  228. data/tracks/common-lisp/config.json +12 -0
  229. data/tracks/common-lisp/exercises/collatz-conjecture/README.md +84 -0
  230. data/tracks/common-lisp/exercises/collatz-conjecture/collatz-conjecture-test.lisp +31 -0
  231. data/tracks/common-lisp/exercises/collatz-conjecture/collatz-conjecture.lisp +7 -0
  232. data/tracks/common-lisp/exercises/collatz-conjecture/example.lisp +14 -0
  233. data/tracks/csharp/exercises/clock/Clock.cs +20 -4
  234. data/tracks/csharp/exercises/clock/ClockTest.cs +290 -55
  235. data/tracks/csharp/exercises/clock/Example.cs +11 -8
  236. data/tracks/csharp/generators/Exercises/Clock.cs +75 -0
  237. data/tracks/csharp/generators/Output/FormattingExtensions.cs +0 -1
  238. data/tracks/csharp/generators/Program.cs +2 -1
  239. data/tracks/haskell/config.json +10 -0
  240. data/tracks/haskell/exercises/collatz-conjecture/README.md +87 -0
  241. data/tracks/haskell/exercises/collatz-conjecture/examples/success-standard/package.yaml +16 -0
  242. data/tracks/haskell/exercises/collatz-conjecture/examples/success-standard/src/CollatzConjecture.hs +9 -0
  243. data/tracks/haskell/exercises/collatz-conjecture/package.yaml +20 -0
  244. data/tracks/haskell/exercises/collatz-conjecture/src/CollatzConjecture.hs +4 -0
  245. data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -0
  246. data/tracks/haskell/exercises/collatz-conjecture/test/Tests.hs +52 -0
  247. data/tracks/idris/docs/SNIPPET.txt +10 -0
  248. data/tracks/rust/README.md +83 -2
  249. data/tracks/rust/config.json +24 -0
  250. data/tracks/rust/exercises/perfect-numbers/.gitignore +7 -0
  251. data/tracks/rust/exercises/perfect-numbers/Cargo.toml +5 -0
  252. data/tracks/rust/exercises/perfect-numbers/README.md +56 -0
  253. data/tracks/rust/exercises/perfect-numbers/example.rs +20 -0
  254. data/tracks/rust/exercises/perfect-numbers/src/lib.rs +0 -0
  255. data/tracks/rust/exercises/perfect-numbers/tests/perfect-numbers.rs +33 -0
  256. data/tracks/rust/exercises/poker/.gitignore +7 -0
  257. data/tracks/rust/exercises/poker/.meta/hints.md +8 -0
  258. data/tracks/rust/exercises/poker/Cargo-example.toml +8 -0
  259. data/tracks/rust/exercises/poker/Cargo.toml +6 -0
  260. data/tracks/rust/exercises/poker/README.md +54 -0
  261. data/tracks/rust/exercises/poker/example.rs +341 -0
  262. data/tracks/rust/exercises/poker/src/lib.rs +7 -0
  263. data/tracks/rust/exercises/poker/tests/poker.rs +298 -0
  264. metadata +242 -5
  265. data/tracks/coldfusion/exercises/leap/example.cfc +0 -11
  266. data/tracks/coldfusion/exercises/leap/leap.cfc +0 -5
  267. data/tracks/coldfusion/exercises/leap/leap_tests.cfc +0 -35
@@ -1,27 +1,30 @@
1
+ using System;
2
+
1
3
  public struct Clock
2
4
  {
3
- private readonly int hours;
4
- private readonly int minutes;
5
-
6
5
  public Clock(int hours, int minutes = 0)
7
6
  {
8
- this.hours = Mod((hours * 60 + minutes) / 60.0, 24);
9
- this.minutes = Mod(minutes, 60);
7
+ Hours = Mod((hours * 60 + minutes) / 60.0, 24);
8
+ Minutes = Mod(minutes, 60);
10
9
  }
10
+
11
+ public int Hours { get; }
12
+
13
+ public int Minutes { get; }
11
14
 
12
15
  public Clock Add(int minutesToAdd)
13
16
  {
14
- return new Clock(hours, minutes + minutesToAdd);
17
+ return new Clock(Hours, Minutes + minutesToAdd);
15
18
  }
16
19
 
17
20
  public Clock Subtract(int minutesToSubtract)
18
21
  {
19
- return new Clock(hours, minutes - minutesToSubtract);
22
+ return new Clock(Hours, Minutes - minutesToSubtract);
20
23
  }
21
24
 
22
25
  public override string ToString()
23
26
  {
24
- return $"{hours:00}:{minutes:00}";
27
+ return $"{Hours:00}:{Minutes:00}";
25
28
  }
26
29
 
27
30
  private static int Mod(double x, double y)
@@ -0,0 +1,75 @@
1
+ using System.Collections.Generic;
2
+ using Generators.Input;
3
+ using Generators.Output;
4
+ using Newtonsoft.Json.Linq;
5
+
6
+ namespace Generators.Exercises
7
+ {
8
+ public class Clock : Exercise
9
+ {
10
+ private const string paramClock1 = "clock1";
11
+ private const string paramClock2 = "clock2";
12
+ private const string paramHour = "hour";
13
+ private const string paramMinute = "minute";
14
+
15
+ private const string propertyCreate = "create";
16
+ private const string propertyEqual = "equal";
17
+ private const string propertyEquals = "equals";
18
+ private const string propertyToString = "to_string";
19
+
20
+ protected override void UpdateCanonicalData(CanonicalData canonicalData)
21
+ {
22
+ foreach (var canonicalDataCase in canonicalData.Cases)
23
+ {
24
+ if (canonicalDataCase.Property != propertyEqual)
25
+ {
26
+ canonicalDataCase.ConstructorInput = new Dictionary<string, object>
27
+ {
28
+ [paramHour] = canonicalDataCase.Input[paramHour],
29
+ [paramMinute] = canonicalDataCase.Input[paramMinute]
30
+ };
31
+ }
32
+ else
33
+ {
34
+ canonicalDataCase.ConstructorInput = ((JObject)canonicalDataCase.Input[paramClock1]).ToObject<Dictionary<string, object>>();
35
+ canonicalDataCase.Input.Remove(paramClock1);
36
+
37
+ var result = ((JObject)canonicalDataCase.Input[paramClock2]).ToObject<Dictionary<string, object>>();
38
+ canonicalDataCase.Input[paramClock2] = new UnescapedValue($"new Clock({result[paramHour]}, {result[paramMinute]})");
39
+ }
40
+
41
+ if (canonicalDataCase.Property == propertyCreate)
42
+ {
43
+ canonicalDataCase.Property = propertyToString;
44
+ }
45
+ else if (canonicalDataCase.Property == propertyEqual)
46
+ {
47
+ canonicalDataCase.Property = propertyEquals;
48
+ }
49
+ }
50
+ }
51
+
52
+ protected override string RenderTestMethodBodyAssert(TestMethodBody testMethodBody)
53
+ {
54
+ if (testMethodBody.CanonicalDataCase.Property == propertyEquals)
55
+ {
56
+ return base.RenderTestMethodBodyAssert(testMethodBody);
57
+ }
58
+ else if (testMethodBody.CanonicalDataCase.Property != propertyToString)
59
+ {
60
+ return RenderConsistencyToAssert(testMethodBody);
61
+ }
62
+ else
63
+ {
64
+ return base.RenderTestMethodBodyAssert(testMethodBody);
65
+ }
66
+ }
67
+
68
+ private static string RenderConsistencyToAssert(TestMethodBody testMethodBody)
69
+ {
70
+ var template = $"Assert.Equal({{{{ ExpectedParameter }}}}, {{{{ TestedValue }}}}.ToString());";
71
+
72
+ return TemplateRenderer.RenderInline(template, testMethodBody.AssertTemplateParameters);
73
+ }
74
+ }
75
+ }
@@ -9,7 +9,6 @@ public static string EscapeSpecialCharacters(this string s)
9
9
  .Replace("\t", "\\t")
10
10
  .Replace("\r", "\\r")
11
11
  .Replace("\"", "\\\"");
12
-
13
12
 
14
13
  public static string Quote(this string s) => $"\"{s}\"";
15
14
  }
@@ -1,4 +1,5 @@
1
1
  using System;
2
+ using System.Diagnostics;
2
3
  using System.IO;
3
4
  using CommandLine;
4
5
  using Generators.Input;
@@ -18,7 +19,7 @@ public static int Main(string[] args)
18
19
  .WithParsed(RegenerateTestClasses);
19
20
  return 0;
20
21
  }
21
- catch (Exception exception)
22
+ catch (Exception exception) when (!Debugger.IsAttached)
22
23
  {
23
24
  Log.Error(exception, "Exception occured: {Message}", exception.Message);
24
25
  return 1;
@@ -58,6 +58,16 @@
58
58
  "topics": [
59
59
  ]
60
60
  },
61
+ {
62
+ "uuid": "6eba4eac-8395-4ad6-ac21-3651a11ab4b4",
63
+ "slug": "collatz-conjecture",
64
+ "core": false,
65
+ "unlocked_by": null,
66
+ "difficulty": 1,
67
+ "topics": [
68
+ "Maybe"
69
+ ]
70
+ },
61
71
  {
62
72
  "uuid": "85d77b8e-9b87-4d02-9fba-81f843bd66f1",
63
73
  "slug": "rna-transcription",
@@ -0,0 +1,87 @@
1
+ # Collatz Conjecture
2
+
3
+ The Collatz Conjecture or 3x+1 problem can be summarized as follows:
4
+
5
+ Take any positive integer n. If n is even, divide n by 2 to get n / 2. If n is
6
+ odd, multiply n by 3 and add 1 to get 3n + 1. Repeat the process indefinitely.
7
+ The conjecture states that no matter which number you start with, you will
8
+ always reach 1 eventually.
9
+
10
+ Given a number n, return the number of steps required to reach 1.
11
+
12
+ ## Examples
13
+ Starting with n = 12, the steps would be as follows:
14
+
15
+ 0. 12
16
+ 1. 6
17
+ 2. 3
18
+ 3. 10
19
+ 4. 5
20
+ 5. 16
21
+ 6. 8
22
+ 7. 4
23
+ 8. 2
24
+ 9. 1
25
+
26
+ Resulting in 9 steps. So for input n = 12, the return value would be 9.
27
+
28
+
29
+
30
+ ## Getting Started
31
+
32
+ For installation and learning resources, refer to the
33
+ [exercism help page](http://exercism.io/languages/haskell).
34
+
35
+ ## Running the tests
36
+
37
+ To run the test suite, execute the following command:
38
+
39
+ ```bash
40
+ stack test
41
+ ```
42
+
43
+ #### If you get an error message like this...
44
+
45
+ ```
46
+ No .cabal file found in directory
47
+ ```
48
+
49
+ You are probably running an old stack version and need
50
+ to upgrade it.
51
+
52
+ #### Otherwise, if you get an error message like this...
53
+
54
+ ```
55
+ No compiler found, expected minor version match with...
56
+ Try running "stack setup" to install the correct GHC...
57
+ ```
58
+
59
+ Just do as it says and it will download and install
60
+ the correct compiler version:
61
+
62
+ ```bash
63
+ stack setup
64
+ ```
65
+
66
+ ## Running *GHCi*
67
+
68
+ If you want to play with your solution in GHCi, just run the command:
69
+
70
+ ```bash
71
+ stack ghci
72
+ ```
73
+
74
+ ## Feedback, Issues, Pull Requests
75
+
76
+ The [exercism/haskell](https://github.com/exercism/haskell) repository on
77
+ GitHub is the home for all of the Haskell exercises.
78
+
79
+ If you have feedback about an exercise, or want to help implementing a new
80
+ one, head over there and create an issue. We'll do our best to help you!
81
+
82
+ ## Source
83
+
84
+ An unsolved problem in mathematics named after mathematician Lothar Collatz [https://en.wikipedia.org/wiki/3x_%2B_1_problem](https://en.wikipedia.org/wiki/3x_%2B_1_problem)
85
+
86
+ ## Submitting Incomplete Solutions
87
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,16 @@
1
+ name: collatz-conjecture
2
+
3
+ dependencies:
4
+ - base
5
+
6
+ library:
7
+ exposed-modules: CollatzConjecture
8
+ source-dirs: src
9
+
10
+ tests:
11
+ test:
12
+ main: Tests.hs
13
+ source-dirs: test
14
+ dependencies:
15
+ - collatz-conjecture
16
+ - hspec
@@ -0,0 +1,9 @@
1
+ module CollatzConjecture (collatz) where
2
+
3
+ collatzHelper :: Integer -> Integer -> Maybe Integer
4
+ collatzHelper t x | x == 1 = Just t
5
+ | even x = collatzHelper (t+1) (x `div` 2)
6
+ | otherwise = collatzHelper (t+1) (x*3 + 1)
7
+
8
+ collatz :: Integer -> Maybe Integer
9
+ collatz x = if x <= 0 then Nothing else collatzHelper 0 x
@@ -0,0 +1,20 @@
1
+ name: collatz-conjecture
2
+ version: 1.1.1.1
3
+
4
+ dependencies:
5
+ - base
6
+
7
+ library:
8
+ exposed-modules: CollatzConjecture
9
+ source-dirs: src
10
+ dependencies:
11
+ # - foo # List here the packages you
12
+ # - bar # want to use in your solution.
13
+
14
+ tests:
15
+ test:
16
+ main: Tests.hs
17
+ source-dirs: test
18
+ dependencies:
19
+ - collatz-conjecture
20
+ - hspec
@@ -0,0 +1,4 @@
1
+ module CollatzConjecture (collatz) where
2
+
3
+ collatz :: Integer -> Maybe Integer
4
+ collatz = error "You need to implement this function."
@@ -0,0 +1 @@
1
+ resolver: lts-8.21
@@ -0,0 +1,52 @@
1
+ {-# OPTIONS_GHC -fno-warn-type-defaults #-}
2
+ {-# LANGUAGE RecordWildCards #-}
3
+
4
+ import Data.Foldable (for_)
5
+ import Test.Hspec (Spec, describe, it, shouldBe)
6
+ import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
7
+
8
+ import CollatzConjecture (collatz)
9
+
10
+ main :: IO ()
11
+ main = hspecWith defaultConfig {configFastFail = True} specs
12
+
13
+ specs :: Spec
14
+ specs = describe "collatz" $ for_ cases test
15
+ where
16
+
17
+ test Case{..} = it description assertion
18
+ where
19
+ assertion = collatz number `shouldBe` expected
20
+
21
+
22
+ data Case = Case { description :: String
23
+ , number :: Integer
24
+ , expected :: Maybe Integer
25
+ }
26
+
27
+ cases :: [Case]
28
+ cases = [ Case { description = "zero steps for one"
29
+ , number = 1
30
+ , expected = Just 0
31
+ }
32
+ , Case { description = "divide if even"
33
+ , number = 16
34
+ , expected = Just 4
35
+ }
36
+ , Case { description = "even and odd steps"
37
+ , number = 12
38
+ , expected = Just 9
39
+ }
40
+ , Case { description = "Large number of even and odd steps"
41
+ , number = 1000000
42
+ , expected = Just 152
43
+ }
44
+ , Case { description = "zero is an error"
45
+ , number = 0
46
+ , expected = Nothing
47
+ }
48
+ , Case { description = "negative value is an error"
49
+ , number = -15
50
+ , expected = Nothing
51
+ }
52
+ ]
@@ -0,0 +1,10 @@
1
+ module EvenOdd
2
+
3
+ data Even : Nat -> Type where
4
+ EZ : Even Z
5
+ ES : Even n -> Even (S (S n))
6
+
7
+ total
8
+ ee : Even n -> Even m -> Even (n + m)
9
+ ee EZ m = m
10
+ ee (ES n) m = ES (ee n m)
@@ -5,10 +5,91 @@
5
5
 
6
6
  Exercism exercises in Rust
7
7
 
8
- ## Contributing Guide
8
+ ## Contributing
9
9
 
10
- Please see the [contributing guide](https://github.com/exercism/docs/tree/master/contributing-to-language-tracks)
10
+ Thank you so much for contributing! :tada:
11
11
 
12
+ Please read about how to [get involved in a track](https://github.com/exercism/docs/tree/master/contributing-to-language-tracks). Be sure to read the Exercism [Code of Conduct](https://github.com/exercism/exercism.io/blob/master/CODE_OF_CONDUCT.md).
13
+
14
+ We welcome pull requests of all kinds. No contribution is too small.
15
+
16
+ We encourage contributions that provide fixes and improvements to existing exercises. Please note that this track's exercises must conform to the Exercism-wide standards described in the [documentation](https://github.com/exercism/docs/tree/master/language-tracks/exercises). If you're unsure about how to make a change, then go ahead and open a GitHub issue, and we'll discuss it.
17
+
18
+ ## Exercise Tests
19
+
20
+ At the most basic level, Exercism is all about the tests. You can read more about how we think about test suites in [the Exercism documentation](https://github.com/exercism/docs/blob/master/language-tracks/exercises/anatomy/test-suites.md).
21
+
22
+ Test files should use the following format:
23
+
24
+ ```
25
+ extern crate exercise_name;
26
+
27
+ use exercise_name::*;
28
+
29
+ #[test]
30
+ fn test_descriptive_name() {
31
+ assert_eq!(exercise_function(1), 1);
32
+ }
33
+
34
+ #[test]
35
+ #[ignore]
36
+ fn test_second_and_past_tests_ignored() {
37
+ assert_ne!(exercise_function(1), 2);
38
+ }
39
+ ```
40
+
41
+ ## Opening an Issue
42
+
43
+ If you plan to make significant or breaking changes, please open an issue so we can discuss it first. If this is a discussion that is relevant to more than just the Rust track, please open an issue in [exercism/discussions](https://github.com/exercism/discussions/issues).
44
+
45
+ ## Submitting a Pull Request
46
+
47
+ Pull requests should be focused on a single exercise, issue, or conceptually cohesive change. Please refer to Exercism's [pull request guidelines](https://github.com/exercism/docs/blob/master/contributing/pull-request-guidelines.md).
48
+
49
+ Please follow the coding standards for Rust. [rustfmt](https://github.com/nrc/rustfmt) may help with this
50
+ and can be installed with `cargo install rustfmt`.
51
+
52
+ ### Verifying your Change
53
+
54
+ Before submitting your pull request, you'll want to verify the changes in two ways:
55
+
56
+ * Run all the tests for the Rust exercises
57
+ * Run an Exercism-specific linter to verify the track
58
+
59
+ All the tests for Rust exercises can be run from the top level of the repo with `_test/check-exercises.sh`. If you are on a Windows machine, there are additional [Windows-specific instructions](_test/WINDOWS_README.md) for running this.
60
+
61
+ For the Exercism-specific linting, please see [the documentation](https://github.com/exercism/docs/blob/master/language-tracks/configuration/linting.md).
62
+
63
+ ## Contributing a New Exercise
64
+
65
+ Please see the documentation about [adding new exercises](https://github.com/exercism/docs/blob/master/you-can-help/make-up-new-exercises.md).
66
+
67
+ Note that:
68
+
69
+ - Each exercise must stand on its own. Do not reference files outside the exercise directory. They will not be included when the user fetches the exercise.
70
+
71
+ - Exercises must conform to the Exercism-wide standards described in [the documentation](https://github.com/exercism/docs/tree/master/language-tracks/exercises).
72
+
73
+ - Each exercise should have:
74
+
75
+ exercises/exercise-name/
76
+ tests/exercise-name.rs <- a test suite
77
+ src/lib.rs <- an empty file or with exercise stubs
78
+ example.rs <- example solution that satisfies tests
79
+ Cargo.toml <- with version equal to exercise defintion
80
+ Cargo.lock <- Auto generated
81
+ README.md <- Instructions for the exercise (see notes below)
82
+
83
+ - The stub file and test suite should use only the Rust core libraries. `Cargo.toml` should not list any external dependencies as we don't want to make the student assume required crates. If an `example.rs` uses external crates, include `Cargo-example.toml` so that `_tests/check-exercises.sh` can compile with these when testing.
84
+
85
+ - If porting an existing exercise from problem-specifications that has a `canonical-data.json` file, use the version in `canonical-data.json` for that exercise as your `Cargo.toml` version. Otherwise, use "0.0.0".
86
+
87
+ - An exercise may contain `.meta/hints.md`. This is optional and will appear after the normal exercise
88
+ instructions if present. Rust is different in many ways from other languages. This is a place where the differences required for Rust are explained. If it is a large change, you may want to call this out as a comment at the top of `src/lib.rs`, so the user recognises to read this section before starting.
89
+
90
+ - `README.md` may be [regenerated](https://github.com/exercism/docs/blob/master/maintaining-a-track/regenerating-exercise-readmes.md) from Exercism data. The generator will use the `description.md` from the exercise directory in the [problem-specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises), then any hints in `.meta/hints.md`, then the [Rust-specific instructions](https://github.com/exercism/rust/blob/master/config/exercise-readme-insert.md). The `## Source` section comes from the `metadata.yml` in the same directory. Convention is that the description of the source remains text and the link is both name and hyperlink of the markdown link.
91
+
92
+ - Be sure to add the exercise to an appropriate place in the `config.json` file. The position in the file determines the order exercises are sent. Generate a unique UUID for the exercise. Current difficuly levels in use are 1, 4, 7 and 10.
12
93
 
13
94
  ## Rust icon
14
95
  The Rust Logo is created by the Mozilla Corporation, and has been released under the [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by/4.0/).