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
@@ -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
 
@@ -1,8 +1,11 @@
1
+ ## Prerequisites
2
+
1
3
  Before installing Idris, you will need to make sure you have all of the necessary libraries and tools. You will need:
2
4
 
3
5
  * A fairly recent Haskell platform. Version 2013.2.0.0 should be sufficiently recent, though it is better to be completely up to date.
4
6
  * The GNU Multiple Precision Arithmetic Library (GMP) is available from MacPorts/Homebrew and all major Linux distributions.
5
7
 
8
+ ## Idris
6
9
 
7
10
  The easiest way to install Idris, if you have all of the prerequisites, is to type:
8
11
 
@@ -13,3 +16,22 @@ cabal update; cabal install idris
13
16
  This will install the latest version released on Hackage, along with any dependencies.
14
17
  If, however, you would like the most up to date development version you can find it,
15
18
  as well as build instructions, on GitHub at: https://github.com/idris-lang/Idris-dev.
19
+
20
+ ## Necessary libraries
21
+
22
+ You also need to install some Idris libraries, which are requirements of our testsuite.
23
+
24
+ ### `idris-testing`
25
+
26
+ This library provides the actual testing framework we use. It's installation is pretty simple.
27
+
28
+ ```shell
29
+ pushd /tmp
30
+ git clone git clone git@github.com:jfdm/idris-testing.git
31
+ cd idris-testing
32
+ make lib
33
+ make install # depending on your installation of idris this might need to be run as root
34
+ popd
35
+ ```
36
+
37
+ If the tests will ever brake because of calling things that your installed version of `idris-testing` does not provide, you have to update it by repeating the steps above.
@@ -1,7 +1,15 @@
1
- To run tests from the command line:
1
+ ## GNU Make
2
2
 
3
- ```bash
4
- idris --testpkg HelloWorld.ipkg
3
+ There is a `Makefile` provided with every exercise, so it is sufficient to simply run
4
+
5
+ ```shell
6
+ make
5
7
  ```
6
8
 
7
- (Replace `HelloWorld.ipkg` with the `.ipkg` file in the root directory of each exercise.)
9
+ ## Idris-PKG
10
+
11
+ The `Makefile` mentioned above is just a wrapper around the `idris` executable, which has some simple package management stuff built in.
12
+
13
+ ```shell
14
+ idris --testpkg *.ipkg
15
+ ```
@@ -0,0 +1,5 @@
1
+ module Accumulate
2
+
3
+ export
4
+ accumulate : (Int -> Int) -> List Int -> List Int
5
+ accumulate f xs = ?accumulate_rhs
@@ -1,5 +1,7 @@
1
1
  package hamming
2
2
 
3
+ pkgs = test
4
+
3
5
  sourcedir = src
4
6
  modules = Hamming, Test.Hamming
5
7
  tests = Test.Hamming.runTests
@@ -16,4 +16,8 @@ implementation Eq Nucleotide where
16
16
  export
17
17
  hamming_distance : Eq a => Vect n a -> Vect n a -> Nat
18
18
  hamming_distance s1 s2 =
19
- fst $ filter ((/=) 0) $ map (\(n1,n2) => if n1 == n2 then 0 else 1) $ zip s1 s2
19
+ fst $ filter ((/=) 0) $ map (\(n1,n2) => if n1 == n2 then 0 else 1) $ zip s1 s2
20
+
21
+ export
22
+ version : String
23
+ version = "1.0.0"
@@ -2,9 +2,17 @@ module Hamming
2
2
 
3
3
  import Data.Vect
4
4
 
5
- -- Add the correct export modifier here...
6
- data Nucleotide -- insert definition here
5
+ public export
6
+ data Nucleotide = A | C | G | T
7
7
 
8
- -- Add the correct export modifier here...
9
- hamming_distance : Vect n Nucleotide -> Vect n Nucleotide -> Nat
10
- hamming_distance s1 s2 = ?hamming_distance_rhs
8
+ public export
9
+ implementation Eq Nucleotide where
10
+ l == r = ?eq_rhs
11
+
12
+ export
13
+ hamming_distance : Eq a => Vect n a -> Vect n a -> Nat
14
+ hamming_distance s1 s2 = ?hamming_distance_rhs
15
+
16
+ export
17
+ version : String
18
+ version = "1.0.0"
@@ -1,66 +1,39 @@
1
1
  module Test.Hamming
2
2
 
3
3
  import Data.Vect
4
- import Hamming
5
-
6
- %access export
7
-
8
- assertEq : Eq a => (given : a) -> (expected : a) -> IO ()
9
- assertEq g e = putStrLn $ if g == e then "Test Passed" else "Test Failed"
10
-
11
- testIdenticalStrands : IO ()
12
- testIdenticalStrands = assertEq (hamming_distance [A] [A]) 0
13
-
14
- testLongIdenticalStrands : IO ()
15
- testLongIdenticalStrands = assertEq (hamming_distance [G,G,A,C,T,G,A] [G,G,A,C,T,G,A]) 0
16
-
17
- testDifferentSingleNucleotideStrands : IO ()
18
- testDifferentSingleNucleotideStrands = assertEq (hamming_distance [A] [G]) 1
19
-
20
- testMaximumDistanceInSmallNucleotideStrands : IO ()
21
- testMaximumDistanceInSmallNucleotideStrands = assertEq (hamming_distance [A,G] [C,T]) 2
22
-
23
- testSmallDifferenceInSmallNucleotideStrands : IO ()
24
- testSmallDifferenceInSmallNucleotideStrands = assertEq (hamming_distance [A,T] [C,T]) 1
4
+ import Test.Assertions
5
+ import System
25
6
 
26
- testSmallDistance : IO ()
27
- testSmallDistance = assertEq (hamming_distance [G,G,A,C,G] [G,G,T,C,G]) 1
28
-
29
- testSmallDistanceInLongStrands : IO ()
30
- testSmallDistanceInLongStrands = assertEq (hamming_distance [A,C,C,A,G,G,G] [A,C,T,A,T,G,G]) 2
31
-
32
- testNonUniqueCharacterInFirstStrand : IO ()
33
- testNonUniqueCharacterInFirstStrand = assertEq (hamming_distance [A,G,A] [A,G,G]) 1
34
-
35
- testNonUniqueCharacterInSecondStrand : IO ()
36
- testNonUniqueCharacterInSecondStrand = assertEq (hamming_distance [A,G,G] [A,G,A]) 1
37
-
38
- testSameNucleotidesInDifferentPositions : IO ()
39
- testSameNucleotidesInDifferentPositions = assertEq (hamming_distance [T,A,G] [G,A,T]) 2
40
-
41
- testLargeDistance : IO ()
42
- testLargeDistance = assertEq (hamming_distance [G,A,T,A,C,A] [G,C,A,T,A,A]) 4
43
-
44
- testLargeDistanceInOffByOneStrand : IO ()
45
- testLargeDistanceInOffByOneStrand = assertEq (hamming_distance [G,G,A,C,G,G,A,T,T,C,T,G] [A,G,G,A,C,G,G,A,T,T,C,T]) 9
7
+ import Hamming
46
8
 
47
- testEmptyStrands : IO ()
48
- testEmptyStrands =
49
- let empty = the (Vect _ Nucleotide) [] in
50
- assertEq (hamming_distance empty empty) 0
9
+ collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
10
+ collect {acc} [] = pure acc
11
+ collect {acc} (test :: tests) = do
12
+ bool <- test
13
+ case bool of
14
+ True => collect {acc=acc} tests
15
+ False => collect {acc=S acc} tests
51
16
 
17
+ export
52
18
  runTests : IO ()
53
19
  runTests = do
54
- testIdenticalStrands
55
- testLongIdenticalStrands
56
- testDifferentSingleNucleotideStrands
57
- testMaximumDistanceInSmallNucleotideStrands
58
- testSmallDifferenceInSmallNucleotideStrands
59
- testSmallDistance
60
- testSmallDistanceInLongStrands
61
- testNonUniqueCharacterInFirstStrand
62
- testNonUniqueCharacterInSecondStrand
63
- testSameNucleotidesInDifferentPositions
64
- testLargeDistance
65
- testLargeDistanceInOffByOneStrand
66
- testEmptyStrands
20
+ let empty = the (Vect _ Nucleotide) []
21
+ count <- collect
22
+ [ assertEquals (hamming_distance [A] [A]) 0
23
+ , assertEquals (hamming_distance [G,G,A,C,T,G,A] [G,G,A,C,T,G,A]) 0
24
+ , assertEquals (hamming_distance [A] [G]) 1
25
+ , assertEquals (hamming_distance [A,G] [C,T]) 2
26
+ , assertEquals (hamming_distance [A,T] [C,T]) 1
27
+ , assertEquals (hamming_distance [G,G,A,C,G] [G,G,T,C,G]) 1
28
+ , assertEquals (hamming_distance [A,C,C,A,G,G,G] [A,C,T,A,T,G,G]) 2
29
+ , assertEquals (hamming_distance [A,G,A] [A,G,G]) 1
30
+ , assertEquals (hamming_distance [A,G,G] [A,G,A]) 1
31
+ , assertEquals (hamming_distance [T,A,G] [G,A,T]) 2
32
+ , assertEquals (hamming_distance [G,A,T,A,C,A] [G,C,A,T,A,A]) 4
33
+ , assertEquals (hamming_distance [G,G,A,C,G,G,A,T,T,C,T,G] [A,G,G,A,C,G,G,A,T,T,C,T]) 9
34
+ , assertEquals (hamming_distance empty empty) 0
35
+ , assertEquals version "1.0.0"
36
+ ]
37
+ case count of
38
+ Z => exitSuccess
39
+ _ => exitFailure
@@ -1,5 +1,7 @@
1
1
  package helloworld
2
2
 
3
+ pkgs = test
4
+
3
5
  sourcedir = src
4
6
  modules = HelloWorld, Test.HelloWorld
5
7
  tests = Test.HelloWorld.runTests
@@ -0,0 +1,9 @@
1
+ module HelloWorld
2
+
3
+ export
4
+ hello : String
5
+ hello = "Hello, World!"
6
+
7
+ export
8
+ version : String
9
+ version = "1.0.0"
@@ -1,4 +1,9 @@
1
1
  module HelloWorld
2
2
 
3
3
  export
4
- greet : Maybe String -> String
4
+ hello : String
5
+ hello = ?hello_rhs
6
+
7
+ export
8
+ version : String
9
+ version = "1.0.0"
@@ -1,25 +1,25 @@
1
1
  module Test.HelloWorld
2
2
 
3
- import HelloWorld
4
-
5
- %access export
6
-
7
- assertEq : Eq a => (given : a) -> (expected : a) -> IO ()
8
- assertEq g e = putStrLn $ if g == e
9
- then "Test Passed"
10
- else "Test Failed"
3
+ import Test.Assertions
4
+ import System
11
5
 
12
- testNothing : IO ()
13
- testNothing = assertEq (greet Nothing) "Hello, World!"
14
-
15
- testJustAlice : IO ()
16
- testJustAlice = assertEq (greet (Just "Alice")) "Hello, Alice!"
6
+ import HelloWorld
17
7
 
18
- testJustBob : IO ()
19
- testJustBob = assertEq (greet (Just "Bob")) "Hello, Bob!"
8
+ collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
9
+ collect {acc} [] = pure acc
10
+ collect {acc} (test :: tests) = do
11
+ bool <- test
12
+ case bool of
13
+ True => collect {acc=acc} tests
14
+ False => collect {acc=S acc} tests
20
15
 
16
+ export
21
17
  runTests : IO ()
22
18
  runTests = do
23
- testNothing
24
- testJustAlice
25
- testJustBob
19
+ count <- collect
20
+ [ assertEquals hello "Hello, World!"
21
+ , assertEquals version "1.0.0"
22
+ ]
23
+ case count of
24
+ Z => exitSuccess
25
+ _ => exitFailure
@@ -1,5 +1,7 @@
1
1
  package leap
2
2
 
3
+ pkgs = test
4
+
3
5
  sourcedir = src
4
6
  modules = Leap, Test.Leap
5
7
  tests = Test.Leap.runTests
@@ -6,3 +6,7 @@ isLeap year =
6
6
  (divBy 4 && not (divBy 100)) || divBy 400
7
7
  where divBy : Int -> Bool
8
8
  divBy n = (year `mod` n) == 0
9
+
10
+ export
11
+ version : String
12
+ version = "1.0.0"
@@ -2,4 +2,8 @@ module Leap
2
2
 
3
3
  export
4
4
  isLeap : Int -> Bool
5
- isLeap year = ?is_leap_year
5
+ isLeap year = ?isLeap_rhs
6
+
7
+ export
8
+ version : String
9
+ version = "1.0.0"
@@ -1,37 +1,28 @@
1
1
  module Test.Leap
2
2
 
3
- import Leap
4
-
5
- %access export
6
-
7
- assertBool : Bool -> Bool -> IO ()
8
- assertBool expected given = putStrLn $ if given == expected then "Test Passed" else "Test Failed"
9
-
10
- assertTrue : Bool -> IO ()
11
- assertTrue = assertBool True
3
+ import Test.Assertions
4
+ import System
12
5
 
13
- assertFalse : Bool -> IO ()
14
- assertFalse = assertBool False
15
-
16
- -- year not divisible by 4: common year
17
- test2015 : IO ()
18
- test2015 = assertFalse (isLeap 2015)
19
-
20
- -- year divisible by 4, not divisible by 100: leap year
21
- test2016 : IO ()
22
- test2016 = assertTrue (isLeap 2016)
23
-
24
- -- year divisible by 100, not divisible by 400: common year
25
- test2100 : IO ()
26
- test2100 = assertFalse (isLeap 2100)
6
+ import Leap
27
7
 
28
- -- year divisible by 400: leap year
29
- test2000 : IO ()
30
- test2000 = assertTrue (isLeap 2000)
8
+ collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
9
+ collect {acc} [] = pure acc
10
+ collect {acc} (test :: tests) = do
11
+ bool <- test
12
+ case bool of
13
+ True => collect {acc=acc} tests
14
+ False => collect {acc=S acc} tests
31
15
 
16
+ export
32
17
  runTests : IO ()
33
18
  runTests = do
34
- test2015
35
- test2016
36
- test2100
37
- test2000
19
+ count <- collect
20
+ [ assertFalse (isLeap 2015)
21
+ , assertTrue (isLeap 2016)
22
+ , assertFalse (isLeap 2100)
23
+ , assertTrue (isLeap 2000)
24
+ , assertEquals version "1.0.0"
25
+ ]
26
+ case count of
27
+ Z => exitSuccess
28
+ _ => exitFailure
@@ -0,0 +1,23 @@
1
+ idris ?= idris
2
+ pkg := RnaTranscription
3
+
4
+ .PHONY: build clean clobber install rebuild test
5
+
6
+ all: test
7
+
8
+ build:
9
+ @ ${idris} --build ${pkg}.ipkg
10
+
11
+ clean:
12
+ @ ${idris} --clean ${pkg}.ipkg
13
+
14
+ clobber: clean
15
+ @ find . -name '*.ibc' -delete
16
+
17
+ install:
18
+ @ ${idris} --install ${pkg}.ipkg
19
+
20
+ rebuild: clean build
21
+
22
+ test:
23
+ @ ${idris} --testpkg ${pkg}.ipkg
@@ -0,0 +1,27 @@
1
+ # Rna Transcription
2
+
3
+ Given a DNA strand, return its RNA complement (per RNA transcription).
4
+
5
+ Both DNA and RNA strands are a sequence of nucleotides.
6
+
7
+ The four nucleotides found in DNA are adenine (**A**), cytosine (**C**),
8
+ guanine (**G**) and thymine (**T**).
9
+
10
+ The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
11
+ guanine (**G**) and uracil (**U**).
12
+
13
+ Given a DNA strand, its transcribed RNA strand is formed by replacing
14
+ each nucleotide with its complement:
15
+
16
+ * `G` -> `C`
17
+ * `C` -> `G`
18
+ * `T` -> `A`
19
+ * `A` -> `U`
20
+
21
+ ## Source
22
+
23
+ Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna)
24
+
25
+ ## Submitting Incomplete Solutions
26
+
27
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,5 @@
1
+ package rnatranscription
2
+
3
+ sourcedir = src
4
+ modules = RnaTranscription, Test.RnaTranscription
5
+ tests = Test.RnaTranscription.runTests
@@ -0,0 +1,17 @@
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
11
+
12
+ namespace RnaStrand
13
+ public export
14
+ data RnaStrand
15
+
16
+ toRna : Vect n DnaStrand -> Vect n RnaStrand
17
+ toRna = ?toRna_rhs