trackler 2.2.1.59 → 2.2.1.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/food-chain/canonical-data.json +31 -23
  4. data/problem-specifications/exercises/house/canonical-data.json +45 -33
  5. data/problem-specifications/exercises/house/description.md +1 -1
  6. data/problem-specifications/exercises/kindergarten-garden/description.md +3 -3
  7. data/problem-specifications/exercises/nucleotide-count/description.md +2 -2
  8. data/problem-specifications/exercises/palindrome-products/description.md +1 -1
  9. data/problem-specifications/exercises/rectangles/description.md +9 -9
  10. data/problem-specifications/exercises/twelve-days/canonical-data.json +171 -0
  11. data/problem-specifications/exercises/two-bucket/description.md +7 -7
  12. data/tracks/c/docs/CONTRIBUTING.md +88 -39
  13. data/tracks/c/exercises/phone-number/test/test_phone_number.c +33 -29
  14. data/tracks/c/exercises/triangle/src/example.c +12 -12
  15. data/tracks/c/exercises/triangle/src/example.h +3 -3
  16. data/tracks/c/exercises/triangle/test/test_triangle.c +16 -16
  17. data/tracks/c/exercises/word-count/src/example.c +12 -3
  18. data/tracks/c/exercises/word-count/src/word_count.h +10 -5
  19. data/tracks/c/exercises/word-count/test/test_word_count.c +248 -58
  20. data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +3 -3
  21. data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +2 -2
  22. data/tracks/dart/exercises/phone-number/README.md +1 -1
  23. data/tracks/dart/exercises/phone-number/test/phone_number_test.dart +5 -5
  24. data/tracks/gnu-apl/.dockerignore +5 -0
  25. data/tracks/gnu-apl/.travis.yml +9 -4
  26. data/tracks/gnu-apl/Dockerfiles/release.dockerfile +15 -0
  27. data/tracks/gnu-apl/Dockerfiles/svn.dockerfile +22 -0
  28. data/tracks/gnu-apl/README.md +1 -1
  29. data/tracks/gnu-apl/bin/install-apl +26 -0
  30. data/tracks/gnu-apl/test.apl +7 -6
  31. data/tracks/go/docs/TESTS.md +1 -1
  32. data/tracks/haskell/.travis.yml +1 -1
  33. data/tracks/haskell/config.json +9 -0
  34. data/tracks/haskell/exercises/accumulate/stack.yaml +1 -1
  35. data/tracks/haskell/exercises/acronym/package.yaml +1 -1
  36. data/tracks/haskell/exercises/acronym/stack.yaml +1 -1
  37. data/tracks/haskell/exercises/acronym/test/Tests.hs +3 -0
  38. data/tracks/haskell/exercises/all-your-base/stack.yaml +1 -1
  39. data/tracks/haskell/exercises/allergies/stack.yaml +1 -1
  40. data/tracks/haskell/exercises/alphametics/examples/success-standard/src/Alphametics.hs +2 -1
  41. data/tracks/haskell/exercises/alphametics/stack.yaml +1 -1
  42. data/tracks/haskell/exercises/anagram/stack.yaml +1 -1
  43. data/tracks/haskell/exercises/atbash-cipher/stack.yaml +1 -1
  44. data/tracks/haskell/exercises/bank-account/stack.yaml +1 -1
  45. data/tracks/haskell/exercises/beer-song/stack.yaml +1 -1
  46. data/tracks/haskell/exercises/binary-search-tree/stack.yaml +1 -1
  47. data/tracks/haskell/exercises/binary/stack.yaml +1 -1
  48. data/tracks/haskell/exercises/bob/stack.yaml +1 -1
  49. data/tracks/haskell/exercises/bowling/stack.yaml +1 -1
  50. data/tracks/haskell/exercises/bracket-push/stack.yaml +1 -1
  51. data/tracks/haskell/exercises/change/stack.yaml +1 -1
  52. data/tracks/haskell/exercises/clock/stack.yaml +1 -1
  53. data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -1
  54. data/tracks/haskell/exercises/complex-numbers/stack.yaml +1 -1
  55. data/tracks/haskell/exercises/connect/stack.yaml +1 -1
  56. data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
  57. data/tracks/haskell/exercises/crypto-square/stack.yaml +1 -1
  58. data/tracks/haskell/exercises/crypto-square/test/Tests.hs +9 -5
  59. data/tracks/haskell/exercises/custom-set/package.yaml +1 -1
  60. data/tracks/haskell/exercises/custom-set/stack.yaml +1 -1
  61. data/tracks/haskell/exercises/custom-set/test/Tests.hs +3 -0
  62. data/tracks/haskell/exercises/diamond/stack.yaml +1 -1
  63. data/tracks/haskell/exercises/difference-of-squares/stack.yaml +1 -1
  64. data/tracks/haskell/exercises/dominoes/README.md +3 -3
  65. data/tracks/haskell/exercises/dominoes/stack.yaml +1 -1
  66. data/tracks/haskell/exercises/etl/stack.yaml +1 -1
  67. data/tracks/haskell/exercises/food-chain/stack.yaml +1 -1
  68. data/tracks/haskell/exercises/forth/stack.yaml +1 -1
  69. data/tracks/haskell/exercises/gigasecond/stack.yaml +1 -1
  70. data/tracks/haskell/exercises/go-counting/stack.yaml +1 -1
  71. data/tracks/haskell/exercises/grade-school/stack.yaml +1 -1
  72. data/tracks/haskell/exercises/grains/stack.yaml +1 -1
  73. data/tracks/haskell/exercises/hamming/package.yaml +1 -1
  74. data/tracks/haskell/exercises/hamming/stack.yaml +1 -1
  75. data/tracks/haskell/exercises/hamming/test/Tests.hs +4 -4
  76. data/tracks/haskell/exercises/hello-world/stack.yaml +1 -1
  77. data/tracks/haskell/exercises/hexadecimal/stack.yaml +1 -1
  78. data/tracks/haskell/exercises/house/README.md +1 -1
  79. data/tracks/haskell/exercises/house/stack.yaml +1 -1
  80. data/tracks/haskell/exercises/isbn-verifier/README.md +96 -0
  81. data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/package.yaml +16 -0
  82. data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/src/IsbnVerifier.hs +10 -0
  83. data/tracks/haskell/exercises/isbn-verifier/package.yaml +20 -0
  84. data/tracks/haskell/exercises/isbn-verifier/src/IsbnVerifier.hs +4 -0
  85. data/tracks/haskell/exercises/isbn-verifier/stack.yaml +1 -0
  86. data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +74 -0
  87. data/tracks/haskell/exercises/isogram/stack.yaml +1 -1
  88. data/tracks/haskell/exercises/kindergarten-garden/README.md +3 -3
  89. data/tracks/haskell/exercises/kindergarten-garden/stack.yaml +1 -1
  90. data/tracks/haskell/exercises/largest-series-product/stack.yaml +1 -1
  91. data/tracks/haskell/exercises/leap/package.yaml +1 -1
  92. data/tracks/haskell/exercises/leap/stack.yaml +1 -1
  93. data/tracks/haskell/exercises/leap/test/Tests.hs +1 -1
  94. data/tracks/haskell/exercises/lens-person/stack.yaml +1 -1
  95. data/tracks/haskell/exercises/linked-list/stack.yaml +1 -1
  96. data/tracks/haskell/exercises/list-ops/stack.yaml +1 -1
  97. data/tracks/haskell/exercises/luhn/stack.yaml +1 -1
  98. data/tracks/haskell/exercises/matrix/stack.yaml +1 -1
  99. data/tracks/haskell/exercises/meetup/stack.yaml +1 -1
  100. data/tracks/haskell/exercises/minesweeper/stack.yaml +1 -1
  101. data/tracks/haskell/exercises/nth-prime/package.yaml +1 -1
  102. data/tracks/haskell/exercises/nth-prime/stack.yaml +1 -1
  103. data/tracks/haskell/exercises/nucleotide-count/README.md +2 -2
  104. data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -1
  105. data/tracks/haskell/exercises/nucleotide-count/stack.yaml +1 -1
  106. data/tracks/haskell/exercises/nucleotide-count/test/Tests.hs +6 -0
  107. data/tracks/haskell/exercises/ocr-numbers/stack.yaml +1 -1
  108. data/tracks/haskell/exercises/octal/stack.yaml +1 -1
  109. data/tracks/haskell/exercises/palindrome-products/README.md +1 -1
  110. data/tracks/haskell/exercises/palindrome-products/stack.yaml +1 -1
  111. data/tracks/haskell/exercises/pangram/package.yaml +1 -1
  112. data/tracks/haskell/exercises/pangram/stack.yaml +1 -1
  113. data/tracks/haskell/exercises/pangram/test/Tests.hs +6 -2
  114. data/tracks/haskell/exercises/parallel-letter-frequency/stack.yaml +1 -1
  115. data/tracks/haskell/exercises/pascals-triangle/stack.yaml +1 -1
  116. data/tracks/haskell/exercises/perfect-numbers/stack.yaml +1 -1
  117. data/tracks/haskell/exercises/phone-number/README.md +1 -1
  118. data/tracks/haskell/exercises/phone-number/stack.yaml +1 -1
  119. data/tracks/haskell/exercises/pig-latin/stack.yaml +1 -1
  120. data/tracks/haskell/exercises/pov/stack.yaml +1 -1
  121. data/tracks/haskell/exercises/prime-factors/stack.yaml +1 -1
  122. data/tracks/haskell/exercises/pythagorean-triplet/stack.yaml +1 -1
  123. data/tracks/haskell/exercises/queen-attack/stack.yaml +1 -1
  124. data/tracks/haskell/exercises/raindrops/stack.yaml +1 -1
  125. data/tracks/haskell/exercises/rna-transcription/stack.yaml +1 -1
  126. data/tracks/haskell/exercises/robot-name/stack.yaml +1 -1
  127. data/tracks/haskell/exercises/robot-simulator/stack.yaml +1 -1
  128. data/tracks/haskell/exercises/roman-numerals/stack.yaml +1 -1
  129. data/tracks/haskell/exercises/rotational-cipher/stack.yaml +1 -1
  130. data/tracks/haskell/exercises/run-length-encoding/stack.yaml +1 -1
  131. data/tracks/haskell/exercises/saddle-points/stack.yaml +1 -1
  132. data/tracks/haskell/exercises/say/stack.yaml +1 -1
  133. data/tracks/haskell/exercises/scrabble-score/stack.yaml +1 -1
  134. data/tracks/haskell/exercises/secret-handshake/stack.yaml +1 -1
  135. data/tracks/haskell/exercises/series/stack.yaml +1 -1
  136. data/tracks/haskell/exercises/sgf-parsing/stack.yaml +1 -1
  137. data/tracks/haskell/exercises/sieve/stack.yaml +1 -1
  138. data/tracks/haskell/exercises/simple-cipher/stack.yaml +1 -1
  139. data/tracks/haskell/exercises/simple-linked-list/stack.yaml +1 -1
  140. data/tracks/haskell/exercises/space-age/stack.yaml +1 -1
  141. data/tracks/haskell/exercises/spiral-matrix/stack.yaml +1 -1
  142. data/tracks/haskell/exercises/strain/stack.yaml +1 -1
  143. data/tracks/haskell/exercises/sublist/stack.yaml +1 -1
  144. data/tracks/haskell/exercises/sum-of-multiples/stack.yaml +1 -1
  145. data/tracks/haskell/exercises/triangle/stack.yaml +1 -1
  146. data/tracks/haskell/exercises/trinary/stack.yaml +1 -1
  147. data/tracks/haskell/exercises/word-count/stack.yaml +1 -1
  148. data/tracks/haskell/exercises/wordy/examples/success-standard/src/WordProblem.hs +6 -5
  149. data/tracks/haskell/exercises/wordy/stack.yaml +1 -1
  150. data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -1
  151. data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -1
  152. data/tracks/haskell/exercises/zipper/README.md +1 -1
  153. data/tracks/haskell/exercises/zipper/stack.yaml +1 -1
  154. data/tracks/javascript/.eslintignore +43 -0
  155. data/tracks/javascript/.travis.yml +2 -1
  156. data/tracks/javascript/exercises/bowling/README.md +5 -5
  157. data/tracks/javascript/exercises/crypto-square/example.js +2 -1
  158. data/tracks/javascript/exercises/diffie-hellman/diffie-hellman.spec.js +20 -20
  159. data/tracks/javascript/exercises/diffie-hellman/example.js +10 -10
  160. data/tracks/javascript/exercises/largest-series-product/example.js +2 -1
  161. data/tracks/javascript/exercises/sieve/example.js +5 -2
  162. data/tracks/javascript/package-lock.json +129 -76
  163. data/tracks/javascript/package.json +6 -5
  164. data/tracks/ocaml/config.json +10 -0
  165. data/tracks/ocaml/exercises/hamming/test.ml +3 -3
  166. data/tracks/ocaml/exercises/leap/test.ml +2 -2
  167. data/tracks/ocaml/exercises/pangram/test.ml +3 -3
  168. data/tracks/ocaml/exercises/rectangles/.merlin +5 -0
  169. data/tracks/ocaml/exercises/rectangles/Makefile +11 -0
  170. data/tracks/ocaml/exercises/rectangles/example.ml +30 -0
  171. data/tracks/ocaml/exercises/rectangles/rectangles.mli +1 -0
  172. data/tracks/ocaml/exercises/rectangles/test.ml +72 -0
  173. data/tracks/ocaml/tools/test-generator/templates/ocaml/leap/test.ml +1 -1
  174. data/tracks/ocaml/tools/test-generator/templates/ocaml/rectangles/test.ml +15 -0
  175. data/tracks/pony/README.md +1 -1
  176. data/tracks/pony/exercises/atbash-cipher/example.pony +6 -10
  177. data/tracks/pony/exercises/difference-of-squares/example.pony +3 -7
  178. data/tracks/rust/_test/count-ignores.sh +2 -2
  179. data/tracks/rust/config.json +24 -0
  180. data/tracks/rust/config/maintainers.json +10 -0
  181. data/tracks/rust/exercises/acronym/README.md +0 -1
  182. data/tracks/rust/exercises/all-your-base/README.md +1 -1
  183. data/tracks/rust/exercises/allergies/README.md +0 -1
  184. data/tracks/rust/exercises/alphametics/README.md +2 -2
  185. data/tracks/rust/exercises/atbash-cipher/README.md +2 -1
  186. data/tracks/rust/exercises/beer-song/README.md +1 -1
  187. data/tracks/rust/exercises/bowling/README.md +20 -6
  188. data/tracks/rust/exercises/circular-buffer/README.md +13 -6
  189. data/tracks/rust/exercises/crypto-square/README.md +10 -8
  190. data/tracks/rust/exercises/dominoes/Cargo.toml +1 -1
  191. data/tracks/rust/exercises/etl/README.md +2 -0
  192. data/tracks/rust/exercises/grade-school/README.md +0 -1
  193. data/tracks/rust/exercises/grains/README.md +0 -1
  194. data/tracks/rust/exercises/isbn-verifier/Cargo.lock +4 -0
  195. data/tracks/rust/exercises/isbn-verifier/Cargo.toml +3 -0
  196. data/tracks/rust/exercises/isbn-verifier/README.md +74 -0
  197. data/tracks/rust/exercises/isbn-verifier/example.rs +44 -0
  198. data/tracks/rust/exercises/isbn-verifier/src/lib.rs +4 -0
  199. data/tracks/rust/exercises/isbn-verifier/tests/isbn-verifier.rs +83 -0
  200. data/tracks/rust/exercises/isogram/README.md +3 -2
  201. data/tracks/rust/exercises/leap/README.md +1 -1
  202. data/tracks/rust/exercises/luhn/README.md +7 -7
  203. data/tracks/rust/exercises/nucleotide-count/README.md +8 -22
  204. data/tracks/rust/exercises/ocr-numbers/README.md +5 -5
  205. data/tracks/rust/exercises/pangram/README.md +1 -1
  206. data/tracks/rust/exercises/pascals-triangle/README.md +1 -1
  207. data/tracks/rust/exercises/perfect-numbers/README.md +2 -2
  208. data/tracks/rust/exercises/phone-number/README.md +3 -2
  209. data/tracks/rust/exercises/protein-translation/README.md +4 -5
  210. data/tracks/rust/exercises/proverb/README.md +13 -11
  211. data/tracks/rust/exercises/proverb/example.rs +14 -15
  212. data/tracks/rust/exercises/proverb/tests/proverb.rs +40 -13
  213. data/tracks/rust/exercises/pythagorean-triplet/README.md +3 -3
  214. data/tracks/rust/exercises/queen-attack/README.md +1 -1
  215. data/tracks/rust/exercises/rectangles/README.md +7 -7
  216. data/tracks/rust/exercises/roman-numerals/README.md +1 -1
  217. data/tracks/rust/exercises/rotational-cipher/README.md +2 -1
  218. data/tracks/rust/exercises/run-length-encoding/README.md +4 -4
  219. data/tracks/rust/exercises/scrabble-score/README.md +3 -1
  220. data/tracks/rust/exercises/space-age/README.md +1 -1
  221. data/tracks/rust/exercises/tournament/README.md +5 -5
  222. data/tracks/rust/exercises/triangle/README.md +9 -6
  223. data/tracks/rust/exercises/two-bucket/Cargo.lock +4 -0
  224. data/tracks/rust/exercises/two-bucket/Cargo.toml +3 -0
  225. data/tracks/rust/exercises/two-bucket/README.md +69 -0
  226. data/tracks/rust/exercises/two-bucket/example.rs +129 -0
  227. data/tracks/rust/exercises/two-bucket/src/lib.rs +26 -0
  228. data/tracks/rust/exercises/two-bucket/tests/two-bucket.rs +68 -0
  229. data/tracks/rust/exercises/variable-length-quantity/README.md +6 -7
  230. data/tracks/rust/exercises/word-count/README.md +1 -2
  231. data/tracks/rust/exercises/wordy/README.md +0 -5
  232. metadata +33 -4
  233. data/tracks/go/.github/PULL_REQUEST_TEMPLATE.md +0 -23
  234. data/tracks/ruby/.github/PULL_REQUEST_TEMPLATE.md +0 -40
@@ -5,15 +5,15 @@ Since this mathematical problem is fairly subject to interpretation / individual
5
5
  To help, the tests provide you with which bucket to fill first. That means, when starting with the larger bucket full, you are NOT allowed at any point to have the smaller bucket full and the larger bucket empty (aka, the opposite starting point); that would defeat the purpose of comparing both approaches!
6
6
 
7
7
  Your program will take as input:
8
- - the size of bucket one, passed as a numeric value
9
- - the size of bucket two, passed as a numeric value
10
- - the desired number of liters to reach, passed as a numeric value
11
- - which bucket to fill first, passed as a String (either 'one' or 'two')
8
+ - the size of bucket one
9
+ - the size of bucket two
10
+ - the desired number of liters to reach
11
+ - which bucket to fill first, either bucket one or bucket two
12
12
 
13
13
  Your program should determine:
14
- - the total number of "moves" it should take to reach the desired number of liters, including the first fill - expects a numeric value
15
- - which bucket should end up with the desired number of liters (let's say this is bucket A) - expects a String (either 'one' or 'two')
16
- - how many liters are left in the other bucket (bucket B) - expects a numeric value
14
+ - the total number of "moves" it should take to reach the desired number of liters, including the first fill
15
+ - which bucket should end up with the desired number of liters (let's say this is bucket A) - either bucket one or bucket two
16
+ - how many liters are left in the other bucket (bucket B)
17
17
 
18
18
  Note: any time a change is made to either or both buckets counts as one (1) move.
19
19
 
@@ -1,22 +1,71 @@
1
1
  # Contributing to the C Track
2
2
 
3
3
  Thank you for interest in contributing to the Exercism C language track!
4
- All contributions are welcome, be it a new exercise, a change to the tooling or documentation, a raised issue or even just a commment on an existing issue or PR.
4
+ All contributions are welcome, be it a new exercise, a change to the tooling or documentation, a raised issue or even just a comment on an existing issue or PR.
5
5
  This file provides information to help you get started.
6
6
 
7
7
  Firstly, have a read of the Exercism [docs repository](https://github.com/exercism/docs), specifically the information on [contributing to a language track](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md), as these documents cover a lot of the basic information.
8
8
 
9
9
  Subsequently note that there are a few things specific to this repository that are explained below.
10
10
 
11
+ We encourage contributions that provide fixes and improvements to existing exercises.
12
+ Please note that this track's exercises must conform to the standards determined in the [problem-specifications](https://github.com/exercism/problem-specifications) repository.
13
+ Changes to the tests or documentation of a common exercise will often warrant a pull request in that repository before it can be incorporated into this track's exercises.
14
+ If you're unsure, then go ahead and open a GitHub [issue](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md#issues), and we'll discuss the change.
15
+
16
+ ## Code of Conduct
17
+
18
+ Help us keep Exercism welcoming.
19
+ Please read and abide by the [Code of Conduct](https://github.com/exercism/exercism.io/blob/master/CODE_OF_CONDUCT.md).
20
+
21
+ ## Git Workflow
22
+
23
+ 1. Fork and clone.
24
+ 2. Add this repository as a new remote to your clone: `git remote add upstream https://github.com/exercism/c.git`
25
+ 3. Create a new branch: `git checkout -b name-of-branch`
26
+ 4. Commit and push as usual on your new branch
27
+ 5. When you're ready to submit a pull request, rebase your branch onto the upstream master so that you can resolve any conflicts: `git fetch upstream && git rebase upstream/master` You may need to push up to your branch using `--force` after resolving conflicts.
28
+ 6. When you've got everything ready, push up to your branch and create the pull request as outlined below.
29
+
30
+ ## Issues
31
+
32
+ We keep track of bugs, enhancements and support requests in the repository using GitHub [issues](https://github.com/exercism/c/issues).
33
+
34
+ For higher-level discussions about the project as a whole, check out the issues in the [discussions](https://github.com/exercism/discussions/issues) repository.
35
+
36
+ ### Good First Patch
37
+
38
+ We're trying to label issues with "good first patch" if we think that these can be solved without too much context about Exercism's codebase or functionality. To find them, you can do a [search](https://github.com/exercism/c/good-first-patch).
39
+
40
+ ## Pull Requests
41
+
42
+ It would be awesome if you follow these [simple guidelines](https://github.com/exercism/docs/blob/master/contributing/pull-request-guidelines.md) while creating your PR, but it isn't required.
43
+
44
+ Pull requests should be focused on a single, issue or change.
45
+ We welcome changes to code style and wording but please open a separate PR for these changes if possible.
46
+ Please open an issue before creating a PR that makes significant (breaking) changes to an existing exercise or makes changes across many exercises. It is best to discuss these changes before doing the work.
47
+
48
+ If your change is to an exercise you can run the CI scripts before submitting the pull request, or they will be automatically run after, as described in [Continuous Integration & Tests](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md#continuous-integration--tests)
49
+
50
+ When submitting a pull request, sometimes we will ask you to make changes before we accept the patch.
51
+
52
+ Please do not close the first pull request and open a second one with these changes.
53
+ If you push more commits to a branch that you've opened a pull request for, it automatically updates the pull request.
54
+
55
+ If you want to create a PR with changes that aren't quite ready to be merged to master yet (maybe you would like to discuss some particular item, for example), create the PR as normal but add `[WIP]` to the title so that maintainers know that it isn't quite ready to be merged just yet.
56
+
57
+ As with adding more commits, you do not need to close your pull request and open a new one if you change the history (rebase, squash, amend), and use git push --force to update the branch on your fork.
58
+ The pull request points to that branch, not to specific commits.
59
+
11
60
  ## Coding Style
12
61
 
13
- The code style expected for code change contributions is explained in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md#indentation-and-format).
14
- In short, they equate to the [Linux kernel coding style](https://www.kernel.org/doc/html/latest/process/coding-style.html) with 3 space indents and no tabs, and snake cased names.
62
+ The code style expected for code change contributions is explained in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md).
15
63
 
16
- The exercise code is checked during CI for conformance to the spacing and indentation style rules. The check uses the GNU `indent` CLI tool.
17
- When adding or making a change to an exercise, you can check that your change conforms to these rules by running the tool locally before commiting.
64
+ The exercise code is checked during [CI](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md#continuous-integration--tests) for conformance to the spacing and indentation style rules.
65
+ The check uses the GNU `indent` CLI tool.
66
+ When adding or making a change to an exercise, you can check that your change conforms to these rules by running the tool locally before committing.
18
67
 
19
- On linux `indent` should be available for install via your distribution's package manager.
68
+ On Linux `indent` should be available for install via your distribution's package manager.
20
69
  On a Mac you can install the package `gnu-indent` using [Homebrew](https://brew.sh).
21
70
 
22
71
  Indent can be run on all files by executing `indent.sh`.
@@ -32,10 +81,37 @@ If your system does not support the `-linux` option, you can run the long-form c
32
81
  indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i3 -nut -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -il1 $(file)
33
82
  ```
34
83
 
35
- ## Continuous Integration
84
+ ## Exercise anatomy
85
+
86
+ Each exercise should be contained in a directory `c/exercises/<my exercise>` with `<my exercise>` referring to the name of the exercise.
87
+ The structure of the directory is as follows:
88
+
89
+ ```
90
+ +-- <my exercise>
91
+ +-- makefile
92
+ +-- src
93
+ | +-- example.c
94
+ | +-- example.h | <my exercise>.h
95
+ +-- test
96
+ +-- test_<my exercise>.c
97
+ +-- vendor
98
+ +-- unity.c
99
+ +-- unity.h
100
+ +-- unity_internals.h
101
+ ```
102
+
103
+ * `test` - contains the test file `test_<my exercise>.c` and a `vendor` directory containing the test harness [Unity](http://www.throwtheswitch.org/unity/) from [ThrowTheSwitch](http://www.throwtheswitch.org/#intro-1-section).
104
+ ThrowTheSwitch has a decent guide on [getting started with Unity](http://www.throwtheswitch.org/getting-started-with-unity/) should you desire a tutorial. The layout of the test file is described in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md#test-file-layout).
105
+
106
+ * `src` - contains the example files `example.c` and `example.h`. These are both skipped by the `exercism` CLI when downloading to the client, so it is imperative that you do not reference the names of the files in your code.
107
+ If you need to provide a header file example that is necessary to run your tests it should be named `<my exercise>.h` instead.
108
+ Please also use [`include`](http://faculty.cs.niu.edu/~mcmahon/CS241/c241man/node90.html) guards in your header files.
109
+ The [tests](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md#what-are-the-ci-scripts) can be run using the [`bin/run-tests`](https://github.com/exercism/c/blob/master/bin/run-tests) script which will rename the `example.{c|h}` files accordingly.
110
+
111
+ ## Continuous Integration & Tests
36
112
 
37
113
  The repository uses Travis CI to run some scripts on each commit to a pull request.
38
- The simplest way to run these scripts on your own contribution is to open a PR on this repository with your changes, mark the title as [WIP] so that maintainers know that it isn't quite ready to be merged just yet and then allow this repository's CI setup to take care of things for you automatically.
114
+ The simplest way to run these scripts on your own contribution is to open a PR on this repository with your changes, edit the PR title to add `[WIP]` then allow this repository's CI setup to take care of things for you automatically.
39
115
 
40
116
  ### Run CI on Your Own Fork
41
117
 
@@ -43,8 +119,8 @@ If you would like, it is also possible to run Travis on your own fork.
43
119
  The good folks at fish-shell have [some great information](https://github.com/fish-shell/fish-shell/blob/master/CONTRIBUTING.md#travis-ci-build-and-test) to help you get started with setting up Travis on your own fork.
44
120
 
45
121
  ### Run CI Scripts Locally
46
- You can also run individual scripts on your own machine before commiting.
47
- Firstly make sure you have the necessary tools installed (such as `indent`, `git`, `sed`, `make`, `valgrind` and a C compiler), and then run the required script from the repoistory root. For example:
122
+ You can also run individual scripts on your own machine before committing.
123
+ Firstly make sure you have the necessary tools installed (such as `indent`, [`git`](https://git-scm.com/), [`sed`](https://www.gnu.org/software/sed/manual/sed.html), [`make`](https://www.gnu.org/software/make/), [`valgrind`](http://valgrind.org/) and a C compiler), and then run the required script from the repository root. For example:
48
124
 
49
125
  ```bash
50
126
  ~/git/c$ ./bin/run-tests
@@ -52,7 +128,7 @@ Firstly make sure you have the necessary tools installed (such as `indent`, `git
52
128
 
53
129
  ### What Are the CI Scripts?
54
130
  You can see from the [.travis.yml](https://github.com/exercism/c/blob/master/.travis.yml) file that Travis is instructed to run scripts from the [`./bin`](https://github.com/exercism/c/tree/master/bin) directory.
55
- The work these scripts perform is descibed as folows:
131
+ The work these scripts perform is described as follows:
56
132
 
57
133
  - `fetch-configlet` just fetches the `configlet` tool from its [repository](https://github.com/exercism/configlet).
58
134
 
@@ -62,32 +138,5 @@ The command for `configlet` used by Travis is [`lint`](https://github.com/exerci
62
138
  - `verify-indent` runs `indent` and verifies that it did not result in any file changes.
63
139
  If the check does result in file changes, Travis will output the details and report a failure on the related PR.
64
140
 
65
- - `run-tests` loops through each exercise, prepares the exercise for building and then builds it using `make` and runs `valgrind`.
141
+ - `run-tests` loops through each exercise, prepares the exercise for building and then builds it using `make`, runs the unit tests and then checks it for memory leaks with `valgrind`.
66
142
  If there are build errors, any test fails or there is a memory leak, Travis will output the details and report a failure on the related PR.
67
-
68
- ## Exercise anatomy
69
-
70
- Each exercise should be contained in a directory `c/exercises/<my exercise>` with `<my exercise>` referring to the name of the exercise.
71
- The structure of the directory is as follows:
72
-
73
- ```
74
- +-- <my exercise>
75
- +-- makefile
76
- +-- src
77
- | +-- example.c
78
- | +-- example.h | <my exercise>.h
79
- +-- test
80
- +-- test_<my exercise>.c
81
- +-- vendor
82
- +-- unity.c
83
- +-- unity.h
84
- +-- unity_internals.h
85
- ```
86
-
87
- * `test` - contains the test file `test_<my exercise>.c` and a `vendor` directory containing the test harness [Unity](http://www.throwtheswitch.org/unity/) from [ThrowTheSwitch](http://www.throwtheswitch.org/#intro-1-section).
88
- ThrowTheSwitch has a decent guide on [getting started with Unity](http://www.throwtheswitch.org/getting-started-with-unity/) should you desire a tutorial. The layout of the test file is described in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md#test-file-layout).
89
-
90
- * `src` - contains the example files `example.c` and `example.h`. These are both skipped by the `exercism` CLI when downloading to the client, so it is imperative that you do not reference the names of the files in your code.
91
- If you need to provide a header file example that is necessary to run your tests it should be named `<my exercise>.h` instead.
92
- Please also use [`include`](http://faculty.cs.niu.edu/~mcmahon/CS241/c241man/node90.html) guards in your header files.
93
- The tests can be run using the [`bin/run-tests`](https://github.com/exercism/c/blob/master/bin/run-tests) script which will rename the `example.{c|h}` files accordingly.
@@ -2,39 +2,36 @@
2
2
  #include "../src/phone_number.h"
3
3
  #include <stdlib.h>
4
4
 
5
+ char *result;
6
+
5
7
  void setUp(void)
6
8
  {
7
9
  }
8
10
 
9
11
  void tearDown(void)
10
12
  {
11
- }
12
-
13
- void test_phone_number_clean(const char *input, const char *expected)
14
- {
15
- char *result = phone_number_clean(input);
16
-
17
- TEST_ASSERT_EQUAL_STRING(expected, result);
18
-
19
13
  free(result);
20
14
  }
21
15
 
22
16
  void test_cleans_parens_dashes_and_spaces_from_the_number(void)
23
17
  {
24
- TEST_IGNORE(); // delete this line to run test
25
18
  const char input[] = "(123) 456-7890";
26
19
  const char expected[] = "1234567890";
27
20
 
28
- test_phone_number_clean(input, expected);
21
+ result = phone_number_clean(input);
22
+
23
+ TEST_ASSERT_EQUAL_STRING(expected, result);
29
24
  }
30
25
 
31
26
  void test_cleans_numbers_with_dots(void)
32
27
  {
33
- TEST_IGNORE();
28
+ TEST_IGNORE(); // delete this line to run test
34
29
  const char input[] = "123.456.7890";
35
30
  const char expected[] = "1234567890";
36
31
 
37
- test_phone_number_clean(input, expected);
32
+ result = phone_number_clean(input);
33
+
34
+ TEST_ASSERT_EQUAL_STRING(expected, result);
38
35
  }
39
36
 
40
37
  void test_cleans_numbers_with_multiple_spaces(void)
@@ -43,7 +40,9 @@ void test_cleans_numbers_with_multiple_spaces(void)
43
40
  const char input[] = "123 456 7890 ";
44
41
  const char expected[] = "1234567890";
45
42
 
46
- test_phone_number_clean(input, expected);
43
+ result = phone_number_clean(input);
44
+
45
+ TEST_ASSERT_EQUAL_STRING(expected, result);
47
46
  }
48
47
 
49
48
  void test_invalid_when_9_digits(void)
@@ -52,7 +51,9 @@ void test_invalid_when_9_digits(void)
52
51
  const char input[] = "123456789";
53
52
  const char expected[] = "0000000000";
54
53
 
55
- test_phone_number_clean(input, expected);
54
+ result = phone_number_clean(input);
55
+
56
+ TEST_ASSERT_EQUAL_STRING(expected, result);
56
57
  }
57
58
 
58
59
  void test_valid_when_11_digits_and_first_digit_is_1(void)
@@ -61,7 +62,9 @@ void test_valid_when_11_digits_and_first_digit_is_1(void)
61
62
  const char input[] = "11234567890";
62
63
  const char expected[] = "1234567890";
63
64
 
64
- test_phone_number_clean(input, expected);
65
+ result = phone_number_clean(input);
66
+
67
+ TEST_ASSERT_EQUAL_STRING(expected, result);
65
68
  }
66
69
 
67
70
  void test_invalid_when_11_digits_and_first_digit_not_1(void)
@@ -70,7 +73,9 @@ void test_invalid_when_11_digits_and_first_digit_not_1(void)
70
73
  const char input[] = "21234567890";
71
74
  const char expected[] = "0000000000";
72
75
 
73
- test_phone_number_clean(input, expected);
76
+ result = phone_number_clean(input);
77
+
78
+ TEST_ASSERT_EQUAL_STRING(expected, result);
74
79
  }
75
80
 
76
81
  void test_invalid_when_more_than_11_digits(void)
@@ -79,7 +84,9 @@ void test_invalid_when_more_than_11_digits(void)
79
84
  const char input[] = "121234567890";
80
85
  const char expected[] = "0000000000";
81
86
 
82
- test_phone_number_clean(input, expected);
87
+ result = phone_number_clean(input);
88
+
89
+ TEST_ASSERT_EQUAL_STRING(expected, result);
83
90
  }
84
91
 
85
92
  void test_invalid_with_letters(void)
@@ -88,7 +95,9 @@ void test_invalid_with_letters(void)
88
95
  const char input[] = "123-abc-7890";
89
96
  const char expected[] = "0000000000";
90
97
 
91
- test_phone_number_clean(input, expected);
98
+ result = phone_number_clean(input);
99
+
100
+ TEST_ASSERT_EQUAL_STRING(expected, result);
92
101
  }
93
102
 
94
103
  void test_invalid_with_punctuations(void)
@@ -97,7 +106,9 @@ void test_invalid_with_punctuations(void)
97
106
  const char input[] = "123-@:!-7890";
98
107
  const char expected[] = "0000000000";
99
108
 
100
- test_phone_number_clean(input, expected);
109
+ result = phone_number_clean(input);
110
+
111
+ TEST_ASSERT_EQUAL_STRING(expected, result);
101
112
  }
102
113
 
103
114
  void test_invalid_with_right_number_of_digits_but_letters_mixed_in(void)
@@ -106,7 +117,9 @@ void test_invalid_with_right_number_of_digits_but_letters_mixed_in(void)
106
117
  const char input[] = "1a2b3c4d5e6f7g8h9i0j";
107
118
  const char expected[] = "0000000000";
108
119
 
109
- test_phone_number_clean(input, expected);
120
+ result = phone_number_clean(input);
121
+
122
+ TEST_ASSERT_EQUAL_STRING(expected, result);
110
123
  }
111
124
 
112
125
  void test_returns_area_code(void)
@@ -114,13 +127,10 @@ void test_returns_area_code(void)
114
127
  TEST_IGNORE();
115
128
  const char input[] = "5024567890";
116
129
  const char expected[] = "502";
117
- char *result;
118
130
 
119
131
  result = phone_number_get_area_code(input);
120
132
 
121
133
  TEST_ASSERT_EQUAL_STRING(expected, result);
122
-
123
- free(result);
124
134
  }
125
135
 
126
136
  void test_formats_a_number(void)
@@ -128,13 +138,10 @@ void test_formats_a_number(void)
128
138
  TEST_IGNORE();
129
139
  const char input[] = "1234567890";
130
140
  const char expected[] = "(123) 456-7890";
131
- char *result;
132
141
 
133
142
  result = phone_number_format(input);
134
143
 
135
144
  TEST_ASSERT_EQUAL_STRING(expected, result);
136
-
137
- free(result);
138
145
  }
139
146
 
140
147
  void test_cleans_number_before_formatting(void)
@@ -142,13 +149,10 @@ void test_cleans_number_before_formatting(void)
142
149
  TEST_IGNORE();
143
150
  const char input[] = "123-456-7890";
144
151
  const char expected[] = "(123) 456-7890";
145
- char *result;
146
152
 
147
153
  result = phone_number_format(input);
148
154
 
149
155
  TEST_ASSERT_EQUAL_STRING(expected, result);
150
-
151
- free(result);
152
156
  }
153
157
 
154
158
  int main(void)
@@ -1,30 +1,30 @@
1
1
  #include "triangle.h"
2
2
 
3
- bool triangle_equality(triangle_t * input)
3
+ bool triangle_equality(triangle_t input)
4
4
  {
5
- return (input->a < (input->b + input->c)
6
- && input->b < (input->a + input->c)
7
- && input->c < (input->a + input->b)
5
+ return (input.a < (input.b + input.c)
6
+ && input.b < (input.a + input.c)
7
+ && input.c < (input.a + input.b)
8
8
  );
9
9
  }
10
10
 
11
- bool is_equilateral(triangle_t * input)
11
+ bool is_equilateral(triangle_t input)
12
12
  {
13
13
  return (triangle_equality(input)
14
- && (input->a == input->b)
15
- && (input->b == input->c)
14
+ && (input.a == input.b)
15
+ && (input.b == input.c)
16
16
  );
17
17
  }
18
18
 
19
- bool is_isosceles(triangle_t * input)
19
+ bool is_isosceles(triangle_t input)
20
20
  {
21
- return (triangle_equality(input) && ((input->a == input->b)
22
- || (input->b == input->c)
23
- || (input->a == input->c))
21
+ return (triangle_equality(input) && ((input.a == input.b)
22
+ || (input.b == input.c)
23
+ || (input.a == input.c))
24
24
  );
25
25
  }
26
26
 
27
- bool is_scalene(triangle_t * input)
27
+ bool is_scalene(triangle_t input)
28
28
  {
29
29
  return (!(is_equilateral(input))
30
30
  && !(is_isosceles(input))
@@ -8,8 +8,8 @@ typedef struct {
8
8
  double c;
9
9
  } triangle_t;
10
10
 
11
- bool is_equilateral(triangle_t * input);
12
- bool is_isosceles(triangle_t * input);
13
- bool is_scalene(triangle_t * input);
11
+ bool is_equilateral(triangle_t input);
12
+ bool is_isosceles(triangle_t input);
13
+ bool is_scalene(triangle_t input);
14
14
 
15
15
  #endif
@@ -12,112 +12,112 @@ void tearDown(void)
12
12
  void test_equilateral_is_true_if_all_sides_are_equal(void)
13
13
  {
14
14
  triangle_t sides = { 2, 2, 2 };
15
- TEST_ASSERT_TRUE(is_equilateral(&sides));
15
+ TEST_ASSERT_TRUE(is_equilateral(sides));
16
16
  }
17
17
 
18
18
  void test_equilateral_is_false_if_any_side_is_unequal(void)
19
19
  {
20
20
  TEST_IGNORE(); // delete this line to run test
21
21
  triangle_t sides = { 2, 3, 2 };
22
- TEST_ASSERT_FALSE(is_equilateral(&sides));
22
+ TEST_ASSERT_FALSE(is_equilateral(sides));
23
23
  }
24
24
 
25
25
  void test_equilateral_is_false_if_all_sides_zero(void)
26
26
  {
27
27
  TEST_IGNORE();
28
28
  triangle_t sides = { 0, 0, 0 };
29
- TEST_ASSERT_FALSE(is_equilateral(&sides));
29
+ TEST_ASSERT_FALSE(is_equilateral(sides));
30
30
  }
31
31
 
32
32
  void test_equilateral_sides_may_be_floats(void)
33
33
  {
34
34
  TEST_IGNORE();
35
35
  triangle_t sides = { 0.5, 0.5, 0.5 };
36
- TEST_ASSERT_TRUE(is_equilateral(&sides));
36
+ TEST_ASSERT_TRUE(is_equilateral(sides));
37
37
  }
38
38
 
39
39
  void test_isosceles_is_true_if_last_two_sides_are_equal(void)
40
40
  {
41
41
  TEST_IGNORE();
42
42
  triangle_t sides = { 3, 4, 4 };
43
- TEST_ASSERT_TRUE(is_isosceles(&sides));
43
+ TEST_ASSERT_TRUE(is_isosceles(sides));
44
44
  }
45
45
 
46
46
  void test_isosceles_is_true_if_first_two_sides_are_equal(void)
47
47
  {
48
48
  TEST_IGNORE();
49
49
  triangle_t sides = { 4, 4, 3 };
50
- TEST_ASSERT_TRUE(is_isosceles(&sides));
50
+ TEST_ASSERT_TRUE(is_isosceles(sides));
51
51
  }
52
52
 
53
53
  void test_isosceles_is_true_if_first_and_last_sides_are_equal(void)
54
54
  {
55
55
  TEST_IGNORE();
56
56
  triangle_t sides = { 4, 3, 4 };
57
- TEST_ASSERT_TRUE(is_isosceles(&sides));
57
+ TEST_ASSERT_TRUE(is_isosceles(sides));
58
58
  }
59
59
 
60
60
  void test_equilateral_triangles_are_also_isosceles(void)
61
61
  {
62
62
  TEST_IGNORE();
63
63
  triangle_t sides = { 4, 4, 4 };
64
- TEST_ASSERT_TRUE(is_isosceles(&sides));
64
+ TEST_ASSERT_TRUE(is_isosceles(sides));
65
65
  }
66
66
 
67
67
  void test_isosceles_is_false_if_no_sides_are_equal(void)
68
68
  {
69
69
  TEST_IGNORE();
70
70
  triangle_t sides = { 2, 3, 4 };
71
- TEST_ASSERT_FALSE(is_isosceles(&sides));
71
+ TEST_ASSERT_FALSE(is_isosceles(sides));
72
72
  }
73
73
 
74
74
  void test_isosceles_is_false_if_two_sides_equal_and_violate_inequality(void)
75
75
  {
76
76
  TEST_IGNORE();
77
77
  triangle_t sides = { 1, 1, 3 };
78
- TEST_ASSERT_FALSE(is_isosceles(&sides));
78
+ TEST_ASSERT_FALSE(is_isosceles(sides));
79
79
  }
80
80
 
81
81
  void test_isosceles_sides_may_be_floats(void)
82
82
  {
83
83
  TEST_IGNORE();
84
84
  triangle_t sides = { 0.5, 0.4, 0.5 };
85
- TEST_ASSERT_TRUE(is_isosceles(&sides));
85
+ TEST_ASSERT_TRUE(is_isosceles(sides));
86
86
  }
87
87
 
88
88
  void test_scalene_is_true_if_no_sides_are_equal(void)
89
89
  {
90
90
  TEST_IGNORE();
91
91
  triangle_t sides = { 5, 4, 6 };
92
- TEST_ASSERT_TRUE(is_scalene(&sides));
92
+ TEST_ASSERT_TRUE(is_scalene(sides));
93
93
  }
94
94
 
95
95
  void test_scalene_is_false_if_all_sides_are_equal(void)
96
96
  {
97
97
  TEST_IGNORE();
98
98
  triangle_t sides = { 4, 4, 4 };
99
- TEST_ASSERT_FALSE(is_scalene(&sides));
99
+ TEST_ASSERT_FALSE(is_scalene(sides));
100
100
  }
101
101
 
102
102
  void test_scalene_is_false_if_two_sides_are_equal(void)
103
103
  {
104
104
  TEST_IGNORE();
105
105
  triangle_t sides = { 4, 4, 3 };
106
- TEST_ASSERT_FALSE(is_scalene(&sides));
106
+ TEST_ASSERT_FALSE(is_scalene(sides));
107
107
  }
108
108
 
109
109
  void test_scalene_is_false_if_no_sides_equal_and_violate_inequality(void)
110
110
  {
111
111
  TEST_IGNORE();
112
112
  triangle_t sides = { 7, 3, 2 };
113
- TEST_ASSERT_FALSE(is_scalene(&sides));
113
+ TEST_ASSERT_FALSE(is_scalene(sides));
114
114
  }
115
115
 
116
116
  void test_scalene_sides_may_be_floats(void)
117
117
  {
118
118
  TEST_IGNORE();
119
119
  triangle_t sides = { 0.5, 0.4, 0.6 };
120
- TEST_ASSERT_TRUE(is_scalene(&sides));
120
+ TEST_ASSERT_TRUE(is_scalene(sides));
121
121
  }
122
122
 
123
123
  int main(void)