trackler 2.2.1.109 → 2.2.1.110

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/config.json +2 -0
  4. data/tracks/clojure/exercises/armstrong-numbers/test/armstrong_numbers_test.clj +1 -1
  5. data/tracks/elixir/.formatter.exs +3 -0
  6. data/tracks/elixir/exercises/accumulate/accumulate_test.exs +8 -8
  7. data/tracks/elixir/exercises/acronym/acronym_test.exs +2 -2
  8. data/tracks/elixir/exercises/acronym/example.exs +3 -4
  9. data/tracks/elixir/exercises/all-your-base/all-your-base-test.exs +2 -2
  10. data/tracks/elixir/exercises/all-your-base/example.exs +14 -7
  11. data/tracks/elixir/exercises/allergies/allergies.exs +2 -4
  12. data/tracks/elixir/exercises/allergies/allergies_test.exs +17 -11
  13. data/tracks/elixir/exercises/anagram/anagram.exs +1 -2
  14. data/tracks/elixir/exercises/anagram/anagram_test.exs +13 -13
  15. data/tracks/elixir/exercises/anagram/example.exs +2 -1
  16. data/tracks/elixir/exercises/atbash-cipher/atbash_cipher.exs +2 -2
  17. data/tracks/elixir/exercises/atbash-cipher/atbash_cipher_test.exs +2 -2
  18. data/tracks/elixir/exercises/bank-account/bank_account_test.exs +10 -5
  19. data/tracks/elixir/exercises/beer-song/beer_song.exs +2 -2
  20. data/tracks/elixir/exercises/beer-song/beer_song_test.exs +225 -225
  21. data/tracks/elixir/exercises/beer-song/example.exs +5 -3
  22. data/tracks/elixir/exercises/binary-search-tree/binary_search_tree_test.exs +2 -2
  23. data/tracks/elixir/exercises/binary-search-tree/example.exs +1 -1
  24. data/tracks/elixir/exercises/binary-search/binary_search.exs +0 -1
  25. data/tracks/elixir/exercises/binary-search/binary_search_test.exs +2 -2
  26. data/tracks/elixir/exercises/binary-search/example.exs +3 -1
  27. data/tracks/elixir/exercises/binary/binary.exs +1 -1
  28. data/tracks/elixir/exercises/binary/binary_test.exs +2 -2
  29. data/tracks/elixir/exercises/binary/example.exs +2 -2
  30. data/tracks/elixir/exercises/bob/bob.exs +1 -2
  31. data/tracks/elixir/exercises/bob/bob_test.exs +2 -2
  32. data/tracks/elixir/exercises/bowling/bowling.exs +2 -3
  33. data/tracks/elixir/exercises/bowling/bowling_test.exs +54 -275
  34. data/tracks/elixir/exercises/bowling/example.exs +24 -10
  35. data/tracks/elixir/exercises/bracket-push/bracket_push.exs +1 -2
  36. data/tracks/elixir/exercises/bracket-push/bracket_push_test.exs +5 -3
  37. data/tracks/elixir/exercises/bracket-push/example.exs +8 -3
  38. data/tracks/elixir/exercises/change/change.exs +1 -2
  39. data/tracks/elixir/exercises/change/change_test.exs +2 -2
  40. data/tracks/elixir/exercises/change/example.exs +5 -1
  41. data/tracks/elixir/exercises/clock/clock_test.exs +8 -8
  42. data/tracks/elixir/exercises/clock/example.exs +5 -3
  43. data/tracks/elixir/exercises/collatz-conjecture/collatz_conjecture.exs +0 -1
  44. data/tracks/elixir/exercises/collatz-conjecture/collatz_conjecture_test.exs +3 -3
  45. data/tracks/elixir/exercises/collatz-conjecture/example.exs +1 -1
  46. data/tracks/elixir/exercises/connect/connect.exs +1 -2
  47. data/tracks/elixir/exercises/connect/connect_test.exs +40 -30
  48. data/tracks/elixir/exercises/connect/example.exs +12 -10
  49. data/tracks/elixir/exercises/crypto-square/crypto_square.exs +1 -2
  50. data/tracks/elixir/exercises/crypto-square/crypto_square_test.exs +2 -2
  51. data/tracks/elixir/exercises/crypto-square/example.exs +6 -5
  52. data/tracks/elixir/exercises/custom-set/custom_set.exs +1 -1
  53. data/tracks/elixir/exercises/custom-set/custom_set_test.exs +2 -2
  54. data/tracks/elixir/exercises/custom-set/example.exs +5 -4
  55. data/tracks/elixir/exercises/diamond/diamond.exs +1 -2
  56. data/tracks/elixir/exercises/diamond/diamond_test.exs +20 -18
  57. data/tracks/elixir/exercises/diamond/example.exs +10 -10
  58. data/tracks/elixir/exercises/difference-of-squares/difference_of_squares.exs +1 -5
  59. data/tracks/elixir/exercises/difference-of-squares/difference_of_squares_test.exs +5 -6
  60. data/tracks/elixir/exercises/difference-of-squares/example.exs +3 -4
  61. data/tracks/elixir/exercises/diffie-hellman/diffie_hellman.exs +7 -3
  62. data/tracks/elixir/exercises/diffie-hellman/diffie_hellman_test.exs +43 -23
  63. data/tracks/elixir/exercises/diffie-hellman/example.exs +10 -6
  64. data/tracks/elixir/exercises/dominoes/dominoes.exs +0 -1
  65. data/tracks/elixir/exercises/dominoes/dominoes_test.exs +16 -6
  66. data/tracks/elixir/exercises/dominoes/example.exs +9 -5
  67. data/tracks/elixir/exercises/dot-dsl/dot.exs +0 -1
  68. data/tracks/elixir/exercises/dot-dsl/dot_dsl_test.exs +107 -58
  69. data/tracks/elixir/exercises/dot-dsl/example.exs +18 -10
  70. data/tracks/elixir/exercises/etl/etl.exs +0 -1
  71. data/tracks/elixir/exercises/etl/etl_test.exs +34 -13
  72. data/tracks/elixir/exercises/etl/example.exs +6 -6
  73. data/tracks/elixir/exercises/flatten-array/flatten_array.exs +0 -1
  74. data/tracks/elixir/exercises/flatten-array/flatten_array_test.exs +8 -8
  75. data/tracks/elixir/exercises/forth/example.exs +5 -5
  76. data/tracks/elixir/exercises/forth/forth.exs +6 -9
  77. data/tracks/elixir/exercises/forth/forth_test.exs +107 -64
  78. data/tracks/elixir/exercises/gigasecond/example.exs +1 -1
  79. data/tracks/elixir/exercises/gigasecond/gigasecond.exs +2 -2
  80. data/tracks/elixir/exercises/gigasecond/gigasecond_test.exs +2 -2
  81. data/tracks/elixir/exercises/grade-school/example.exs +3 -3
  82. data/tracks/elixir/exercises/grade-school/grade_school_test.exs +26 -22
  83. data/tracks/elixir/exercises/grade-school/school.exs +3 -6
  84. data/tracks/elixir/exercises/grains/example.exs +10 -3
  85. data/tracks/elixir/exercises/grains/grains.exs +0 -2
  86. data/tracks/elixir/exercises/grains/grains_test.exs +16 -14
  87. data/tracks/elixir/exercises/grep/example.exs +22 -18
  88. data/tracks/elixir/exercises/grep/grep.exs +1 -2
  89. data/tracks/elixir/exercises/grep/grep_test.exs +108 -112
  90. data/tracks/elixir/exercises/hamming/example.exs +3 -2
  91. data/tracks/elixir/exercises/hamming/hamming_test.exs +7 -4
  92. data/tracks/elixir/exercises/hello-world/example.exs +1 -1
  93. data/tracks/elixir/exercises/hello-world/hello_world.exs +1 -1
  94. data/tracks/elixir/exercises/hello-world/hello_world_test.exs +2 -2
  95. data/tracks/elixir/exercises/hexadecimal/example.exs +8 -7
  96. data/tracks/elixir/exercises/hexadecimal/hexadecimal.exs +0 -1
  97. data/tracks/elixir/exercises/hexadecimal/hexadecimal_test.exs +3 -3
  98. data/tracks/elixir/exercises/isbn-verifier/example.exs +1 -1
  99. data/tracks/elixir/exercises/isbn-verifier/isbn_verifier.exs +1 -2
  100. data/tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs +2 -2
  101. data/tracks/elixir/exercises/isogram/example.exs +5 -5
  102. data/tracks/elixir/exercises/isogram/isogram.exs +1 -3
  103. data/tracks/elixir/exercises/isogram/isogram_test.exs +2 -3
  104. data/tracks/elixir/exercises/kindergarten-garden/example.exs +15 -3
  105. data/tracks/elixir/exercises/kindergarten-garden/garden_test.exs +17 -4
  106. data/tracks/elixir/exercises/largest-series-product/example.exs +10 -9
  107. data/tracks/elixir/exercises/largest-series-product/largest_series_product.exs +1 -3
  108. data/tracks/elixir/exercises/largest-series-product/largest_series_product_test.exs +6 -4
  109. data/tracks/elixir/exercises/leap/example.exs +2 -2
  110. data/tracks/elixir/exercises/leap/leap.exs +0 -1
  111. data/tracks/elixir/exercises/leap/leap_test.exs +2 -2
  112. data/tracks/elixir/exercises/list-ops/example.exs +10 -9
  113. data/tracks/elixir/exercises/list-ops/list_ops.exs +1 -8
  114. data/tracks/elixir/exercises/list-ops/list_ops_test.exs +22 -25
  115. data/tracks/elixir/exercises/luhn/example.exs +16 -17
  116. data/tracks/elixir/exercises/luhn/luhn.exs +0 -2
  117. data/tracks/elixir/exercises/luhn/luhn_test.exs +2 -2
  118. data/tracks/elixir/exercises/markdown/example.exs +40 -14
  119. data/tracks/elixir/exercises/markdown/markdown.exs +8 -4
  120. data/tracks/elixir/exercises/markdown/markdown_test.exs +6 -3
  121. data/tracks/elixir/exercises/matrix/example.exs +6 -6
  122. data/tracks/elixir/exercises/matrix/matrix.exs +0 -1
  123. data/tracks/elixir/exercises/matrix/matrix_test.exs +11 -11
  124. data/tracks/elixir/exercises/meetup/example.exs +20 -13
  125. data/tracks/elixir/exercises/meetup/meetup.exs +8 -4
  126. data/tracks/elixir/exercises/meetup/meetup_test.exs +2 -2
  127. data/tracks/elixir/exercises/minesweeper/minesweeper.exs +1 -3
  128. data/tracks/elixir/exercises/minesweeper/minesweeper_test.exs +7 -21
  129. data/tracks/elixir/exercises/nth-prime/example.exs +7 -7
  130. data/tracks/elixir/exercises/nth-prime/nth_prime.exs +0 -1
  131. data/tracks/elixir/exercises/nth-prime/nth_prime_test.exs +3 -3
  132. data/tracks/elixir/exercises/nucleotide-count/example.exs +4 -3
  133. data/tracks/elixir/exercises/nucleotide-count/nucleotide_count.exs +0 -3
  134. data/tracks/elixir/exercises/nucleotide-count/nucleotide_count_test.exs +2 -2
  135. data/tracks/elixir/exercises/ocr-numbers/example.exs +3 -3
  136. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers.exs +1 -2
  137. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers_test.exs +54 -70
  138. data/tracks/elixir/exercises/palindrome-products/example.exs +3 -6
  139. data/tracks/elixir/exercises/palindrome-products/palindrome_products.exs +0 -1
  140. data/tracks/elixir/exercises/palindrome-products/palindrome_products_test.exs +8 -8
  141. data/tracks/elixir/exercises/pangram/pangram.exs +1 -1
  142. data/tracks/elixir/exercises/pangram/pangram_test.exs +5 -3
  143. data/tracks/elixir/exercises/parallel-letter-frequency/example.exs +7 -5
  144. data/tracks/elixir/exercises/parallel-letter-frequency/frequency.exs +1 -2
  145. data/tracks/elixir/exercises/parallel-letter-frequency/parallel_letter_frequency_test.exs +3 -4
  146. data/tracks/elixir/exercises/pascals-triangle/example.exs +2 -1
  147. data/tracks/elixir/exercises/pascals-triangle/pascals_triangle_test.exs +26 -8
  148. data/tracks/elixir/exercises/perfect-numbers/example.exs +8 -6
  149. data/tracks/elixir/exercises/perfect-numbers/perfect_numbers.exs +1 -2
  150. data/tracks/elixir/exercises/perfect-numbers/perfect_numbers_test.exs +18 -17
  151. data/tracks/elixir/exercises/phone-number/example.exs +19 -11
  152. data/tracks/elixir/exercises/phone-number/phone_number.exs +3 -3
  153. data/tracks/elixir/exercises/phone-number/phone_number_test.exs +2 -2
  154. data/tracks/elixir/exercises/pig-latin/pig_latin.exs +0 -1
  155. data/tracks/elixir/exercises/pig-latin/pig_latin_test.exs +3 -3
  156. data/tracks/elixir/exercises/poker/example.exs +104 -41
  157. data/tracks/elixir/exercises/poker/poker.exs +0 -1
  158. data/tracks/elixir/exercises/poker/poker_test.exs +7 -5
  159. data/tracks/elixir/exercises/prime-factors/example.exs +4 -8
  160. data/tracks/elixir/exercises/prime-factors/prime_factors.exs +0 -1
  161. data/tracks/elixir/exercises/prime-factors/prime_factors_test.exs +5 -5
  162. data/tracks/elixir/exercises/protein-translation/example.exs +14 -12
  163. data/tracks/elixir/exercises/protein-translation/protein_translation.exs +2 -3
  164. data/tracks/elixir/exercises/protein-translation/protein_translation_test.exs +26 -26
  165. data/tracks/elixir/exercises/pythagorean-triplet/example.exs +5 -4
  166. data/tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet.exs +0 -5
  167. data/tracks/elixir/exercises/pythagorean-triplet/pythagorean_triplet_test.exs +3 -3
  168. data/tracks/elixir/exercises/queen-attack/example.exs +9 -7
  169. data/tracks/elixir/exercises/queen-attack/queen_attack.exs +1 -4
  170. data/tracks/elixir/exercises/rail-fence-cipher/example.exs +18 -15
  171. data/tracks/elixir/exercises/rail-fence-cipher/rail_fence_cipher.exs +2 -4
  172. data/tracks/elixir/exercises/rail-fence-cipher/rail_fence_cipher_test.exs +2 -2
  173. data/tracks/elixir/exercises/raindrops/example.exs +3 -2
  174. data/tracks/elixir/exercises/raindrops/raindrops.exs +1 -2
  175. data/tracks/elixir/exercises/raindrops/raindrops_test.exs +2 -2
  176. data/tracks/elixir/exercises/rna-transcription/example.exs +1 -1
  177. data/tracks/elixir/exercises/rna-transcription/rna_transcription.exs +0 -1
  178. data/tracks/elixir/exercises/rna-transcription/rna_transcription_test.exs +2 -2
  179. data/tracks/elixir/exercises/robot-simulator/example.exs +33 -19
  180. data/tracks/elixir/exercises/robot-simulator/robot_simulator.exs +3 -5
  181. data/tracks/elixir/exercises/robot-simulator/robot_simulator_test.exs +26 -25
  182. data/tracks/elixir/exercises/roman-numerals/example.exs +14 -13
  183. data/tracks/elixir/exercises/roman-numerals/roman.exs +1 -1
  184. data/tracks/elixir/exercises/roman-numerals/roman_numerals_test.exs +2 -2
  185. data/tracks/elixir/exercises/rotational-cipher/example.exs +12 -8
  186. data/tracks/elixir/exercises/rotational-cipher/rotational_cipher.exs +0 -1
  187. data/tracks/elixir/exercises/rotational-cipher/rotational_cipher_test.exs +6 -4
  188. data/tracks/elixir/exercises/run-length-encoding/example.exs +20 -8
  189. data/tracks/elixir/exercises/run-length-encoding/rle.exs +2 -4
  190. data/tracks/elixir/exercises/run-length-encoding/rle_test.exs +6 -4
  191. data/tracks/elixir/exercises/saddle-points/example.exs +4 -3
  192. data/tracks/elixir/exercises/saddle-points/saddle_points.exs +0 -3
  193. data/tracks/elixir/exercises/saddle-points/saddle_points_test.exs +2 -2
  194. data/tracks/elixir/exercises/say/say.exs +1 -1
  195. data/tracks/elixir/exercises/say/say_test.exs +5 -3
  196. data/tracks/elixir/exercises/scale-generator/example.exs +20 -9
  197. data/tracks/elixir/exercises/scale-generator/scale_generator.exs +2 -2
  198. data/tracks/elixir/exercises/scale-generator/scale_generator_test.exs +16 -17
  199. data/tracks/elixir/exercises/scrabble-score/scrabble.exs +1 -2
  200. data/tracks/elixir/exercises/scrabble-score/scrabble_score_test.exs +2 -2
  201. data/tracks/elixir/exercises/secret-handshake/example.exs +4 -4
  202. data/tracks/elixir/exercises/secret-handshake/secret_handshake.exs +0 -1
  203. data/tracks/elixir/exercises/secret-handshake/secret_handshake_test.exs +3 -3
  204. data/tracks/elixir/exercises/series/example.exs +2 -2
  205. data/tracks/elixir/exercises/series/series.exs +0 -1
  206. data/tracks/elixir/exercises/series/series_test.exs +3 -4
  207. data/tracks/elixir/exercises/sieve/example.exs +4 -5
  208. data/tracks/elixir/exercises/sieve/sieve.exs +0 -3
  209. data/tracks/elixir/exercises/sieve/sieve_test.exs +173 -21
  210. data/tracks/elixir/exercises/simple-cipher/example.exs +8 -8
  211. data/tracks/elixir/exercises/simple-cipher/simple_cipher.exs +0 -1
  212. data/tracks/elixir/exercises/simple-cipher/simple_cipher_test.exs +3 -4
  213. data/tracks/elixir/exercises/simple-linked-list/example.exs +3 -1
  214. data/tracks/elixir/exercises/simple-linked-list/linked_list_test.exs +5 -2
  215. data/tracks/elixir/exercises/space-age/example.exs +5 -6
  216. data/tracks/elixir/exercises/space-age/space_age.exs +9 -3
  217. data/tracks/elixir/exercises/space-age/space_age_test.exs +2 -2
  218. data/tracks/elixir/exercises/spiral-matrix/example.exs +10 -5
  219. data/tracks/elixir/exercises/spiral-matrix/spiral.exs +0 -1
  220. data/tracks/elixir/exercises/spiral-matrix/spiral_test.exs +21 -21
  221. data/tracks/elixir/exercises/strain/example.exs +5 -4
  222. data/tracks/elixir/exercises/strain/strain.exs +2 -2
  223. data/tracks/elixir/exercises/strain/strain_test.exs +12 -7
  224. data/tracks/elixir/exercises/sublist/example.exs +11 -7
  225. data/tracks/elixir/exercises/sublist/sublist.exs +0 -1
  226. data/tracks/elixir/exercises/sublist/sublist_test.exs +16 -18
  227. data/tracks/elixir/exercises/sum-of-multiples/example.exs +3 -4
  228. data/tracks/elixir/exercises/sum-of-multiples/sum_of_multiples.exs +0 -1
  229. data/tracks/elixir/exercises/sum-of-multiples/sum_of_multiples_test.exs +4 -4
  230. data/tracks/elixir/exercises/test_helper.exs +4 -4
  231. data/tracks/elixir/exercises/tournament/example.exs +20 -13
  232. data/tracks/elixir/exercises/tournament/tournament.exs +0 -1
  233. data/tracks/elixir/exercises/tournament/tournament_test.exs +37 -30
  234. data/tracks/elixir/exercises/transpose/example.exs +4 -4
  235. data/tracks/elixir/exercises/transpose/transpose.exs +1 -1
  236. data/tracks/elixir/exercises/transpose/transpose_test.exs +89 -156
  237. data/tracks/elixir/exercises/triangle/example.exs +7 -7
  238. data/tracks/elixir/exercises/triangle/triangle.exs +1 -2
  239. data/tracks/elixir/exercises/triangle/triangle_test.exs +17 -17
  240. data/tracks/elixir/exercises/twelve-days/example.exs +10 -6
  241. data/tracks/elixir/exercises/twelve-days/twelve_days.exs +1 -2
  242. data/tracks/elixir/exercises/twelve-days/twelve_days_test.exs +55 -45
  243. data/tracks/elixir/exercises/word-count/example.exs +5 -5
  244. data/tracks/elixir/exercises/word-count/word_count.exs +1 -2
  245. data/tracks/elixir/exercises/word-count/word_count_test.exs +5 -5
  246. data/tracks/elixir/exercises/wordy/example.exs +13 -14
  247. data/tracks/elixir/exercises/wordy/wordy.exs +1 -4
  248. data/tracks/elixir/exercises/wordy/wordy_test.exs +2 -2
  249. data/tracks/elixir/exercises/zipper/example.exs +48 -37
  250. data/tracks/elixir/exercises/zipper/zipper.exs +20 -14
  251. data/tracks/elixir/exercises/zipper/zipper_test.exs +19 -20
  252. data/tracks/go/.travis.yml +1 -1
  253. data/tracks/go/exercises/paasio/paasio_test.go +76 -0
  254. data/tracks/ocaml/exercises/acronym/test.ml +3 -5
  255. data/tracks/ocaml/exercises/all-your-base/test.ml +2 -2
  256. data/tracks/ocaml/exercises/anagram/test.ml +1 -9
  257. data/tracks/ocaml/exercises/atbash-cipher/test.ml +1 -1
  258. data/tracks/ocaml/exercises/binary-search/test.ml +1 -1
  259. data/tracks/ocaml/exercises/bob/test.ml +1 -1
  260. data/tracks/ocaml/exercises/bracket-push/test.ml +1 -1
  261. data/tracks/ocaml/exercises/connect/test.ml +1 -1
  262. data/tracks/ocaml/exercises/difference-of-squares/test.ml +1 -1
  263. data/tracks/ocaml/exercises/dominoes/test.ml +1 -1
  264. data/tracks/ocaml/exercises/hello-world/test.ml +1 -1
  265. data/tracks/ocaml/exercises/leap/test.ml +2 -2
  266. data/tracks/ocaml/exercises/luhn/test.ml +2 -2
  267. data/tracks/ocaml/exercises/pangram/test.ml +1 -1
  268. data/tracks/ocaml/exercises/phone-number/test.ml +7 -3
  269. data/tracks/ocaml/exercises/prime-factors/test.ml +1 -1
  270. data/tracks/ocaml/exercises/raindrops/test.ml +1 -1
  271. data/tracks/ocaml/exercises/react/example.ml +1 -1
  272. data/tracks/ocaml/exercises/roman-numerals/test.ml +3 -1
  273. data/tracks/ocaml/exercises/run-length-encoding/test.ml +1 -1
  274. data/tracks/ocaml/exercises/space-age/test.ml +1 -1
  275. data/tracks/ocaml/exercises/word-count/test.ml +1 -1
  276. data/tracks/swift/circle.yml +21 -2
  277. metadata +3 -2
@@ -22,7 +22,7 @@ defmodule Phone do
22
22
  iex> Phone.number("867.5309")
23
23
  "0000000000"
24
24
  """
25
- @spec number(String.t) :: String.t
25
+ @spec number(String.t()) :: String.t()
26
26
  def number(raw) do
27
27
  end
28
28
 
@@ -46,7 +46,7 @@ defmodule Phone do
46
46
  iex> Phone.area_code("867.5309")
47
47
  "000"
48
48
  """
49
- @spec area_code(String.t) :: String.t
49
+ @spec area_code(String.t()) :: String.t()
50
50
  def area_code(raw) do
51
51
  end
52
52
 
@@ -70,7 +70,7 @@ defmodule Phone do
70
70
  iex> Phone.pretty("867.5309")
71
71
  "(000) 000-0000"
72
72
  """
73
- @spec pretty(String.t) :: String.t
73
+ @spec pretty(String.t()) :: String.t()
74
74
  def pretty(raw) do
75
75
  end
76
76
  end
@@ -2,8 +2,8 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
2
  Code.load_file("phone_number.exs", __DIR__)
3
3
  end
4
4
 
5
- ExUnit.start
6
- ExUnit.configure exclude: :pending, trace: true
5
+ ExUnit.start()
6
+ ExUnit.configure(exclude: :pending, trace: true)
7
7
 
8
8
  defmodule PhoneTest do
9
9
  use ExUnit.Case
@@ -17,4 +17,3 @@ defmodule PigLatin do
17
17
  def translate(phrase) do
18
18
  end
19
19
  end
20
-
@@ -2,14 +2,14 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
2
  Code.load_file("pig_latin.exs", __DIR__)
3
3
  end
4
4
 
5
- ExUnit.start
6
- ExUnit.configure exclude: :pending, trace: true
5
+ ExUnit.start()
6
+ ExUnit.configure(exclude: :pending, trace: true)
7
7
 
8
8
  defmodule PigLatinTest do
9
9
  use ExUnit.Case
10
10
 
11
11
  describe "ay is added to words that start with vowels" do
12
- #@tag :pending
12
+ # @tag :pending
13
13
  test "word beginning with a" do
14
14
  assert PigLatin.translate("apple") == "appleay"
15
15
  end
@@ -29,9 +29,10 @@ defmodule Poker do
29
29
  """
30
30
  @spec best_hand(list(list(String.t()))) :: list(list(String.t()))
31
31
  def best_hand(hands) do
32
- sorted_hands = hands
33
- |> Enum.map(&score_hand/1)
34
- |> Enum.sort(&sort_scored_hands/2)
32
+ sorted_hands =
33
+ hands
34
+ |> Enum.map(&score_hand/1)
35
+ |> Enum.sort(&sort_scored_hands/2)
35
36
 
36
37
  [{_, highest_score, highest_extra} | _] = sorted_hands
37
38
 
@@ -47,19 +48,21 @@ defmodule Poker do
47
48
  @suits ~w(clubs diamonds hearts spades)a
48
49
  @scores ~w(straight_flush four_of_a_kind full_house flush straight three_of_a_kind two_pair pair high_card)a
49
50
 
50
- for {rank, value} <- Enum.with_index(@ranks, 2), suit <- @suits do
51
- suit_char = suit |> to_string |> String.upcase |> String.first
51
+ for {rank, value} <- Enum.with_index(@ranks, 2),
52
+ suit <- @suits do
53
+ suit_char = suit |> to_string |> String.upcase() |> String.first()
52
54
 
53
- defp card(<< unquote(rank), unquote(suit_char) >>), do: {unquote(value), unquote(suit)}
55
+ defp card(<<unquote(rank), unquote(suit_char)>>), do: {unquote(value), unquote(suit)}
54
56
  end
55
57
 
56
58
  defp score_hand(hand) do
57
- {ranks, suits} = hand
58
- |> Enum.map(&card/1)
59
- |> Enum.sort(&sort_rank_asc/2)
60
- |> Enum.unzip
59
+ {ranks, suits} =
60
+ hand
61
+ |> Enum.map(&card/1)
62
+ |> Enum.sort(&sort_rank_asc/2)
63
+ |> Enum.unzip()
61
64
 
62
- flush = suits |> Enum.uniq |> length |> Kernel.==(1)
65
+ flush = suits |> Enum.uniq() |> length |> Kernel.==(1)
63
66
 
64
67
  ranks
65
68
  |> Enum.group_by(fn x -> x end)
@@ -71,41 +74,70 @@ defmodule Poker do
71
74
 
72
75
  defp score_hand(_, [2, 3, 4, 5, 14], true), do: {:straight_flush, {5}}
73
76
  defp score_hand(_, [2, 3, 4, 5, 14], _), do: {:straight, {5}}
74
- defp score_hand(counts, [low, _, _, _, high], true) when length(counts) == 5 and high-low == 4, do: {:straight_flush, {high}}
75
- defp score_hand(counts, [low, _, _, _, high], _) when length(counts) == 5 and high-low == 4, do: {:straight, {high}}
76
- defp score_hand(_, ranks, true), do: {:flush, {ranks |> Enum.sort |> Enum.reverse}}
77
+
78
+ defp score_hand(counts, [low, _, _, _, high], true) when length(counts) == 5 and high - low == 4,
79
+ do: {:straight_flush, {high}}
80
+
81
+ defp score_hand(counts, [low, _, _, _, high], _) when length(counts) == 5 and high - low == 4,
82
+ do: {:straight, {high}}
83
+
84
+ defp score_hand(_, ranks, true), do: {:flush, {ranks |> Enum.sort() |> Enum.reverse()}}
77
85
  defp score_hand([{kicker, 1}, {high, 4}], _, _), do: {:four_of_a_kind, {high, kicker}}
78
86
  defp score_hand([{pair, 2}, {triplet, 3}], _, _), do: {:full_house, {triplet, pair}}
79
- defp score_hand([{kicker1, 1}, {kicker2, 1}, {triplet, 3}], _, _), do: {:three_of_a_kind, {triplet, [ kicker1, kicker2 ] |> Enum.sort |> Enum.reverse}}
80
- defp score_hand([{kicker, 1}, {low_pair, 2}, {high_pair, 2}], _, _), do: {:two_pair, {high_pair, low_pair, kicker}}
81
- defp score_hand([{kicker1, 1}, {kicker2, 1}, {kicker3, 1}, {pair, 2}], _, _), do: {:pair, {pair, [ kicker1, kicker2, kicker3 ] |> Enum.sort |> Enum.reverse}}
82
- defp score_hand(_, ranks, _), do: {:high_card, {ranks |> Enum.sort |> Enum.reverse}}
87
+
88
+ defp score_hand([{kicker1, 1}, {kicker2, 1}, {triplet, 3}], _, _),
89
+ do: {:three_of_a_kind, {triplet, [kicker1, kicker2] |> Enum.sort() |> Enum.reverse()}}
90
+
91
+ defp score_hand([{kicker, 1}, {low_pair, 2}, {high_pair, 2}], _, _),
92
+ do: {:two_pair, {high_pair, low_pair, kicker}}
93
+
94
+ defp score_hand([{kicker1, 1}, {kicker2, 1}, {kicker3, 1}, {pair, 2}], _, _),
95
+ do: {:pair, {pair, [kicker1, kicker2, kicker3] |> Enum.sort() |> Enum.reverse()}}
96
+
97
+ defp score_hand(_, ranks, _), do: {:high_card, {ranks |> Enum.sort() |> Enum.reverse()}}
83
98
 
84
99
  defp sort_rank_asc({rank1, _}, {rank2, _}), do: rank1 <= rank2
85
- defp sort_count_then_rank_asc({rank1, count1}, {rank2, count2}), do: count1 <= count2 and rank1 <= rank2
100
+
101
+ defp sort_count_then_rank_asc({rank1, count1}, {rank2, count2}),
102
+ do: count1 <= count2 and rank1 <= rank2
86
103
 
87
104
  # Compare different scores against each other first
88
105
  for {score, index} <- @scores |> Enum.with_index(1) do
89
106
  for other_score <- @scores |> Enum.drop(index) do
90
- defp sort_scored_hands({_, unquote(score), _}, {_, unquote(other_score), _} ), do: true
91
- defp sort_scored_hands({_, unquote(other_score), _}, {_, unquote(score), _} ), do: false
107
+ defp sort_scored_hands({_, unquote(score), _}, {_, unquote(other_score), _}), do: true
108
+ defp sort_scored_hands({_, unquote(other_score), _}, {_, unquote(score), _}), do: false
92
109
  end
93
110
  end
94
111
 
95
112
  # Additional rules for tiebreakers
96
113
 
97
114
  # Straight flush tie determined by high card
98
- defp sort_scored_hands({_, :straight_flush, {high_a}}, {_, :straight_flush, {high_b}}), do: high_a >= high_b
115
+ defp sort_scored_hands({_, :straight_flush, {high_a}}, {_, :straight_flush, {high_b}}),
116
+ do: high_a >= high_b
99
117
 
100
118
  # 4-of-a-kind tie determined by rank, then by kicker
101
- defp sort_scored_hands({_, :four_of_a_kind, {rank_a, _}}, {_, :four_of_a_kind, {rank_b, _}}) when rank_a > rank_b, do: true
102
- defp sort_scored_hands({_, :four_of_a_kind, {rank_a, _}}, {_, :four_of_a_kind, {rank_b, _}}) when rank_a < rank_b, do: false
103
- defp sort_scored_hands({_, :four_of_a_kind, {_, kicker_a}}, {_, :four_of_a_kind, {_, kicker_b}}), do: kicker_a >= kicker_b
119
+ defp sort_scored_hands({_, :four_of_a_kind, {rank_a, _}}, {_, :four_of_a_kind, {rank_b, _}})
120
+ when rank_a > rank_b,
121
+ do: true
122
+
123
+ defp sort_scored_hands({_, :four_of_a_kind, {rank_a, _}}, {_, :four_of_a_kind, {rank_b, _}})
124
+ when rank_a < rank_b,
125
+ do: false
126
+
127
+ defp sort_scored_hands({_, :four_of_a_kind, {_, kicker_a}}, {_, :four_of_a_kind, {_, kicker_b}}),
128
+ do: kicker_a >= kicker_b
104
129
 
105
130
  # Full house tie determined by triplet, then pair
106
- defp sort_scored_hands({_, :full_house, {triplet_a, _}}, {_, :full_house, {triplet_b, _}}) when triplet_a > triplet_b, do: true
107
- defp sort_scored_hands({_, :full_house, {triplet_a, _}}, {_, :full_house, {triplet_b, _}}) when triplet_a < triplet_b, do: false
108
- defp sort_scored_hands({_, :full_house, {_, pair_a}}, {_, :full_house, {_, pair_b}}), do: pair_a >= pair_b
131
+ defp sort_scored_hands({_, :full_house, {triplet_a, _}}, {_, :full_house, {triplet_b, _}})
132
+ when triplet_a > triplet_b,
133
+ do: true
134
+
135
+ defp sort_scored_hands({_, :full_house, {triplet_a, _}}, {_, :full_house, {triplet_b, _}})
136
+ when triplet_a < triplet_b,
137
+ do: false
138
+
139
+ defp sort_scored_hands({_, :full_house, {_, pair_a}}, {_, :full_house, {_, pair_b}}),
140
+ do: pair_a >= pair_b
109
141
 
110
142
  # Flush tie determined by high card, comparing all 5 if necessary
111
143
  defp sort_scored_hands({_, :flush, {ranks_a}}, {_, :flush, {ranks_b}}), do: ranks_a >= ranks_b
@@ -114,23 +146,54 @@ defmodule Poker do
114
146
  defp sort_scored_hands({_, :straight, {high_a}}, {_, :straight, {high_b}}), do: high_a >= high_b
115
147
 
116
148
  # 3-of-a-kind tie determined by triplet, then by high card, comparing both if necessary
117
- defp sort_scored_hands({_, :three_of_a_kind, {triplet_a, _}}, {_, :three_of_a_kind, {triplet_b, _}}) when triplet_a > triplet_b, do: true
118
- defp sort_scored_hands({_, :three_of_a_kind, {triplet_a, _}}, {_, :three_of_a_kind, {triplet_b, _}}) when triplet_a < triplet_b, do: false
119
- defp sort_scored_hands({_, :three_of_a_kind, {_, ranks_a}}, {_, :three_of_a_kind, {_, ranks_b}}), do: ranks_a >= ranks_b
149
+ defp sort_scored_hands(
150
+ {_, :three_of_a_kind, {triplet_a, _}},
151
+ {_, :three_of_a_kind, {triplet_b, _}}
152
+ )
153
+ when triplet_a > triplet_b,
154
+ do: true
155
+
156
+ defp sort_scored_hands(
157
+ {_, :three_of_a_kind, {triplet_a, _}},
158
+ {_, :three_of_a_kind, {triplet_b, _}}
159
+ )
160
+ when triplet_a < triplet_b,
161
+ do: false
162
+
163
+ defp sort_scored_hands({_, :three_of_a_kind, {_, ranks_a}}, {_, :three_of_a_kind, {_, ranks_b}}),
164
+ do: ranks_a >= ranks_b
120
165
 
121
166
  # Two-pair tie determined by high pair, then low pair, then by kicker
122
- defp sort_scored_hands({_, :two_pair, {high_a, _, _}}, {_, :two_pair, {high_b, _, _}}) when high_a > high_b, do: true
123
- defp sort_scored_hands({_, :two_pair, {high_a, _, _}}, {_, :two_pair, {high_b, _, _}}) when high_a < high_b, do: false
124
- defp sort_scored_hands({_, :two_pair, {_, low_a, _}}, {_, :two_pair, {_, low_b, _}}) when low_a > low_b, do: true
125
- defp sort_scored_hands({_, :two_pair, {_, low_a, _}}, {_, :two_pair, {_, low_b, _}}) when low_a < low_b, do: false
126
- defp sort_scored_hands({_, :two_pair, {_, _, kicker_a}}, {_, :two_pair, {_, _, kicker_b}}), do: kicker_a >= kicker_b
167
+ defp sort_scored_hands({_, :two_pair, {high_a, _, _}}, {_, :two_pair, {high_b, _, _}})
168
+ when high_a > high_b,
169
+ do: true
170
+
171
+ defp sort_scored_hands({_, :two_pair, {high_a, _, _}}, {_, :two_pair, {high_b, _, _}})
172
+ when high_a < high_b,
173
+ do: false
174
+
175
+ defp sort_scored_hands({_, :two_pair, {_, low_a, _}}, {_, :two_pair, {_, low_b, _}})
176
+ when low_a > low_b,
177
+ do: true
178
+
179
+ defp sort_scored_hands({_, :two_pair, {_, low_a, _}}, {_, :two_pair, {_, low_b, _}})
180
+ when low_a < low_b,
181
+ do: false
182
+
183
+ defp sort_scored_hands({_, :two_pair, {_, _, kicker_a}}, {_, :two_pair, {_, _, kicker_b}}),
184
+ do: kicker_a >= kicker_b
127
185
 
128
186
  # Pair tie determined by pair rank, then by high card, comparing all 3 if necessary
129
- defp sort_scored_hands({_, :pair, {pair_a, _}}, {_, :pair, {pair_b, _}}) when pair_a > pair_b, do: true
130
- defp sort_scored_hands({_, :pair, {pair_a, _}}, {_, :pair, {pair_b, _}}) when pair_a < pair_b, do: false
131
- defp sort_scored_hands({_, :pair, {_, kickers_a}}, {_, :pair, {_, kickers_b}}), do: kickers_a >= kickers_b
187
+ defp sort_scored_hands({_, :pair, {pair_a, _}}, {_, :pair, {pair_b, _}}) when pair_a > pair_b,
188
+ do: true
189
+
190
+ defp sort_scored_hands({_, :pair, {pair_a, _}}, {_, :pair, {pair_b, _}}) when pair_a < pair_b,
191
+ do: false
192
+
193
+ defp sort_scored_hands({_, :pair, {_, kickers_a}}, {_, :pair, {_, kickers_b}}),
194
+ do: kickers_a >= kickers_b
132
195
 
133
196
  # High-card tie determined by high card, comparing all 5 if necessary
134
- defp sort_scored_hands({_, :high_card, {ranks_a}}, {_, :high_card, {ranks_b}}), do: ranks_a >= ranks_b
197
+ defp sort_scored_hands({_, :high_card, {ranks_a}}, {_, :high_card, {ranks_b}}),
198
+ do: ranks_a >= ranks_b
135
199
  end
136
-
@@ -31,4 +31,3 @@ defmodule Poker do
31
31
  def best_hand(hands) do
32
32
  end
33
33
  end
34
-
@@ -2,13 +2,13 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
2
  Code.load_file("poker.exs", __DIR__)
3
3
  end
4
4
 
5
- ExUnit.start
6
- ExUnit.configure exclude: :pending, trace: true
5
+ ExUnit.start()
6
+ ExUnit.configure(exclude: :pending, trace: true)
7
7
 
8
8
  defmodule PokerTest do
9
9
  use ExUnit.Case
10
10
 
11
- #@tag :pending
11
+ # @tag :pending
12
12
  test "single hand always wins" do
13
13
  high_of_jack = ~w(4S 5S 7H 8D JC)
14
14
  assert Poker.best_hand([high_of_jack]) == [high_of_jack]
@@ -103,7 +103,10 @@ defmodule PokerTest do
103
103
  assert Poker.best_hand([three_aces_7_high, three_aces_8_high]) == [three_aces_8_high]
104
104
 
105
105
  three_aces_8_high_5_low = ~w(5S AH AS 8C AD)
106
- assert Poker.best_hand([three_aces_8_high_5_low, three_aces_8_high]) == [three_aces_8_high_5_low]
106
+
107
+ assert Poker.best_hand([three_aces_8_high_5_low, three_aces_8_high]) == [
108
+ three_aces_8_high_5_low
109
+ ]
107
110
  end
108
111
 
109
112
  @tag :pending
@@ -214,4 +217,3 @@ defmodule PokerTest do
214
217
  assert Poker.best_hand([straight_flush_to_8, straight_flush_to_9]) == [straight_flush_to_9]
215
218
  end
216
219
  end
217
-
@@ -4,12 +4,8 @@ defmodule PrimeFactors do
4
4
  do_factors(number, 2, [])
5
5
  end
6
6
 
7
- defp do_factors(1, _, acc),
8
- do: Enum.reverse(acc)
9
- defp do_factors(n, i, acc) when n < i * i,
10
- do: Enum.reverse(acc, [n])
11
- defp do_factors(n, i, acc) when rem(n, i) == 0,
12
- do: do_factors(div(n, i), i, [i | acc])
13
- defp do_factors(n, i, acc),
14
- do: do_factors(n, i + 1, acc)
7
+ defp do_factors(1, _, acc), do: Enum.reverse(acc)
8
+ defp do_factors(n, i, acc) when n < i * i, do: Enum.reverse(acc, [n])
9
+ defp do_factors(n, i, acc) when rem(n, i) == 0, do: do_factors(div(n, i), i, [i | acc])
10
+ defp do_factors(n, i, acc), do: do_factors(n, i + 1, acc)
15
11
  end
@@ -9,6 +9,5 @@ defmodule PrimeFactors do
9
9
  """
10
10
  @spec factors_for(pos_integer) :: [pos_integer]
11
11
  def factors_for(number) do
12
-
13
12
  end
14
13
  end
@@ -2,8 +2,8 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
2
  Code.load_file("prime_factors.exs", __DIR__)
3
3
  end
4
4
 
5
- ExUnit.start
6
- ExUnit.configure exclude: :pending, trace: true
5
+ ExUnit.start()
6
+ ExUnit.configure(exclude: :pending, trace: true)
7
7
 
8
8
  defmodule PrimeFactorsTest do
9
9
  use ExUnit.Case
@@ -55,12 +55,12 @@ defmodule PrimeFactorsTest do
55
55
 
56
56
  @tag :pending
57
57
  test "901255" do
58
- assert PrimeFactors.factors_for(901255) == [5, 17, 23, 461]
58
+ assert PrimeFactors.factors_for(901_255) == [5, 17, 23, 461]
59
59
  end
60
60
 
61
61
  @tag :pending
62
62
  test "93819012551" do
63
- assert PrimeFactors.factors_for(93819012551) == [11, 9539, 894119]
63
+ assert PrimeFactors.factors_for(93_819_012_551) == [11, 9539, 894_119]
64
64
  end
65
65
 
66
66
  @tag :pending
@@ -70,6 +70,6 @@ defmodule PrimeFactorsTest do
70
70
  # in under two sconds. Uncomment it if you want to test the efficiency of your
71
71
  # solution.
72
72
  test "10000000055" do
73
- assert PrimeFactors.factors_for(10000000055) == [5, 2000000011]
73
+ assert PrimeFactors.factors_for(10_000_000_055) == [5, 2_000_000_011]
74
74
  end
75
75
  end
@@ -2,7 +2,7 @@ defmodule ProteinTranslation do
2
2
  @doc """
3
3
  Given an RNA string, return a list of proteins specified by codons, in order.
4
4
  """
5
- @spec of_rna(String.t()) :: { atom, list(String.t()) }
5
+ @spec of_rna(String.t()) :: {atom, list(String.t())}
6
6
  def of_rna(rna) do
7
7
  translate_rna(rna, [])
8
8
  end
@@ -28,7 +28,7 @@ defmodule ProteinTranslation do
28
28
  UAG -> STOP
29
29
  UGA -> STOP
30
30
  """
31
- @spec of_codon(String.t()) :: { atom, String.t() }
31
+ @spec of_codon(String.t()) :: {atom, String.t()}
32
32
  def of_codon(codon) do
33
33
  translate_codon(codon)
34
34
  end
@@ -40,23 +40,25 @@ defmodule ProteinTranslation do
40
40
  "Serine" => ~w(UCU UCC UCA UCG),
41
41
  "Tyrosine" => ~w(UAU UAC),
42
42
  "Cysteine" => ~w(UGU UGC),
43
- "Tryptophan" => ~w(UGG),
43
+ "Tryptophan" => ~w(UGG)
44
44
  }
45
45
  @stop ~w(UAA UAG UGA)
46
46
 
47
- defp translate_rna("", results), do: { :ok, Enum.reverse(results) }
47
+ defp translate_rna("", results), do: {:ok, Enum.reverse(results)}
48
48
 
49
49
  for codon <- @stop do
50
- defp translate_rna(unquote(codon) <> _rest, results), do: { :ok, Enum.reverse(results) }
51
- defp translate_codon(unquote(codon)), do: { :ok, "STOP" }
50
+ defp translate_rna(unquote(codon) <> _rest, results), do: {:ok, Enum.reverse(results)}
51
+ defp translate_codon(unquote(codon)), do: {:ok, "STOP"}
52
52
  end
53
53
 
54
- for { protein, codons } <- @codons, codon <- codons do
55
- defp translate_rna(unquote(codon) <> rest, results), do: translate_rna(rest, [unquote(protein) | results])
56
- defp translate_codon(unquote(codon)), do: { :ok, unquote(protein) }
54
+ for {protein, codons} <- @codons,
55
+ codon <- codons do
56
+ defp translate_rna(unquote(codon) <> rest, results),
57
+ do: translate_rna(rest, [unquote(protein) | results])
58
+
59
+ defp translate_codon(unquote(codon)), do: {:ok, unquote(protein)}
57
60
  end
58
61
 
59
- defp translate_rna(_, _), do: { :error, "invalid RNA"}
60
- defp translate_codon(_), do: { :error, "invalid codon"}
62
+ defp translate_rna(_, _), do: {:error, "invalid RNA"}
63
+ defp translate_codon(_), do: {:error, "invalid codon"}
61
64
  end
62
-
@@ -2,7 +2,7 @@ defmodule ProteinTranslation do
2
2
  @doc """
3
3
  Given an RNA string, return a list of proteins specified by codons, in order.
4
4
  """
5
- @spec of_rna(String.t()) :: { atom, list(String.t()) }
5
+ @spec of_rna(String.t()) :: {atom, list(String.t())}
6
6
  def of_rna(rna) do
7
7
  end
8
8
 
@@ -27,8 +27,7 @@ defmodule ProteinTranslation do
27
27
  UAG -> STOP
28
28
  UGA -> STOP
29
29
  """
30
- @spec of_codon(String.t()) :: { atom, String.t() }
30
+ @spec of_codon(String.t()) :: {atom, String.t()}
31
31
  def of_codon(codon) do
32
32
  end
33
33
  end
34
-
@@ -2,91 +2,91 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
2
2
  Code.load_file("protein_translation.exs", __DIR__)
3
3
  end
4
4
 
5
- ExUnit.start
6
- ExUnit.configure exclude: :pending, trace: true
5
+ ExUnit.start()
6
+ ExUnit.configure(exclude: :pending, trace: true)
7
7
 
8
8
  defmodule ProteinTranslationTest do
9
9
  use ExUnit.Case
10
10
 
11
- #@tag :pending
11
+ # @tag :pending
12
12
  test "AUG translates to methionine" do
13
- assert ProteinTranslation.of_codon("AUG") == { :ok, "Methionine" }
13
+ assert ProteinTranslation.of_codon("AUG") == {:ok, "Methionine"}
14
14
  end
15
15
 
16
16
  @tag :pending
17
17
  test "identifies Phenylalanine codons" do
18
- assert ProteinTranslation.of_codon("UUU") == { :ok, "Phenylalanine" }
19
- assert ProteinTranslation.of_codon("UUC") == { :ok, "Phenylalanine" }
18
+ assert ProteinTranslation.of_codon("UUU") == {:ok, "Phenylalanine"}
19
+ assert ProteinTranslation.of_codon("UUC") == {:ok, "Phenylalanine"}
20
20
  end
21
21
 
22
22
  @tag :pending
23
23
  test "identifies Leucine codons" do
24
- assert ProteinTranslation.of_codon("UUA") == { :ok, "Leucine" }
25
- assert ProteinTranslation.of_codon("UUG") == { :ok, "Leucine" }
24
+ assert ProteinTranslation.of_codon("UUA") == {:ok, "Leucine"}
25
+ assert ProteinTranslation.of_codon("UUG") == {:ok, "Leucine"}
26
26
  end
27
27
 
28
28
  @tag :pending
29
29
  test "identifies Serine codons" do
30
- assert ProteinTranslation.of_codon("UCU") == { :ok, "Serine" }
31
- assert ProteinTranslation.of_codon("UCC") == { :ok, "Serine" }
32
- assert ProteinTranslation.of_codon("UCA") == { :ok, "Serine" }
33
- assert ProteinTranslation.of_codon("UCG") == { :ok, "Serine" }
30
+ assert ProteinTranslation.of_codon("UCU") == {:ok, "Serine"}
31
+ assert ProteinTranslation.of_codon("UCC") == {:ok, "Serine"}
32
+ assert ProteinTranslation.of_codon("UCA") == {:ok, "Serine"}
33
+ assert ProteinTranslation.of_codon("UCG") == {:ok, "Serine"}
34
34
  end
35
35
 
36
36
  @tag :pending
37
37
  test "identifies Tyrosine codons" do
38
- assert ProteinTranslation.of_codon("UAU") == { :ok, "Tyrosine" }
39
- assert ProteinTranslation.of_codon("UAC") == { :ok, "Tyrosine" }
38
+ assert ProteinTranslation.of_codon("UAU") == {:ok, "Tyrosine"}
39
+ assert ProteinTranslation.of_codon("UAC") == {:ok, "Tyrosine"}
40
40
  end
41
41
 
42
42
  @tag :pending
43
43
  test "identifies Cysteine codons" do
44
- assert ProteinTranslation.of_codon("UGU") == { :ok, "Cysteine" }
45
- assert ProteinTranslation.of_codon("UGC") == { :ok, "Cysteine" }
44
+ assert ProteinTranslation.of_codon("UGU") == {:ok, "Cysteine"}
45
+ assert ProteinTranslation.of_codon("UGC") == {:ok, "Cysteine"}
46
46
  end
47
47
 
48
48
  @tag :pending
49
49
  test "identifies Tryptophan codons" do
50
- assert ProteinTranslation.of_codon("UGG") == { :ok, "Tryptophan" }
50
+ assert ProteinTranslation.of_codon("UGG") == {:ok, "Tryptophan"}
51
51
  end
52
52
 
53
53
  @tag :pending
54
54
  test "identifies stop codons" do
55
- assert ProteinTranslation.of_codon("UAA") == { :ok, "STOP" }
56
- assert ProteinTranslation.of_codon("UAG") == { :ok, "STOP" }
57
- assert ProteinTranslation.of_codon("UGA") == { :ok, "STOP" }
55
+ assert ProteinTranslation.of_codon("UAA") == {:ok, "STOP"}
56
+ assert ProteinTranslation.of_codon("UAG") == {:ok, "STOP"}
57
+ assert ProteinTranslation.of_codon("UGA") == {:ok, "STOP"}
58
58
  end
59
59
 
60
60
  @tag :pending
61
61
  test "translates rna strand into correct protein" do
62
62
  strand = "AUGUUUUGG"
63
- assert ProteinTranslation.of_rna(strand) == { :ok, ~w(Methionine Phenylalanine Tryptophan) }
63
+ assert ProteinTranslation.of_rna(strand) == {:ok, ~w(Methionine Phenylalanine Tryptophan)}
64
64
  end
65
65
 
66
66
  @tag :pending
67
67
  test "stops translation if stop codon present" do
68
68
  strand = "AUGUUUUAA"
69
- assert ProteinTranslation.of_rna(strand) == { :ok, ~w(Methionine Phenylalanine) }
69
+ assert ProteinTranslation.of_rna(strand) == {:ok, ~w(Methionine Phenylalanine)}
70
70
  end
71
71
 
72
72
  @tag :pending
73
73
  test "stops translation of longer strand" do
74
74
  strand = "UGGUGUUAUUAAUGGUUU"
75
- assert ProteinTranslation.of_rna(strand) == { :ok, ~w(Tryptophan Cysteine Tyrosine) }
75
+ assert ProteinTranslation.of_rna(strand) == {:ok, ~w(Tryptophan Cysteine Tyrosine)}
76
76
  end
77
77
 
78
78
  @tag :pending
79
79
  test "invalid RNA" do
80
- assert ProteinTranslation.of_rna("CARROT") == { :error, "invalid RNA" }
80
+ assert ProteinTranslation.of_rna("CARROT") == {:error, "invalid RNA"}
81
81
  end
82
82
 
83
83
  @tag :pending
84
84
  test "invalid codon at end of RNA" do
85
- assert ProteinTranslation.of_rna("UUUROT") == { :error, "invalid RNA" }
85
+ assert ProteinTranslation.of_rna("UUUROT") == {:error, "invalid RNA"}
86
86
  end
87
87
 
88
88
  @tag :pending
89
89
  test "invalid codon" do
90
- assert ProteinTranslation.of_codon("INVALID") == { :error, "invalid codon" }
90
+ assert ProteinTranslation.of_codon("INVALID") == {:error, "invalid codon"}
91
91
  end
92
92
  end