trackler 2.2.1.74 → 2.2.1.75

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 (227) hide show
  1. checksums.yaml +4 -4
  2. data/fixtures/tracks/fruit/docs/something.md +0 -0
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/README.md +8 -4
  5. data/problem-specifications/exercises/acronym/canonical-data.json +19 -7
  6. data/problem-specifications/exercises/all-your-base/canonical-data.json +106 -64
  7. data/problem-specifications/exercises/allergies/canonical-data.json +37 -13
  8. data/tracks/c/config.json +176 -176
  9. data/tracks/clojure/config.json +17 -1
  10. data/tracks/clojure/exercises/isbn-verifier/README.md +43 -0
  11. data/tracks/clojure/exercises/isbn-verifier/project.clj +4 -0
  12. data/tracks/clojure/exercises/isbn-verifier/src/example.clj +17 -0
  13. data/tracks/clojure/exercises/isbn-verifier/src/isbn_verifier.clj +3 -0
  14. data/tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj +42 -0
  15. data/tracks/clojure/exercises/proverb/README.md +15 -0
  16. data/tracks/clojure/exercises/proverb/project.clj +4 -0
  17. data/tracks/clojure/exercises/proverb/src/example.clj +15 -0
  18. data/tracks/clojure/exercises/proverb/src/proverb.clj +3 -0
  19. data/tracks/clojure/exercises/proverb/test/proverb_test.clj +14 -0
  20. data/tracks/common-lisp/docs/LEARNING.md +4 -3
  21. data/tracks/common-lisp/docs/RESOURCES.md +11 -0
  22. data/tracks/delphi/.gitignore +1 -0
  23. data/tracks/delphi/config.json +24 -0
  24. data/tracks/delphi/docs/INSTALLATION.md +1 -1
  25. data/tracks/delphi/exercises/isbn-verifier/ISBNVerifier.dpr +60 -0
  26. data/tracks/delphi/exercises/isbn-verifier/README.md +68 -0
  27. data/tracks/delphi/exercises/isbn-verifier/uISBNVerifierExample.pas +46 -0
  28. data/tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas +136 -0
  29. data/tracks/delphi/exercises/secret-handshake/README.md +56 -0
  30. data/tracks/delphi/exercises/secret-handshake/SecretHandshake.dpr +60 -0
  31. data/tracks/delphi/exercises/secret-handshake/uSecretHandshakeExample.pas +56 -0
  32. data/tracks/delphi/exercises/secret-handshake/uTestSecretHandshake.pas +215 -0
  33. data/tracks/ecmascript/docs/ABOUT.md +13 -9
  34. data/tracks/factor/exercises/two-fer/README.md +1 -1
  35. data/tracks/fsharp/docs/RESOURCES.md +1 -1
  36. data/tracks/fsharp/generators/{Input.fs → CanonicalData.fs} +5 -10
  37. data/tracks/fsharp/generators/Exercise.fs +11 -10
  38. data/tracks/fsharp/generators/{Output.fs → Formatting.fs} +2 -56
  39. data/tracks/fsharp/generators/Generators.fs +93 -93
  40. data/tracks/fsharp/generators/Generators.fsproj +9 -4
  41. data/tracks/fsharp/generators/Options.fs +1 -1
  42. data/tracks/fsharp/generators/Program.fs +3 -3
  43. data/tracks/fsharp/generators/Rendering.fs +57 -0
  44. data/tracks/go/exercises/all-your-base/.meta/gen.go +80 -0
  45. data/tracks/go/exercises/all-your-base/.meta/hints.md +13 -0
  46. data/tracks/go/exercises/all-your-base/README.md +16 -1
  47. data/tracks/go/exercises/all-your-base/all_your_base_test.go +12 -163
  48. data/tracks/go/exercises/all-your-base/cases_test.go +183 -0
  49. data/tracks/go/exercises/all-your-base/example.go +25 -29
  50. data/tracks/java/CONTRIBUTING.md +1 -1
  51. data/tracks/java/POLICIES.md +15 -1
  52. data/tracks/java/exercises/flatten-array/.meta/hints.md +58 -0
  53. data/tracks/java/exercises/flatten-array/README.md +62 -0
  54. data/tracks/java/exercises/hamming/src/main/java/Hamming.java +1 -1
  55. data/tracks/java/exercises/matrix/.meta/src/reference/java/Matrix.java +6 -6
  56. data/tracks/java/exercises/meetup/.meta/src/reference/java/Meetup.java +2 -2
  57. data/tracks/java/exercises/meetup/.meta/src/reference/java/MeetupSchedule.java +1 -1
  58. data/tracks/java/exercises/meetup/src/main/java/MeetupSchedule.java +1 -1
  59. data/tracks/java/exercises/pig-latin/.meta/hints.md +58 -0
  60. data/tracks/java/exercises/pig-latin/README.md +61 -0
  61. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +2 -2
  62. data/tracks/java/exercises/secret-handshake/README.md +1 -1
  63. data/tracks/javascript/.eslintignore +0 -3
  64. data/tracks/javascript/exercises/food-chain/example.js +50 -37
  65. data/tracks/javascript/exercises/octal/example.js +1 -1
  66. data/tracks/javascript/exercises/robot-name/robot-name.spec.js +7 -7
  67. data/tracks/javascript/package-lock.json +1846 -0
  68. data/tracks/python/docs/EXERCISE_README_INSERT.md +15 -0
  69. data/tracks/python/exercises/accumulate/README.md +15 -0
  70. data/tracks/python/exercises/acronym/README.md +15 -0
  71. data/tracks/python/exercises/all-your-base/README.md +15 -0
  72. data/tracks/python/exercises/all-your-base/all_your_base_test.py +19 -9
  73. data/tracks/python/exercises/allergies/README.md +15 -0
  74. data/tracks/python/exercises/alphametics/README.md +15 -0
  75. data/tracks/python/exercises/anagram/README.md +15 -0
  76. data/tracks/python/exercises/atbash-cipher/README.md +15 -0
  77. data/tracks/python/exercises/beer-song/README.md +16 -1
  78. data/tracks/python/exercises/binary-search-tree/README.md +16 -2
  79. data/tracks/python/exercises/binary-search/README.md +15 -0
  80. data/tracks/python/exercises/binary-search/binary_search_test.py +14 -4
  81. data/tracks/python/exercises/binary/README.md +15 -0
  82. data/tracks/python/exercises/binary/binary_test.py +14 -4
  83. data/tracks/python/exercises/bob/README.md +15 -0
  84. data/tracks/python/exercises/book-store/README.md +15 -0
  85. data/tracks/python/exercises/bracket-push/README.md +15 -0
  86. data/tracks/python/exercises/change/README.md +15 -0
  87. data/tracks/python/exercises/circular-buffer/README.md +15 -0
  88. data/tracks/python/exercises/circular-buffer/circular_buffer_test.py +15 -5
  89. data/tracks/python/exercises/circular-buffer/example.py +2 -2
  90. data/tracks/python/exercises/clock/README.md +15 -0
  91. data/tracks/python/exercises/collatz-conjecture/.meta/hints.md +1 -1
  92. data/tracks/python/exercises/collatz-conjecture/README.md +15 -0
  93. data/tracks/python/exercises/complex-numbers/README.md +15 -0
  94. data/tracks/python/exercises/connect/README.md +18 -3
  95. data/tracks/python/exercises/crypto-square/README.md +15 -0
  96. data/tracks/python/exercises/diamond/README.md +15 -0
  97. data/tracks/python/exercises/difference-of-squares/README.md +15 -0
  98. data/tracks/python/exercises/diffie-hellman/README.md +14 -0
  99. data/tracks/python/exercises/dominoes/README.md +16 -1
  100. data/tracks/python/exercises/error-handling/README.md +17 -0
  101. data/tracks/python/exercises/error-handling/error_handling_test.py +13 -3
  102. data/tracks/python/exercises/error-handling/example.py +1 -1
  103. data/tracks/python/exercises/etl/README.md +16 -1
  104. data/tracks/python/exercises/flatten-array/README.md +15 -0
  105. data/tracks/python/exercises/food-chain/README.md +15 -0
  106. data/tracks/python/exercises/forth/README.md +15 -0
  107. data/tracks/python/exercises/forth/example.py +7 -9
  108. data/tracks/python/exercises/forth/forth_test.py +107 -17
  109. data/tracks/python/exercises/gigasecond/README.md +15 -0
  110. data/tracks/python/exercises/go-counting/README.md +21 -3
  111. data/tracks/python/exercises/grade-school/README.md +15 -0
  112. data/tracks/python/exercises/grains/README.md +15 -0
  113. data/tracks/python/exercises/grains/grains_test.py +16 -6
  114. data/tracks/python/exercises/grep/README.md +15 -0
  115. data/tracks/python/exercises/hamming/README.md +15 -0
  116. data/tracks/python/exercises/hamming/hamming_test.py +12 -2
  117. data/tracks/python/exercises/hello-world/README.md +15 -0
  118. data/tracks/python/exercises/hexadecimal/README.md +15 -0
  119. data/tracks/python/exercises/hexadecimal/hexadecimal_test.py +11 -1
  120. data/tracks/python/exercises/house/README.md +16 -1
  121. data/tracks/python/exercises/isogram/README.md +15 -0
  122. data/tracks/python/exercises/kindergarten-garden/README.md +18 -3
  123. data/tracks/python/exercises/largest-series-product/README.md +15 -0
  124. data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +14 -4
  125. data/tracks/python/exercises/leap/README.md +15 -0
  126. data/tracks/python/exercises/linked-list/README.md +15 -0
  127. data/tracks/python/exercises/list-ops/README.md +15 -0
  128. data/tracks/python/exercises/luhn/README.md +15 -0
  129. data/tracks/python/exercises/markdown/README.md +18 -0
  130. data/tracks/python/exercises/matrix/README.md +15 -0
  131. data/tracks/python/exercises/meetup/README.md +31 -12
  132. data/tracks/python/exercises/meetup/meetup_test.py +11 -1
  133. data/tracks/python/exercises/minesweeper/README.md +15 -0
  134. data/tracks/python/exercises/minesweeper/minesweeper_test.py +12 -2
  135. data/tracks/python/exercises/nth-prime/README.md +15 -0
  136. data/tracks/python/exercises/nth-prime/nth_prime_test.py +11 -1
  137. data/tracks/python/exercises/nucleotide-count/README.md +17 -2
  138. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +11 -1
  139. data/tracks/python/exercises/ocr-numbers/README.md +16 -1
  140. data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +12 -2
  141. data/tracks/python/exercises/octal/README.md +15 -0
  142. data/tracks/python/exercises/octal/octal_test.py +16 -3
  143. data/tracks/python/exercises/palindrome-products/README.md +16 -1
  144. data/tracks/python/exercises/pangram/README.md +15 -0
  145. data/tracks/python/exercises/pascals-triangle/README.md +16 -1
  146. data/tracks/python/exercises/perfect-numbers/README.md +15 -0
  147. data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +13 -3
  148. data/tracks/python/exercises/phone-number/README.md +16 -2
  149. data/tracks/python/exercises/phone-number/example.py +1 -1
  150. data/tracks/python/exercises/phone-number/phone_number_test.py +17 -7
  151. data/tracks/python/exercises/pig-latin/README.md +15 -0
  152. data/tracks/python/exercises/point-mutations/README.md +15 -0
  153. data/tracks/python/exercises/poker/README.md +15 -0
  154. data/tracks/python/exercises/pov/README.md +20 -2
  155. data/tracks/python/exercises/pov/example.py +2 -2
  156. data/tracks/python/exercises/pov/pov_test.py +15 -5
  157. data/tracks/python/exercises/prime-factors/README.md +15 -0
  158. data/tracks/python/exercises/protein-translation/README.md +15 -0
  159. data/tracks/python/exercises/protein-translation/protein_translation_test.py +10 -0
  160. data/tracks/python/exercises/proverb/README.md +14 -0
  161. data/tracks/python/exercises/pythagorean-triplet/README.md +15 -0
  162. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +11 -1
  163. data/tracks/python/exercises/queen-attack/README.md +15 -0
  164. data/tracks/python/exercises/queen-attack/queen_attack_test.py +17 -7
  165. data/tracks/python/exercises/rail-fence-cipher/README.md +15 -0
  166. data/tracks/python/exercises/raindrops/README.md +15 -0
  167. data/tracks/python/exercises/react/README.md +15 -1
  168. data/tracks/python/exercises/rectangles/README.md +24 -9
  169. data/tracks/python/exercises/rna-transcription/.meta/hints.md +1 -0
  170. data/tracks/python/exercises/rna-transcription/README.md +18 -5
  171. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +13 -3
  172. data/tracks/python/exercises/robot-name/README.md +15 -0
  173. data/tracks/python/exercises/robot-simulator/README.md +15 -0
  174. data/tracks/python/exercises/roman-numerals/README.md +15 -0
  175. data/tracks/python/exercises/rotational-cipher/README.md +15 -0
  176. data/tracks/python/exercises/run-length-encoding/README.md +15 -0
  177. data/tracks/python/exercises/saddle-points/README.md +15 -0
  178. data/tracks/python/exercises/saddle-points/saddle_points_test.py +11 -1
  179. data/tracks/python/exercises/say/README.md +15 -0
  180. data/tracks/python/exercises/say/say_test.py +12 -2
  181. data/tracks/python/exercises/scale-generator/README.md +15 -0
  182. data/tracks/python/exercises/scale-generator/example.py +3 -3
  183. data/tracks/python/exercises/scale-generator/scale_generator_test.py +11 -1
  184. data/tracks/python/exercises/scrabble-score/README.md +15 -0
  185. data/tracks/python/exercises/secret-handshake/README.md +16 -1
  186. data/tracks/python/exercises/series/README.md +15 -0
  187. data/tracks/python/exercises/series/series_test.py +12 -2
  188. data/tracks/python/exercises/sieve/README.md +15 -0
  189. data/tracks/python/exercises/simple-cipher/.meta/hints.md +6 -6
  190. data/tracks/python/exercises/simple-cipher/README.md +17 -1
  191. data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +12 -2
  192. data/tracks/python/exercises/simple-linked-list/{hints.md → .meta/hints.md} +10 -10
  193. data/tracks/python/exercises/simple-linked-list/README.md +16 -0
  194. data/tracks/python/exercises/simple-linked-list/example.py +2 -2
  195. data/tracks/python/exercises/simple-linked-list/simple_linked_list_test.py +13 -3
  196. data/tracks/python/exercises/space-age/README.md +15 -0
  197. data/tracks/python/exercises/strain/README.md +16 -3
  198. data/tracks/python/exercises/sublist/README.md +15 -0
  199. data/tracks/python/exercises/sum-of-multiples/README.md +18 -3
  200. data/tracks/python/exercises/tournament/README.md +15 -0
  201. data/tracks/python/exercises/transpose/README.md +15 -0
  202. data/tracks/python/exercises/tree-building/README.md +30 -0
  203. data/tracks/python/exercises/tree-building/example.py +3 -5
  204. data/tracks/python/exercises/tree-building/tree_building_test.py +16 -6
  205. data/tracks/python/exercises/triangle/README.md +15 -0
  206. data/tracks/python/exercises/triangle/example.py +1 -1
  207. data/tracks/python/exercises/triangle/triangle_test.py +15 -5
  208. data/tracks/python/exercises/trinary/README.md +15 -0
  209. data/tracks/python/exercises/twelve-days/README.md +15 -0
  210. data/tracks/python/exercises/two-bucket/README.md +22 -7
  211. data/tracks/python/exercises/two-fer/README.md +16 -0
  212. data/tracks/python/exercises/variable-length-quantity/README.md +15 -0
  213. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity_test.py +12 -2
  214. data/tracks/python/exercises/word-count/README.md +15 -0
  215. data/tracks/python/exercises/word-search/README.md +15 -0
  216. data/tracks/python/exercises/wordy/README.md +15 -0
  217. data/tracks/python/exercises/wordy/wordy_test.py +14 -4
  218. data/tracks/python/exercises/zebra-puzzle/README.md +15 -0
  219. data/tracks/python/exercises/zipper/README.md +16 -3
  220. data/tracks/rust/config.json +11 -0
  221. data/tracks/rust/exercises/saddle-points/.gitignore +8 -0
  222. data/tracks/rust/exercises/saddle-points/Cargo.toml +5 -0
  223. data/tracks/rust/exercises/saddle-points/README.md +66 -0
  224. data/tracks/rust/exercises/saddle-points/example.rs +24 -0
  225. data/tracks/rust/exercises/saddle-points/src/lib.rs +3 -0
  226. data/tracks/rust/exercises/saddle-points/tests/saddle-points.rs +60 -0
  227. metadata +38 -5
@@ -5,19 +5,16 @@ import (
5
5
  "math"
6
6
  )
7
7
 
8
- var (
9
- ErrInvalidBase = errors.New("invalid base given")
10
- ErrInvalidDigit = errors.New("invalid digit given")
11
- )
12
-
13
- func ConvertToBase(inputBase uint64, inputDigits []uint64, outputBase uint64) ([]uint64, error) {
14
- if inputBase < 2 || outputBase < 2 {
15
- return nil, ErrInvalidBase
8
+ // ConvertToBase converts given digits in input base to given output base
9
+ func ConvertToBase(inputBase int, inputDigits []int, outputBase int) ([]int, error) {
10
+ if inputBase < 2 {
11
+ return nil, errors.New("input base must be >= 2")
12
+ } else if outputBase < 2 {
13
+ return nil, errors.New("output base must be >= 2")
16
14
  }
17
-
18
15
  for _, d := range inputDigits {
19
- if d >= inputBase {
20
- return nil, ErrInvalidDigit
16
+ if d < 0 || d >= inputBase {
17
+ return nil, errors.New("all digits must satisfy 0 <= d < input base")
21
18
  }
22
19
  }
23
20
 
@@ -25,34 +22,33 @@ func ConvertToBase(inputBase uint64, inputDigits []uint64, outputBase uint64) ([
25
22
  return digitsInBase(total, outputBase), nil
26
23
  }
27
24
 
28
- func toCanonicalBase(inputBase uint64, inputDigits []uint64) uint64 {
29
- var total uint64
25
+ func toCanonicalBase(base int, digits []int) int {
26
+ var total int
30
27
 
31
- digits := len(inputDigits)
32
- for i := digits - 1; i >= 0; i-- {
33
- total += inputDigits[digits-1-i] * uint64(math.Pow(float64(inputBase), float64(i)))
28
+ l := len(digits)
29
+ for i := l - 1; i >= 0; i-- {
30
+ total += digits[l-1-i] * int(math.Pow(float64(base), float64(i)))
34
31
  }
35
32
 
36
33
  return total
37
34
  }
38
35
 
39
- func reverse(digits []uint64) []uint64 {
40
- var output = make([]uint64, len(digits))
41
-
42
- for i, d := range digits {
43
- output[len(digits)-1-i] = d
36
+ func reverse(a []int) []int {
37
+ for i := len(a)/2 - 1; i >= 0; i-- {
38
+ opp := len(a) - 1 - i
39
+ a[i], a[opp] = a[opp], a[i]
44
40
  }
45
-
46
- return output
41
+ return a
47
42
  }
48
43
 
49
- func digitsInBase(total uint64, outputBase uint64) []uint64 {
50
- var digits []uint64
51
- for total >= outputBase {
52
- digits = append(digits, total%outputBase)
53
- total /= outputBase
44
+ func digitsInBase(total, base int) []int {
45
+ var digits []int
46
+
47
+ for total >= base {
48
+ digits = append(digits, total%base)
49
+ total /= base
54
50
  }
55
- digits = append(digits, total%outputBase)
51
+ digits = append(digits, total%base)
56
52
 
57
53
  return reverse(digits)
58
54
  }
@@ -171,7 +171,7 @@ You can do this by:
171
171
 
172
172
  2. Clone [the problem-specifications repository](https://github.com/exercism/problem-specifications).
173
173
 
174
- 3. Run `configlet generate . --only name_of_new_exercise` from the root of this repository.
174
+ 3. Run `configlet generate . --only name_of_new_exercise --spec-path path_to_problem_specifications` from the root of this repository.
175
175
 
176
176
  * Check if there is canonical data for the exercise you're adding.
177
177
  This can be found at `https://github.com/exercism/problem-specifications/tree/master/exercises/EXERCISE-SLUG/canonical-data.json`.
@@ -17,7 +17,7 @@ Our policies are not set-in-stone. They represent directions chosen at a point i
17
17
 
18
18
  | Track Event | Policies to review |
19
19
  |:------------|:-----------------|
20
- | Exercise added/updated | [Prefer instance methods](#prefer-instance-methods); [Avoid using final](#avoid-using-final); [Adhere to best practices](#adhere-to-best-practices); [Starter implementations](#starter-implementations); [Ignore noninitial tests](#ignore-noninitial-tests); [Multiple file submissions](#multiple-file-submissions); [Name test class after class under test](#name-test-class-after-class-under-test)
20
+ | Exercise added/updated | [Prefer instance methods](#prefer-instance-methods); [Avoid using final](#avoid-using-final); [Adhere to best practices](#adhere-to-best-practices); [Starter implementations](#starter-implementations); [Ignore noninitial tests](#ignore-noninitial-tests); [Multiple file submissions](#multiple-file-submissions); [Name test class after class under test](#name-test-class-after-class-under-test); [Add hint for the first exercises without starter implementation](#add-hint-for-the-first-exercises-without-starter-implementation)
21
21
  | Track rearranged | [Starter implementations](#starter-implementations); [Multiple file submissions](#multiple-file-submissions) |
22
22
  | New issue observed in track | [Good first patches](#good-first-patches) |
23
23
  | "Good first patch" issue completed | [Good first patches](#good-first-patches) |
@@ -79,3 +79,17 @@ References: [[1](https://github.com/exercism/java/issues/395#issue-215734887)]
79
79
  > The exception to this is if the tests are split into several test classes where each test class tests different functionality. In that case each class should be named `SomeClassNameFunctionalityTest` where `Functionality` is the name of the functionality to be tested in that class. See the [clock exercise](https://github.com/exercism/java/tree/master/exercises/clock) as an example.
80
80
 
81
81
  References: [[1](https://github.com/exercism/java/issues/697)]
82
+
83
+ ### Add hint for the first exercises without starter implementation
84
+
85
+ > According to the starter implementation policy, any exercise with difficulty 4 or lower should have starter implementation.
86
+ > Any exercise with difficulty 5 or above will have no starter implementation (unless its signature is very complicated).
87
+ > This could be confusing to users when tackling their first exercise with difficulty 5 when they are used to starter implementation being provided.
88
+
89
+ > Therefore a hints.md file should be added to the .meta directory for every exercise with difficulty 5.
90
+ > This file should explain what they need to do when there is no starter implementation.
91
+ > The files should all be the same so you can copy it from any other exercise with difficulty 5, e.g. [flatten-array](https://github.com/exercism/java/tree/master/exercises/flatten-array/.meta/hints.md).
92
+
93
+ > We add the file to every exercise with difficulty 5 because the structure of the track means that we don't know which exercise will be the first one without starter implementation that a user will be faced with.
94
+
95
+ References: [[1](https://github.com/exercism/java/issues/1075)]
@@ -0,0 +1,58 @@
1
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
2
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
3
+ It does mean that when you first try to run the tests, they won't compile.
4
+ They will give you an error similar to:
5
+ ```
6
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
7
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
8
+ ^
9
+ symbol: class ExerciseClassName
10
+ location: class ExerciseClassNameTest
11
+ ```
12
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
13
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
14
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
15
+
16
+ When you try to run the tests again you will get slightly different errors.
17
+ You might get an error similar to:
18
+ ```
19
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
20
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
21
+ ^
22
+ required: no arguments
23
+ found: String
24
+ reason: actual and formal argument lists differ in length
25
+ ```
26
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
27
+ If you don't add a constructor, Java will add a default one for you.
28
+ This default constructor takes no arguments.
29
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
30
+ In the example above you could add:
31
+ ```
32
+ ExerciseClassName(String input) {
33
+
34
+ }
35
+ ```
36
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
37
+
38
+ You might also get an error similar to:
39
+ ```
40
+ error: cannot find symbol
41
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
42
+ ^
43
+ symbol: method someMethod()
44
+ location: variable exerciseClassName of type ExerciseClassName
45
+ ```
46
+ This error means that you need to add a method called `someMethod` to your new class.
47
+ In the example above you would add:
48
+ ```
49
+ String someMethod() {
50
+ return "";
51
+ }
52
+ ```
53
+ Make sure the return type matches what the test is expecting.
54
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
55
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
56
+ The new error should tell you which type it's expecting.
57
+
58
+ After having resolved these errors you should be ready to start making the tests pass!
@@ -10,6 +10,68 @@ input: [1,[2,3,null,4],[null],5]
10
10
 
11
11
  output: [1,2,3,4,5]
12
12
 
13
+ # Java Tips
14
+
15
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
16
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
17
+ It does mean that when you first try to run the tests, they won't compile.
18
+ They will give you an error similar to:
19
+ ```
20
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
21
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
22
+ ^
23
+ symbol: class ExerciseClassName
24
+ location: class ExerciseClassNameTest
25
+ ```
26
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
27
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
28
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
29
+
30
+ When you try to run the tests again you will get slightly different errors.
31
+ You might get an error similar to:
32
+ ```
33
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
34
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
35
+ ^
36
+ required: no arguments
37
+ found: String
38
+ reason: actual and formal argument lists differ in length
39
+ ```
40
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
41
+ If you don't add a constructor, Java will add a default one for you.
42
+ This default constructor takes no arguments.
43
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
44
+ In the example above you could add:
45
+ ```
46
+ ExerciseClassName(String input) {
47
+
48
+ }
49
+ ```
50
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
51
+
52
+ You might also get an error similar to:
53
+ ```
54
+ error: cannot find symbol
55
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
56
+ ^
57
+ symbol: method someMethod()
58
+ location: variable exerciseClassName of type ExerciseClassName
59
+ ```
60
+ This error means that you need to add a method called `someMethod` to your new class.
61
+ In the example above you would add:
62
+ ```
63
+ String someMethod() {
64
+ return "";
65
+ }
66
+ ```
67
+ Make sure the return type matches what the test is expecting.
68
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
69
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
70
+ The new error should tell you which type it's expecting.
71
+
72
+ After having resolved these errors you should be ready to start making the tests pass!
73
+
74
+
13
75
  # Running the tests
14
76
 
15
77
  You can run all the tests for an exercise by entering
@@ -1,4 +1,4 @@
1
- public class Hamming {
1
+ class Hamming {
2
2
 
3
3
  Hamming(String leftStrand, String rightStrand) {
4
4
  throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
@@ -1,11 +1,11 @@
1
1
  import java.util.regex.Pattern;
2
2
 
3
- public class Matrix {
3
+ class Matrix {
4
4
  private int[][] matrix;
5
5
  private static Pattern spacePattern = Pattern.compile(" ");
6
6
  private static Pattern newlinePattern = Pattern.compile("\\n");
7
7
 
8
- public Matrix(String matrixAsString) {
8
+ Matrix(String matrixAsString) {
9
9
  String[] rows = newlinePattern.split(matrixAsString);
10
10
  matrix = new int[rows.length][];
11
11
  for (int i = 0; i < rows.length; i++) {
@@ -17,11 +17,11 @@ public class Matrix {
17
17
  }
18
18
  }
19
19
 
20
- public int[] getRow(int rowNumber) {
20
+ int[] getRow(int rowNumber) {
21
21
  return matrix[rowNumber];
22
22
  }
23
23
 
24
- public int[] getColumn(int columnNumber) {
24
+ int[] getColumn(int columnNumber) {
25
25
  int[] column = new int[matrix.length];
26
26
  for(int i = 0; i < matrix.length; i++) {
27
27
  column[i] = matrix[i][columnNumber];
@@ -29,11 +29,11 @@ public class Matrix {
29
29
  return column;
30
30
  }
31
31
 
32
- public int getRowsCount() {
32
+ int getRowsCount() {
33
33
  return matrix.length;
34
34
  }
35
35
 
36
- public int getColumnsCount() {
36
+ int getColumnsCount() {
37
37
  return matrix[0].length;
38
38
  }
39
39
  }
@@ -2,10 +2,10 @@ import java.time.LocalDate;
2
2
  import java.time.DayOfWeek;
3
3
 
4
4
 
5
- public class Meetup {
5
+ class Meetup {
6
6
  private final LocalDate startOfMonth;
7
7
 
8
- public Meetup(int monthOfYear, int year) {
8
+ Meetup(int monthOfYear, int year) {
9
9
  startOfMonth = LocalDate.of(year, monthOfYear, 1);
10
10
  }
11
11
 
@@ -1,4 +1,4 @@
1
- public enum MeetupSchedule {
1
+ enum MeetupSchedule {
2
2
  FIRST,
3
3
  SECOND,
4
4
  THIRD,
@@ -1,4 +1,4 @@
1
- public enum MeetupSchedule {
1
+ enum MeetupSchedule {
2
2
  FIRST,
3
3
  SECOND,
4
4
  THIRD,
@@ -0,0 +1,58 @@
1
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
2
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
3
+ It does mean that when you first try to run the tests, they won't compile.
4
+ They will give you an error similar to:
5
+ ```
6
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
7
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
8
+ ^
9
+ symbol: class ExerciseClassName
10
+ location: class ExerciseClassNameTest
11
+ ```
12
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
13
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
14
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
15
+
16
+ When you try to run the tests again you will get slightly different errors.
17
+ You might get an error similar to:
18
+ ```
19
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
20
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
21
+ ^
22
+ required: no arguments
23
+ found: String
24
+ reason: actual and formal argument lists differ in length
25
+ ```
26
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
27
+ If you don't add a constructor, Java will add a default one for you.
28
+ This default constructor takes no arguments.
29
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
30
+ In the example above you could add:
31
+ ```
32
+ ExerciseClassName(String input) {
33
+
34
+ }
35
+ ```
36
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
37
+
38
+ You might also get an error similar to:
39
+ ```
40
+ error: cannot find symbol
41
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
42
+ ^
43
+ symbol: method someMethod()
44
+ location: variable exerciseClassName of type ExerciseClassName
45
+ ```
46
+ This error means that you need to add a method called `someMethod` to your new class.
47
+ In the example above you would add:
48
+ ```
49
+ String someMethod() {
50
+ return "";
51
+ }
52
+ ```
53
+ Make sure the return type matches what the test is expecting.
54
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
55
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
56
+ The new error should tell you which type it's expecting.
57
+
58
+ After having resolved these errors you should be ready to start making the tests pass!
@@ -17,6 +17,67 @@ variants too.
17
17
 
18
18
  See <http://en.wikipedia.org/wiki/Pig_latin> for more details.
19
19
 
20
+ # Java Tips
21
+
22
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
23
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
24
+ It does mean that when you first try to run the tests, they won't compile.
25
+ They will give you an error similar to:
26
+ ```
27
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
28
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
29
+ ^
30
+ symbol: class ExerciseClassName
31
+ location: class ExerciseClassNameTest
32
+ ```
33
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
34
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
35
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
36
+
37
+ When you try to run the tests again you will get slightly different errors.
38
+ You might get an error similar to:
39
+ ```
40
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
41
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
42
+ ^
43
+ required: no arguments
44
+ found: String
45
+ reason: actual and formal argument lists differ in length
46
+ ```
47
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
48
+ If you don't add a constructor, Java will add a default one for you.
49
+ This default constructor takes no arguments.
50
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
51
+ In the example above you could add:
52
+ ```
53
+ ExerciseClassName(String input) {
54
+
55
+ }
56
+ ```
57
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
58
+
59
+ You might also get an error similar to:
60
+ ```
61
+ error: cannot find symbol
62
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
63
+ ^
64
+ symbol: method someMethod()
65
+ location: variable exerciseClassName of type ExerciseClassName
66
+ ```
67
+ This error means that you need to add a method called `someMethod` to your new class.
68
+ In the example above you would add:
69
+ ```
70
+ String someMethod() {
71
+ return "";
72
+ }
73
+ ```
74
+ Make sure the return type matches what the test is expecting.
75
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
76
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
77
+ The new error should tell you which type it's expecting.
78
+
79
+ After having resolved these errors you should be ready to start making the tests pass!
80
+
20
81
  # Running the tests
21
82
 
22
83
  You can run all the tests for an exercise by entering