trackler 2.2.1.100 → 2.2.1.101

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +37 -19
  4. data/problem-specifications/exercises/ocr-numbers/canonical-data.json +144 -110
  5. data/problem-specifications/exercises/palindrome-products/canonical-data.json +49 -25
  6. data/problem-specifications/exercises/poker/canonical-data.json +171 -115
  7. data/problem-specifications/exercises/prime-factors/canonical-data.json +22 -8
  8. data/problem-specifications/exercises/protein-translation/canonical-data.json +70 -24
  9. data/problem-specifications/exercises/proverb/canonical-data.json +24 -12
  10. data/problem-specifications/exercises/queen-attack/canonical-data.json +115 -91
  11. data/problem-specifications/exercises/rail-fence-cipher/canonical-data.json +25 -13
  12. data/problem-specifications/exercises/raindrops/canonical-data.json +55 -19
  13. data/problem-specifications/exercises/rational-numbers/canonical-data.json +374 -0
  14. data/problem-specifications/exercises/rational-numbers/description.md +27 -0
  15. data/problem-specifications/exercises/rational-numbers/metadata.yml +4 -0
  16. data/problem-specifications/exercises/rectangles/canonical-data.json +93 -67
  17. data/problem-specifications/exercises/reverse-string/canonical-data.json +16 -6
  18. data/problem-specifications/exercises/rna-transcription/metadata.yml +3 -3
  19. data/problem-specifications/exercises/roman-numerals/canonical-data.json +10 -2
  20. data/tracks/bash/config.json +11 -11
  21. data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +7 -0
  22. data/tracks/clojure/exercises/armstrong-numbers/README.md +1 -1
  23. data/tracks/delphi/config.json +11 -0
  24. data/tracks/delphi/exercises/clock/uClockExample.pas +6 -1
  25. data/tracks/delphi/exercises/clock/uClockTest.pas +22 -19
  26. data/tracks/delphi/exercises/isbn-verifier/README.md +1 -1
  27. data/tracks/delphi/exercises/reverse-string/README.md +1 -1
  28. data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
  29. data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +14 -0
  30. data/tracks/delphi/exercises/space-age/README.md +45 -0
  31. data/tracks/delphi/exercises/space-age/SpaceAge.dpr +60 -0
  32. data/tracks/delphi/exercises/space-age/uSpaceAgeExample.pas +120 -0
  33. data/tracks/delphi/exercises/space-age/uSpaceAgeTests.pas +135 -0
  34. data/tracks/delphi/exercises/two-fer/README.md +1 -1
  35. data/tracks/elixir/exercises/nth-prime/nth_prime.exs +0 -1
  36. data/tracks/fsharp/exercises/pov/PovTest.fs +66 -53
  37. data/tracks/fsharp/exercises/space-age/Example.fs +11 -11
  38. data/tracks/fsharp/exercises/space-age/SpaceAge.fs +1 -1
  39. data/tracks/fsharp/exercises/space-age/SpaceAgeTest.fs +21 -34
  40. data/tracks/fsharp/exercises/triangle/Example.fs +11 -16
  41. data/tracks/fsharp/exercises/triangle/Triangle.fs +4 -5
  42. data/tracks/fsharp/exercises/triangle/TriangleTest.fs +44 -31
  43. data/tracks/fsharp/generators/Generators.fs +121 -0
  44. data/tracks/go/config.json +12 -0
  45. data/tracks/go/exercises/clock/.meta/gen.go +37 -13
  46. data/tracks/go/exercises/clock/cases_test.go +10 -10
  47. data/tracks/go/exercises/clock/clock_test.go +16 -2
  48. data/tracks/go/exercises/clock/example.go +4 -0
  49. data/tracks/go/exercises/clock/example_clock_test.go +3 -3
  50. data/tracks/go/exercises/parallel-letter-frequency/.meta/hints.md +33 -0
  51. data/tracks/go/exercises/parallel-letter-frequency/README.md +35 -0
  52. data/tracks/go/exercises/raindrops/.meta/hints.md +7 -4
  53. data/tracks/go/exercises/raindrops/README.md +12 -0
  54. data/tracks/go/exercises/roman-numerals/.meta/gen.go +4 -2
  55. data/tracks/go/exercises/roman-numerals/cases_test.go +3 -2
  56. data/tracks/go/exercises/space-age/.meta/hints.md +10 -0
  57. data/tracks/go/exercises/space-age/README.md +14 -1
  58. data/tracks/go/exercises/twelve-days/README.md +2 -5
  59. data/tracks/go/exercises/two-bucket/.meta/gen.go +62 -0
  60. data/tracks/go/exercises/two-bucket/.meta/hints.md +16 -0
  61. data/tracks/go/exercises/two-bucket/README.md +72 -0
  62. data/tracks/go/exercises/two-bucket/cases_test.go +44 -0
  63. data/tracks/go/exercises/two-bucket/example.go +198 -0
  64. data/tracks/go/exercises/two-bucket/two_bucket_test.go +61 -0
  65. data/tracks/idris/.travis.yml +3 -2
  66. data/tracks/idris/bin/fetch-idris-testing.sh +11 -0
  67. data/tracks/idris/bin/solve_exercises.sh +2 -2
  68. data/tracks/idris/config.json +11 -0
  69. data/tracks/idris/config/exercise_readme.go.tmpl +0 -3
  70. data/tracks/idris/docs/INSTALLATION.md +22 -0
  71. data/tracks/idris/docs/TESTS.md +12 -4
  72. data/tracks/idris/exercises/accumulate/src/Accumulate.idr +5 -0
  73. data/tracks/idris/exercises/hamming/Hamming.ipkg +2 -0
  74. data/tracks/idris/exercises/hamming/src/{example.idr → Example.idr} +5 -1
  75. data/tracks/idris/exercises/hamming/src/Hamming.idr +13 -5
  76. data/tracks/idris/exercises/hamming/src/Test/Hamming.idr +31 -58
  77. data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +2 -0
  78. data/tracks/idris/exercises/hello-world/src/Example.idr +9 -0
  79. data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +6 -1
  80. data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +18 -18
  81. data/tracks/idris/exercises/leap/Leap.ipkg +2 -0
  82. data/tracks/idris/exercises/leap/src/{example.idr → Example.idr} +4 -0
  83. data/tracks/idris/exercises/leap/src/Leap.idr +5 -1
  84. data/tracks/idris/exercises/leap/src/Test/Leap.idr +21 -30
  85. data/tracks/idris/exercises/rna-transcription/Makefile +23 -0
  86. data/tracks/idris/exercises/rna-transcription/README.md +27 -0
  87. data/tracks/idris/exercises/rna-transcription/RnaTranscription.ipkg +5 -0
  88. data/tracks/idris/exercises/rna-transcription/src/RnaTranscription.idr +17 -0
  89. data/tracks/idris/exercises/rna-transcription/src/Test/RnaTranscription.idr +27 -0
  90. data/tracks/idris/exercises/rna-transcription/src/example.idr +35 -0
  91. data/tracks/java/exercises/etl/.meta/version +1 -0
  92. data/tracks/java/exercises/gigasecond/.meta/version +1 -0
  93. data/tracks/java/exercises/isbn-verifier/README.md +1 -1
  94. data/tracks/java/exercises/nucleotide-count/.meta/src/reference/java/NucleotideCounter.java +7 -1
  95. data/tracks/java/exercises/nucleotide-count/.meta/version +1 -0
  96. data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideCounterTest.java +19 -54
  97. data/tracks/java/exercises/proverb/.meta/version +1 -0
  98. data/tracks/java/exercises/reverse-string/README.md +1 -1
  99. data/tracks/java/exercises/rna-transcription/README.md +1 -1
  100. data/tracks/java/exercises/sum-of-multiples/.meta/version +1 -0
  101. data/tracks/java/exercises/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +13 -1
  102. data/tracks/kotlin/config/exercise_readme.go.tmpl +0 -3
  103. data/tracks/kotlin/docs/TESTS.md +1 -1
  104. data/tracks/objective-c/config.json +11 -0
  105. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.h +7 -0
  106. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.m +26 -0
  107. data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m +39 -0
  108. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +31 -1
  109. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/OCLint.xcscheme +3 -1
  110. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/xobjectivecTest.xcscheme +3 -1
  111. data/tracks/ocaml/exercises/forth/example.ml +9 -9
  112. data/tracks/ocaml/tools/test-generator/Makefile +3 -9
  113. data/tracks/ocaml/tools/test-generator/src/test_gen.ml +18 -16
  114. data/tracks/perl6/exercises/acronym/.meta/exercise-data.yaml +1 -1
  115. data/tracks/perl6/exercises/acronym/acronym.t +4 -14
  116. data/tracks/perl6/exercises/all-your-base/all-your-base.t +0 -2
  117. data/tracks/perl6/exercises/allergies/allergies.t +0 -2
  118. data/tracks/perl6/exercises/anagram/.meta/exercise-data.yaml +1 -1
  119. data/tracks/perl6/exercises/anagram/anagram.t +2 -40
  120. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +0 -1
  121. data/tracks/perl6/exercises/bob/bob.t +0 -2
  122. data/tracks/perl6/exercises/clock/.meta/exercise-data.yaml +15 -11
  123. data/tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 +5 -1
  124. data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
  125. data/tracks/perl6/exercises/clock/clock.t +314 -217
  126. data/tracks/perl6/exercises/etl/etl.t +0 -2
  127. data/tracks/perl6/exercises/flatten-array/flatten-array.t +0 -2
  128. data/tracks/perl6/exercises/grains/grains.t +0 -2
  129. data/tracks/perl6/exercises/hamming/.meta/exercise-data.yaml +2 -2
  130. data/tracks/perl6/exercises/hamming/hamming.t +63 -35
  131. data/tracks/perl6/exercises/hello-world/hello-world.t +2 -3
  132. data/tracks/perl6/exercises/leap/.meta/exercise-data.yaml +1 -1
  133. data/tracks/perl6/exercises/leap/leap.t +14 -8
  134. data/tracks/perl6/exercises/luhn/luhn.t +0 -2
  135. data/tracks/perl6/exercises/nucleotide-count/.meta/exercise-data.yaml +2 -2
  136. data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +18 -10
  137. data/tracks/perl6/exercises/pangram/.meta/exercise-data.yaml +1 -1
  138. data/tracks/perl6/exercises/pangram/pangram.t +32 -14
  139. data/tracks/perl6/exercises/phone-number/.meta/exercise-data.yaml +4 -4
  140. data/tracks/perl6/exercises/phone-number/.meta/solutions/Phone.pm6 +1 -1
  141. data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
  142. data/tracks/perl6/exercises/phone-number/phone-number.t +59 -21
  143. data/tracks/perl6/exercises/raindrops/raindrops.t +0 -2
  144. data/tracks/perl6/exercises/rna-transcription/.meta/exercise-data.yaml +1 -1
  145. data/tracks/perl6/exercises/rna-transcription/README.md +1 -1
  146. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -9
  147. data/tracks/perl6/exercises/roman-numerals/.meta/exercise-data.yaml +3 -3
  148. data/tracks/perl6/exercises/roman-numerals/.meta/solutions/RomanNumerals.pm6 +1 -1
  149. data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
  150. data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +66 -24
  151. data/tracks/perl6/exercises/scrabble-score/.meta/exercise-data.yaml +1 -1
  152. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +35 -15
  153. data/tracks/perl6/exercises/space-age/.meta/exercise-data.yaml +1 -1
  154. data/tracks/perl6/exercises/space-age/space-age.t +34 -20
  155. data/tracks/perl6/exercises/two-fer/.meta/exercise-data.yaml +2 -2
  156. data/tracks/perl6/exercises/two-fer/two-fer.t +15 -11
  157. data/tracks/perl6/exercises/word-count/.meta/exercise-data.yaml +1 -1
  158. data/tracks/perl6/exercises/word-count/word-count.t +46 -26
  159. data/tracks/perl6/exercises/wordy/.meta/exercise-data.yaml +2 -2
  160. data/tracks/perl6/exercises/wordy/wordy.t +51 -21
  161. data/tracks/perl6/lib/Exercism/Generator.pm6 +1 -1
  162. data/tracks/perl6/t/generated-tests.t +1 -1
  163. data/tracks/perl6/templates/test.mustache +0 -1
  164. data/tracks/python/config.json +12 -0
  165. data/tracks/python/exercises/forth/example.py +1 -1
  166. data/tracks/python/exercises/forth/forth_test.py +43 -38
  167. data/tracks/python/exercises/spiral-matrix/README.md +42 -0
  168. data/tracks/python/exercises/spiral-matrix/example.py +11 -0
  169. data/tracks/python/exercises/spiral-matrix/spiral_matrix.py +2 -0
  170. data/tracks/python/exercises/spiral-matrix/spiral_matrix_test.py +40 -0
  171. data/tracks/racket/config/exercise_readme.go.tmpl +24 -4
  172. data/tracks/racket/exercises/accumulate/README.md +3 -6
  173. data/tracks/racket/exercises/acronym/README.md +3 -4
  174. data/tracks/racket/exercises/allergies/README.md +3 -4
  175. data/tracks/racket/exercises/anagram/README.md +3 -3
  176. data/tracks/racket/exercises/bob/README.md +5 -3
  177. data/tracks/racket/exercises/collatz-conjecture/README.md +3 -3
  178. data/tracks/racket/exercises/difference-of-squares/README.md +3 -3
  179. data/tracks/racket/exercises/etl/README.md +6 -4
  180. data/tracks/racket/exercises/gigasecond/README.md +3 -3
  181. data/tracks/racket/exercises/grains/README.md +3 -4
  182. data/tracks/racket/exercises/grep/README.md +15 -15
  183. data/tracks/racket/exercises/hamming/README.md +3 -3
  184. data/tracks/racket/exercises/hello-world/README.md +1 -1
  185. data/tracks/racket/exercises/leap/README.md +4 -4
  186. data/tracks/racket/exercises/list-ops/README.md +3 -4
  187. data/tracks/racket/exercises/meetup/README.md +19 -15
  188. data/tracks/racket/exercises/nucleotide-count/README.md +11 -25
  189. data/tracks/racket/exercises/perfect-numbers/README.md +5 -5
  190. data/tracks/racket/exercises/phone-number/README.md +7 -6
  191. data/tracks/racket/exercises/raindrops/README.md +3 -3
  192. data/tracks/racket/exercises/rna-transcription/README.md +4 -4
  193. data/tracks/racket/exercises/roman-numerals/README.md +4 -4
  194. data/tracks/racket/exercises/say/README.md +3 -3
  195. data/tracks/racket/exercises/scrabble-score/README.md +6 -4
  196. data/tracks/racket/exercises/word-count/README.md +4 -5
  197. data/tracks/scheme/config/exercise_readme.go.tmpl +0 -3
  198. data/tracks/scheme/docs/INSTALLATION.md +23 -14
  199. metadata +40 -9
  200. data/tracks/idris/docs/EXERCISE_README_INSERT.md +0 -0
  201. data/tracks/idris/exercises/hello-world/src/example.idr +0 -5
  202. data/tracks/kotlin/config/exercise-readme-insert.md +0 -1
  203. data/tracks/racket/docs/EXERCISE_README_INSERT.md +0 -23
  204. data/tracks/scheme/docs/EXERCISE_README_INSERT.md +0 -0
@@ -0,0 +1,27 @@
1
+ module Test.RnaTranscription
2
+
3
+ import RnaTranscription
4
+ import Data.Vect
5
+
6
+ %access export
7
+
8
+ assertCase : Eq b => (a -> b) -> (String, a, b) -> IO ()
9
+ assertCase fn (desc,given,expected) = do
10
+ putStrLn desc
11
+ if fn given == expected
12
+ then putStrLn " Test Passed"
13
+ else putStrLn " Test Failed"
14
+
15
+
16
+ testCases : List (n : Nat ** (String, Vect n DnaStrand, Vect n RnaStrand))
17
+ testCases = [(_ ** ("RNA complement of cytosine is guanine", [C], [G])),
18
+ (_ ** ("RNA complement of guanine is cytosine", [G], [C])),
19
+ (_ ** ("RNA complement of thymine is adenine", [T], [A])),
20
+ (_ ** ("RNA complement of adenine is uracil", [A], [U])),
21
+ (_ ** ("RNA complement", [A,C,G,T,G,G,T,C,T,T,A,A], [U,G,C,A,C,C,A,G,A,A,U,U]))]
22
+
23
+ runTests : IO ()
24
+ runTests = traverse_ testCase' testCases
25
+ where testCase' : (n : Nat ** (String, Vect n DnaStrand, Vect n RnaStrand)) -> IO ()
26
+ testCase' (x ** pf) = assertCase toRna pf
27
+
@@ -0,0 +1,35 @@
1
+ module RnaTranscription
2
+
3
+ import Data.Vect
4
+
5
+ %access export
6
+ %default total
7
+
8
+ namespace DnaStrand
9
+ public export
10
+ data DnaStrand = A | C | T | G
11
+
12
+ implementation Eq DnaStrand where
13
+ (==) A A = True
14
+ (==) C C = True
15
+ (==) T T = True
16
+ (==) G G = True
17
+ (==) _ _ = False
18
+
19
+ namespace RnaStrand
20
+ public export
21
+ data RnaStrand = A | C | G | U
22
+
23
+ implementation Eq RnaStrand where
24
+ (==) A A = True
25
+ (==) C C = True
26
+ (==) G G = True
27
+ (==) U U = True
28
+ (==) _ _ = False
29
+
30
+ toRna : Vect n DnaStrand -> Vect n RnaStrand
31
+ toRna [] = []
32
+ toRna (A :: xs) = U :: toRna xs
33
+ toRna (C :: xs) = G :: toRna xs
34
+ toRna (T :: xs) = A :: toRna xs
35
+ toRna (G :: xs) = C :: toRna xs
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -1,4 +1,4 @@
1
- # Isbn Verifier
1
+ # ISBN Verifier
2
2
 
3
3
  The [ISBN-10 verification process](https://en.wikipedia.org/wiki/International_Standard_Book_Number) is used to validate book identification
4
4
  numbers. These normally contain dashes and look like: `3-598-21508-8`
@@ -6,11 +6,17 @@ final class NucleotideCounter {
6
6
 
7
7
  NucleotideCounter(String sequence) {
8
8
  this.sequence = sequence;
9
+ for (char c : sequence.toCharArray()) {
10
+ if (isCountable(c)) {
11
+ throw new IllegalArgumentException(c + " is not a nucleotide");
12
+ }
13
+ }
9
14
  }
10
15
 
11
16
  int count(char base) {
12
- if (isCountable(base))
17
+ if (isCountable(base)) {
13
18
  throw new IllegalArgumentException(base + " is not a nucleotide");
19
+ }
14
20
 
15
21
  try {
16
22
  return nucleotideCounts().get(base);
@@ -13,18 +13,10 @@ public class NucleotideCounterTest {
13
13
  @Rule
14
14
  public ExpectedException expectedException = ExpectedException.none();
15
15
 
16
- @Test
17
- public void testEmptyDnaStringHasNoAdenine() {
18
- NucleotideCounter nucleotideCounter = new NucleotideCounter("");
19
- assertThat(nucleotideCounter.count('A'), is(0));
20
- }
21
-
22
- @Ignore("Remove to run test")
23
16
  @Test
24
17
  public void testEmptyDnaStringHasNoNucleotides() {
25
18
  NucleotideCounter nucleotideCounter = new NucleotideCounter("");
26
19
  Map<Character, Integer> counts = nucleotideCounter.nucleotideCounts();
27
- assertThat(counts.size(), is(4));
28
20
  assertThat(counts, allOf(
29
21
  hasEntry('A', 0),
30
22
  hasEntry('C', 0),
@@ -35,70 +27,36 @@ public class NucleotideCounterTest {
35
27
 
36
28
  @Ignore("Remove to run test")
37
29
  @Test
38
- public void testRepetitiveCytosineGetsCounted() {
39
- NucleotideCounter nucleotideCounter = new NucleotideCounter("CCCCC");
40
- assertThat(nucleotideCounter.count('C'), is(5));
41
- }
42
-
43
- @Ignore("Remove to run test")
44
- @Test
45
- public void testRepetitiveSequenceWithOnlyGuanine() {
46
- NucleotideCounter nucleotideCounter = new NucleotideCounter("GGGGGGGG");
30
+ public void testDnaStringHasOneNucleotide() {
31
+ NucleotideCounter nucleotideCounter = new NucleotideCounter("G");
47
32
  Map<Character, Integer> counts = nucleotideCounter.nucleotideCounts();
48
- assertThat(counts.size(), is(4));
49
33
  assertThat(counts, allOf(
50
34
  hasEntry('A', 0),
51
35
  hasEntry('C', 0),
52
- hasEntry('G', 8),
36
+ hasEntry('G', 1),
53
37
  hasEntry('T', 0)
54
38
  ));
55
39
  }
56
40
 
57
41
  @Ignore("Remove to run test")
58
42
  @Test
59
- public void testCountsOnlyThymine() {
60
- NucleotideCounter nucleotideCounter = new NucleotideCounter("GGGGGTAACCCGG");
61
- assertThat(nucleotideCounter.count('T'), is(1));
62
- }
63
-
64
- @Ignore("Remove to run test")
65
- @Test
66
- public void testCountsANucleotideOnlyOnce() {
67
- NucleotideCounter nucleotideCounter = new NucleotideCounter("CGATTGGG");
68
- nucleotideCounter.count('T');
69
- assertThat(nucleotideCounter.count('T'), is(2));
70
- }
71
-
72
- @Ignore("Remove to run test")
73
- @Test
74
- public void testDnaCountsDoNotChangeAfterCountingAdenine() {
75
- NucleotideCounter nucleotideCounter = new NucleotideCounter("GATTACA");
76
- nucleotideCounter.count('A');
43
+ public void testRepetitiveSequenceWithOnlyGuanine() {
44
+ NucleotideCounter nucleotideCounter = new NucleotideCounter("GGGGGGG");
77
45
  Map<Character, Integer> counts = nucleotideCounter.nucleotideCounts();
78
- assertThat(counts.size(), is(4));
79
46
  assertThat(counts, allOf(
80
- hasEntry('A', 3),
81
- hasEntry('C', 1),
82
- hasEntry('G', 1),
83
- hasEntry('T', 2)
47
+ hasEntry('A', 0),
48
+ hasEntry('C', 0),
49
+ hasEntry('G', 7),
50
+ hasEntry('T', 0)
84
51
  ));
85
52
  }
86
53
 
87
54
  @Ignore("Remove to run test")
88
55
  @Test
89
- public void testValidatesNucleotides() {
90
- expectedException.expect(IllegalArgumentException.class);
91
- NucleotideCounter nucleotideCounter = new NucleotideCounter("GACT");
92
- nucleotideCounter.count('X');
93
- }
94
-
95
- @Ignore("Remove to run test")
96
- @Test
97
- public void testCountsAllNucleotides() {
98
- String s = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC";
99
- NucleotideCounter nucleotideCounter = new NucleotideCounter(s);
56
+ public void testDnaStringHasMultipleNucleotide() {
57
+ NucleotideCounter nucleotideCounter
58
+ = new NucleotideCounter("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC");
100
59
  Map<Character, Integer> counts = nucleotideCounter.nucleotideCounts();
101
- assertThat(counts.size(), is(4));
102
60
  assertThat(counts, allOf(
103
61
  hasEntry('A', 20),
104
62
  hasEntry('C', 12),
@@ -106,4 +64,11 @@ public class NucleotideCounterTest {
106
64
  hasEntry('T', 21)
107
65
  ));
108
66
  }
67
+
68
+ @Ignore("Remove to run test")
69
+ @Test
70
+ public void testDnaStringHasInvalidNucleotides() {
71
+ expectedException.expect(IllegalArgumentException.class);
72
+ NucleotideCounter nucleotideCounter = new NucleotideCounter("AGXXACT");
73
+ }
109
74
  }
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -1,4 +1,4 @@
1
- # reverse-string
1
+ # Reverse String
2
2
 
3
3
  Reverse a string
4
4
 
@@ -30,7 +30,7 @@ in your terminal.
30
30
 
31
31
  ## Source
32
32
 
33
- Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna)
33
+ Hyperphysics [http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html](http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html)
34
34
 
35
35
  ## Submitting Incomplete Solutions
36
36
 
@@ -30,6 +30,18 @@ public class SumOfMultiplesTest {
30
30
 
31
31
  }
32
32
 
33
+ @Ignore("Remove to run test")
34
+ @Test
35
+ public void testSumOfMultiplesOf3aUpToSeven() {
36
+
37
+ int[] set = {
38
+ 3
39
+ };
40
+ int output = new SumOfMultiples(7, set).getSum();
41
+ assertEquals(9, output);
42
+
43
+ }
44
+
33
45
  @Ignore("Remove to run test")
34
46
  @Test
35
47
  public void testSumOfMultiplesOf3and5UpToTen() {
@@ -112,7 +124,7 @@ public class SumOfMultiplesTest {
112
124
 
113
125
  @Ignore("Remove to run test")
114
126
  @Test
115
- public void testSumOfMultiplesOf5and25UpToTwoHundredSeventyFive() {
127
+ public void testSumOfMultiplesOf5and25UpToFiftyOne() {
116
128
 
117
129
  int[] set = {
118
130
  5,
@@ -4,9 +4,6 @@
4
4
  {{- with .Hints }}
5
5
  {{ . }}
6
6
  {{ end }}
7
- {{- with .TrackInsert }}
8
- {{ . }}
9
- {{ end }}
10
7
  {{- with .Spec.Credits -}}
11
8
  ## Source
12
9
 
@@ -107,7 +107,7 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
107
107
  ```
108
108
  *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
109
109
 
110
- 4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.mdhttps://github.com/exercism/kotlin/blob/master/exercises/hello-world/GETTING_STARTED.md)).
110
+ 4. Solve the exercise. Find and work through the `TUTORIAL.md` guide ([view on GitHub](https://github.com/exercism/kotlin/blob/master/exercises/hello-world/TUTORIAL.md)).
111
111
 
112
112
  Good luck! Have fun!
113
113
 
@@ -274,6 +274,17 @@
274
274
  "unlocked_by": null,
275
275
  "uuid": "fd22b216-28c3-43cc-9627-e7584f4d3e27"
276
276
  },
277
+ {
278
+ "core": false,
279
+ "difficulty": 3,
280
+ "slug": "collatz-conjecture",
281
+ "topics": [
282
+ "integers",
283
+ "mathematics"
284
+ ],
285
+ "unlocked_by": null,
286
+ "uuid": "d7d66773-e07f-4da1-932b-9431437d34d6"
287
+ },
277
288
  {
278
289
  "core": false,
279
290
  "difficulty": 4,
@@ -0,0 +1,7 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ @interface CollatzConjecture : NSObject
4
+
5
+ + (NSInteger)stepsForNumber:(NSInteger)number;
6
+
7
+ @end
@@ -0,0 +1,26 @@
1
+ #import "CollatzConjectureExample.h"
2
+
3
+ @implementation CollatzConjecture
4
+
5
+ + (NSInteger)stepsForNumber:(NSInteger)number {
6
+ if (number <= 0) {
7
+ return NSNotFound;
8
+ }
9
+
10
+ NSInteger current = number;
11
+ NSInteger steps = 0;
12
+
13
+ while (current > 1) {
14
+ steps++;
15
+
16
+ if (current % 2 == 0) {
17
+ current /= 2;
18
+ } else {
19
+ current = current * 3 + 1;
20
+ }
21
+ }
22
+
23
+ return steps;
24
+ }
25
+
26
+ @end
@@ -0,0 +1,39 @@
1
+ #import <XCTest/XCTest.h>
2
+
3
+ #if __has_include("CollatzConjectureExample.h")
4
+ # import "CollatzConjectureExample.h"
5
+ # else
6
+ # import "CollatzConjecture.h"
7
+ #endif
8
+
9
+ @interface CollatzConjectureTest : XCTestCase
10
+
11
+ @end
12
+
13
+ @implementation CollatzConjectureTest
14
+
15
+ - (void)testZeroStepsForOne {
16
+ XCTAssertEqual(0, [CollatzConjecture stepsForNumber:1]);
17
+ }
18
+
19
+ - (void)testDivideIfEven {
20
+ XCTAssertEqual(4, [CollatzConjecture stepsForNumber:16]);
21
+ }
22
+
23
+ - (void)testEvenAndOddSteps {
24
+ XCTAssertEqual(9, [CollatzConjecture stepsForNumber:12]);
25
+ }
26
+
27
+ - (void)testLargeNumberOfEvenAndOddSteps {
28
+ XCTAssertEqual(152, [CollatzConjecture stepsForNumber:1000000]);
29
+ }
30
+
31
+ - (void)testZeroIsAnError {
32
+ XCTAssertEqual([CollatzConjecture stepsForNumber:0], NSNotFound);
33
+ }
34
+
35
+ - (void)testNegativeValueIsAnError {
36
+ XCTAssertEqual([CollatzConjecture stepsForNumber:-15], NSNotFound);
37
+ }
38
+
39
+ @end
@@ -63,6 +63,8 @@
63
63
  E907FE941D87554500B93DA9 /* ScrabbleScoreTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E907FE931D87554500B93DA9 /* ScrabbleScoreTest.m */; };
64
64
  E92FCC0D1D78F30D00061017 /* MeetupExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E92FCC0C1D78F30D00061017 /* MeetupExample.m */; };
65
65
  E92FCC0F1D78F3B600061017 /* MeetupTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E92FCC0E1D78F3B600061017 /* MeetupTest.m */; };
66
+ E9340D06201975C9009FDEF4 /* CollatzConjectureExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E9340D05201975C9009FDEF4 /* CollatzConjectureExample.m */; };
67
+ E9340D08201975E5009FDEF4 /* CollatzConjectureTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E9340D07201975E5009FDEF4 /* CollatzConjectureTest.m */; };
66
68
  E9381D461D8EDFFA003F22A1 /* DifferenceOfSquaresExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E9381D451D8EDFFA003F22A1 /* DifferenceOfSquaresExample.m */; };
67
69
  E9381D481D8EE00C003F22A1 /* DifferenceOfSquaresTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E9381D471D8EE00C003F22A1 /* DifferenceOfSquaresTest.m */; };
68
70
  E9381D4C1D8F2969003F22A1 /* RaindropsExample.m in Sources */ = {isa = PBXBuildFile; fileRef = E9381D4B1D8F2969003F22A1 /* RaindropsExample.m */; };
@@ -177,6 +179,9 @@
177
179
  E92FCC0B1D78F30D00061017 /* MeetupExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeetupExample.h; path = ../../exercises/meetup/MeetupExample.h; sourceTree = "<group>"; };
178
180
  E92FCC0C1D78F30D00061017 /* MeetupExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MeetupExample.m; path = ../../exercises/meetup/MeetupExample.m; sourceTree = "<group>"; };
179
181
  E92FCC0E1D78F3B600061017 /* MeetupTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MeetupTest.m; path = ../../exercises/meetup/MeetupTest.m; sourceTree = "<group>"; };
182
+ E9340D04201975C9009FDEF4 /* CollatzConjectureExample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CollatzConjectureExample.h; path = "../../exercises/collatz-conjecture/CollatzConjectureExample.h"; sourceTree = "<group>"; };
183
+ E9340D05201975C9009FDEF4 /* CollatzConjectureExample.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CollatzConjectureExample.m; path = "../../exercises/collatz-conjecture/CollatzConjectureExample.m"; sourceTree = "<group>"; };
184
+ E9340D07201975E5009FDEF4 /* CollatzConjectureTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CollatzConjectureTest.m; path = "../../exercises/collatz-conjecture/CollatzConjectureTest.m"; sourceTree = "<group>"; };
180
185
  E9381D441D8EDFFA003F22A1 /* DifferenceOfSquaresExample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DifferenceOfSquaresExample.h; path = "../../exercises/difference-of-squares/DifferenceOfSquaresExample.h"; sourceTree = "<group>"; };
181
186
  E9381D451D8EDFFA003F22A1 /* DifferenceOfSquaresExample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DifferenceOfSquaresExample.m; path = "../../exercises/difference-of-squares/DifferenceOfSquaresExample.m"; sourceTree = "<group>"; };
182
187
  E9381D471D8EE00C003F22A1 /* DifferenceOfSquaresTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DifferenceOfSquaresTest.m; path = "../../exercises/difference-of-squares/DifferenceOfSquaresTest.m"; sourceTree = "<group>"; };
@@ -272,6 +277,7 @@
272
277
  E9E8B6EC1D519DEF0012F12C /* Bob */,
273
278
  A09A906D1E28C1380087CCB7 /* BracketPush */,
274
279
  E9381D4F1D8F2DA4003F22A1 /* Clock */,
280
+ E9340D0320197513009FDEF4 /* CollatzConjecture */,
275
281
  E9895B6B1E8DA8AA006AD25D /* CryptoSquare */,
276
282
  E9381D431D8EDFB8003F22A1 /* DifferenceOfSquares */,
277
283
  E9E8B6ED1D519DF50012F12C /* Etl */,
@@ -408,6 +414,16 @@
408
414
  name = Meetup;
409
415
  sourceTree = "<group>";
410
416
  };
417
+ E9340D0320197513009FDEF4 /* CollatzConjecture */ = {
418
+ isa = PBXGroup;
419
+ children = (
420
+ E9340D04201975C9009FDEF4 /* CollatzConjectureExample.h */,
421
+ E9340D05201975C9009FDEF4 /* CollatzConjectureExample.m */,
422
+ E9340D07201975E5009FDEF4 /* CollatzConjectureTest.m */,
423
+ );
424
+ name = CollatzConjecture;
425
+ sourceTree = "<group>";
426
+ };
411
427
  E9381D431D8EDFB8003F22A1 /* DifferenceOfSquares */ = {
412
428
  isa = PBXGroup;
413
429
  children = (
@@ -794,7 +810,7 @@
794
810
  1EE9CC521CB462CB00C92E6D /* Project object */ = {
795
811
  isa = PBXProject;
796
812
  attributes = {
797
- LastUpgradeCheck = 0810;
813
+ LastUpgradeCheck = 0920;
798
814
  ORGANIZATIONNAME = exercism;
799
815
  TargetAttributes = {
800
816
  1E1068C41D408EE30019B25B = {
@@ -875,6 +891,7 @@
875
891
  1EFACAB51CCCAF3D006F2E69 /* PhoneNumberExample.m in Sources */,
876
892
  A0BBFCBF1E37719800230071 /* SublistExample.m in Sources */,
877
893
  E951B6B91D429550009EB5B6 /* AllergiesTest.m in Sources */,
894
+ E9340D06201975C9009FDEF4 /* CollatzConjectureExample.m in Sources */,
878
895
  A065F5791E3098080048E337 /* BeerSongTest.m in Sources */,
879
896
  E9381D461D8EDFFA003F22A1 /* DifferenceOfSquaresExample.m in Sources */,
880
897
  E9A7B2F71DA5AC37009056B6 /* LargestSeriesProductExample.m in Sources */,
@@ -936,6 +953,7 @@
936
953
  E9A7B2F91DA5AC55009056B6 /* LargestSeriesProductTest.m in Sources */,
937
954
  1EFACAAF1CCCAF3D006F2E69 /* LeapExample.m in Sources */,
938
955
  E9386EF01E0B694D0009A414 /* AtbashCipherTest.m in Sources */,
956
+ E9340D08201975E5009FDEF4 /* CollatzConjectureTest.m in Sources */,
939
957
  E9C1C0251D9D99620015E86E /* SecretHandshakeTest.m in Sources */,
940
958
  6F409F8D1F0DBF0A00217758 /* RNATranscriptionTest.m in Sources */,
941
959
  E969939A1DF60E5F009EA223 /* TransposeTest.m in Sources */,
@@ -993,14 +1011,20 @@
993
1011
  CLANG_CXX_LIBRARY = "libc++";
994
1012
  CLANG_ENABLE_MODULES = YES;
995
1013
  CLANG_ENABLE_OBJC_ARC = YES;
1014
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
996
1015
  CLANG_WARN_BOOL_CONVERSION = YES;
1016
+ CLANG_WARN_COMMA = YES;
997
1017
  CLANG_WARN_CONSTANT_CONVERSION = YES;
998
1018
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
999
1019
  CLANG_WARN_EMPTY_BODY = YES;
1000
1020
  CLANG_WARN_ENUM_CONVERSION = YES;
1001
1021
  CLANG_WARN_INFINITE_RECURSION = YES;
1002
1022
  CLANG_WARN_INT_CONVERSION = YES;
1023
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1024
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
1003
1025
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1026
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
1027
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
1004
1028
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
1005
1029
  CLANG_WARN_UNREACHABLE_CODE = YES;
1006
1030
  CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1039,14 +1063,20 @@
1039
1063
  CLANG_CXX_LIBRARY = "libc++";
1040
1064
  CLANG_ENABLE_MODULES = YES;
1041
1065
  CLANG_ENABLE_OBJC_ARC = YES;
1066
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
1042
1067
  CLANG_WARN_BOOL_CONVERSION = YES;
1068
+ CLANG_WARN_COMMA = YES;
1043
1069
  CLANG_WARN_CONSTANT_CONVERSION = YES;
1044
1070
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1045
1071
  CLANG_WARN_EMPTY_BODY = YES;
1046
1072
  CLANG_WARN_ENUM_CONVERSION = YES;
1047
1073
  CLANG_WARN_INFINITE_RECURSION = YES;
1048
1074
  CLANG_WARN_INT_CONVERSION = YES;
1075
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1076
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
1049
1077
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1078
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
1079
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
1050
1080
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
1051
1081
  CLANG_WARN_UNREACHABLE_CODE = YES;
1052
1082
  CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;