trackler 2.2.1.49 → 2.2.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/bin/verify-configs +1 -1
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +0 -37
  5. data/tracks/c/exercises/allergies/test/test_allergies.c +41 -41
  6. data/tracks/common-lisp/config.json +266 -252
  7. data/tracks/common-lisp/config/maintainers.json +23 -23
  8. data/tracks/common-lisp/exercises/allergies/README.md +0 -1
  9. data/tracks/common-lisp/exercises/atbash-cipher/README.md +2 -1
  10. data/tracks/common-lisp/exercises/beer-song/README.md +1 -1
  11. data/tracks/common-lisp/exercises/binary/README.md +2 -0
  12. data/tracks/common-lisp/exercises/collatz-conjecture/README.md +4 -8
  13. data/tracks/common-lisp/exercises/crypto-square/README.md +4 -4
  14. data/tracks/common-lisp/exercises/etl/README.md +2 -0
  15. data/tracks/common-lisp/exercises/grade-school/README.md +0 -1
  16. data/tracks/common-lisp/exercises/grains/README.md +0 -1
  17. data/tracks/common-lisp/exercises/leap/README.md +1 -1
  18. data/tracks/common-lisp/exercises/meetup/README.md +1 -2
  19. data/tracks/common-lisp/exercises/nucleotide-count/README.md +8 -22
  20. data/tracks/common-lisp/exercises/pascals-triangle/README.md +1 -1
  21. data/tracks/common-lisp/exercises/perfect-numbers/README.md +3 -4
  22. data/tracks/common-lisp/exercises/phone-number/README.md +3 -2
  23. data/tracks/common-lisp/exercises/roman-numerals/README.md +1 -1
  24. data/tracks/common-lisp/exercises/scrabble-score/README.md +3 -1
  25. data/tracks/common-lisp/exercises/space-age/README.md +2 -1
  26. data/tracks/common-lisp/exercises/sublist/README.md +65 -0
  27. data/tracks/common-lisp/exercises/sublist/example.lisp +24 -0
  28. data/tracks/common-lisp/exercises/sublist/sublist-test.lisp +87 -0
  29. data/tracks/common-lisp/exercises/sublist/sublist.lisp +8 -0
  30. data/tracks/common-lisp/exercises/triangle/README.md +9 -6
  31. data/tracks/common-lisp/exercises/trinary/README.md +1 -1
  32. data/tracks/common-lisp/exercises/word-count/README.md +1 -2
  33. data/tracks/ecmascript/config.json +30 -0
  34. data/tracks/ecmascript/exercises/bowling/README.md +80 -0
  35. data/tracks/ecmascript/exercises/bowling/bowling.spec.js +159 -0
  36. data/tracks/ecmascript/exercises/bowling/example.js +67 -0
  37. data/tracks/ecmascript/exercises/bowling/package.json +71 -0
  38. data/tracks/ecmascript/exercises/two-fer/README.md +47 -0
  39. data/tracks/ecmascript/exercises/two-fer/example.js +4 -0
  40. data/tracks/ecmascript/exercises/two-fer/package.json +69 -0
  41. data/tracks/ecmascript/exercises/two-fer/two-fer.spec.js +18 -0
  42. data/tracks/fsharp/exercises/pascals-triangle/Example.fs +12 -8
  43. data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangle.fs +2 -2
  44. data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangleTest.fs +15 -12
  45. data/tracks/fsharp/generators/Generators.fs +19 -0
  46. data/tracks/fsharp/generators/Templates/_AssertThrows.liquid +1 -0
  47. data/tracks/java/docs/ABOUT.md +13 -31
  48. data/tracks/java/exercises/bracket-push/.meta/version +1 -1
  49. data/tracks/java/exercises/bracket-push/src/test/java/BracketCheckerTest.java +7 -1
  50. data/tracks/java/exercises/collatz-conjecture/.meta/version +1 -1
  51. data/tracks/java/exercises/etl/README.md +1 -1
  52. data/tracks/java/exercises/ocr-numbers/README.md +1 -1
  53. data/tracks/java/exercises/pascals-triangle/README.md +1 -1
  54. data/tracks/java/exercises/perfect-numbers/.meta/version +1 -1
  55. data/tracks/java/exercises/rna-transcription/README.md +1 -1
  56. data/tracks/java/exercises/secret-handshake/.meta/version +1 -1
  57. data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +1 -9
  58. data/tracks/java/scripts/canonical_data_check.sh +104 -0
  59. data/tracks/javascript/exercises/twelve-days/example.js +23 -25
  60. data/tracks/julia/.travis.yml +1 -0
  61. data/tracks/kotlin/exercises/all-your-base/.meta/version +1 -0
  62. data/tracks/kotlin/exercises/all-your-base/src/test/kotlin/BaseConverterTest.kt +0 -3
  63. data/tracks/kotlin/exercises/change/.meta/version +1 -0
  64. data/tracks/kotlin/exercises/change/src/test/kotlin/ChangeCalculatorTest.kt +0 -3
  65. data/tracks/kotlin/exercises/clock/.meta/version +1 -0
  66. data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockAddTest.kt +1 -4
  67. data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockCreationTest.kt +1 -4
  68. data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockEqualTest.kt +1 -4
  69. data/tracks/kotlin/exercises/collatz-conjecture/.meta/version +1 -0
  70. data/tracks/kotlin/exercises/collatz-conjecture/src/test/kotlin/CollatzCalculatorTest.kt +0 -3
  71. data/tracks/kotlin/exercises/complex-numbers/.meta/version +1 -0
  72. data/tracks/kotlin/exercises/complex-numbers/src/test/kotlin/ComplexNumberTest.kt +0 -3
  73. data/tracks/kotlin/exercises/diamond/.meta/version +1 -0
  74. data/tracks/kotlin/exercises/diamond/src/test/kotlin/DiamondPrinterTest.kt +0 -3
  75. data/tracks/kotlin/exercises/etl/README.md +1 -1
  76. data/tracks/kotlin/exercises/forth/.meta/version +1 -0
  77. data/tracks/kotlin/exercises/forth/src/test/kotlin/ForthEvaluatorTest.kt +0 -3
  78. data/tracks/kotlin/exercises/grains/.meta/version +1 -0
  79. data/tracks/kotlin/exercises/grains/src/test/kotlin/BoardTest.kt +0 -3
  80. data/tracks/kotlin/exercises/hamming/.meta/version +1 -0
  81. data/tracks/kotlin/exercises/hamming/src/test/kotlin/HammingTest.kt +0 -3
  82. data/tracks/kotlin/exercises/list-ops/.meta/version +1 -0
  83. data/tracks/kotlin/exercises/list-ops/src/test/kotlin/ListExtensionsTest.kt +0 -3
  84. data/tracks/kotlin/exercises/meetup/.meta/version +1 -0
  85. data/tracks/kotlin/exercises/meetup/src/test/kotlin/MeetupTest.kt +0 -3
  86. data/tracks/kotlin/exercises/minesweeper/.meta/version +1 -0
  87. data/tracks/kotlin/exercises/minesweeper/src/test/kotlin/MinesweeperBoardTest.kt +0 -3
  88. data/tracks/kotlin/exercises/pangram/.meta/version +1 -0
  89. data/tracks/kotlin/exercises/pangram/src/test/kotlin/PangramTest.kt +0 -3
  90. data/tracks/kotlin/exercises/pascals-triangle/README.md +1 -1
  91. data/tracks/kotlin/exercises/prime-factors/.meta/version +1 -0
  92. data/tracks/kotlin/exercises/prime-factors/src/test/kotlin/PrimeFactorCalculatorTest.kt +0 -3
  93. data/tracks/kotlin/exercises/rna-transcription/.meta/version +1 -0
  94. data/tracks/kotlin/exercises/rna-transcription/README.md +1 -1
  95. data/tracks/kotlin/exercises/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt +0 -3
  96. data/tracks/kotlin/exercises/robot-simulator/.meta/version +1 -0
  97. data/tracks/kotlin/exercises/robot-simulator/src/test/kotlin/RobotTest.kt +0 -3
  98. data/tracks/kotlin/exercises/rotational-cipher/.meta/version +1 -0
  99. data/tracks/kotlin/exercises/rotational-cipher/src/test/kotlin/RotationalCipherTest.kt +0 -3
  100. data/tracks/kotlin/exercises/saddle-points/.meta/version +1 -0
  101. data/tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt +0 -3
  102. data/tracks/kotlin/exercises/say/.meta/version +1 -0
  103. data/tracks/kotlin/exercises/say/src/test/kotlin/NumberSpellerTest.kt +0 -3
  104. data/tracks/kotlin/exercises/secret-handshake/.meta/version +1 -0
  105. data/tracks/kotlin/exercises/secret-handshake/src/test/kotlin/HandshakeCalculatorTest.kt +0 -3
  106. data/tracks/kotlin/exercises/spiral-matrix/.meta/version +1 -0
  107. data/tracks/kotlin/exercises/spiral-matrix/src/test/kotlin/SpiralMatrixTest.kt +0 -3
  108. data/tracks/kotlin/exercises/sublist/.meta/version +1 -0
  109. data/tracks/kotlin/exercises/sublist/src/test/kotlin/SublistTest.kt +0 -3
  110. data/tracks/kotlin/scripts/canonical_data_check.sh +104 -0
  111. data/tracks/perl6/exercises/accumulate/accumulate.t +2 -3
  112. data/tracks/perl6/exercises/all-your-base/all-your-base.t +17 -18
  113. data/tracks/perl6/exercises/allergies/allergies.t +17 -18
  114. data/tracks/perl6/exercises/anagram/anagram.t +17 -18
  115. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +17 -18
  116. data/tracks/perl6/exercises/bob/bob.t +20 -22
  117. data/tracks/perl6/exercises/bob/example.yaml +1 -2
  118. data/tracks/perl6/exercises/clock/clock.t +17 -18
  119. data/tracks/perl6/exercises/flatten-array/flatten-array.t +17 -18
  120. data/tracks/perl6/exercises/grade-school/grade-school.t +2 -3
  121. data/tracks/perl6/exercises/grains/grains.t +17 -18
  122. data/tracks/perl6/exercises/hello-world/example.yaml +1 -2
  123. data/tracks/perl6/exercises/hello-world/hello-world.t +20 -22
  124. data/tracks/perl6/exercises/leap/leap.t +17 -18
  125. data/tracks/perl6/exercises/linked-list/linked-list.t +2 -3
  126. data/tracks/perl6/exercises/luhn/luhn.t +17 -18
  127. data/tracks/perl6/exercises/phone-number/phone-number.t +17 -18
  128. data/tracks/perl6/exercises/raindrops/raindrops.t +17 -18
  129. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -18
  130. data/tracks/perl6/exercises/robot-name/robot-name.t +2 -3
  131. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +17 -18
  132. data/tracks/perl6/exercises/space-age/space-age.t +17 -18
  133. data/tracks/perl6/exercises/word-count/word-count.t +17 -18
  134. data/tracks/perl6/exercises/wordy/wordy.t +17 -18
  135. data/tracks/perl6/templates/test.mustache +9 -10
  136. data/tracks/purescript/config.json +11 -0
  137. data/tracks/purescript/exercises/rna-transcription/README.md +25 -0
  138. data/tracks/purescript/exercises/rna-transcription/bower.json +26 -0
  139. data/tracks/purescript/exercises/rna-transcription/examples/src/RNATranscription.purs +18 -0
  140. data/tracks/purescript/exercises/rna-transcription/src/RNATranscription.purs +3 -0
  141. data/tracks/purescript/exercises/rna-transcription/test/Main.purs +48 -0
  142. data/tracks/python/exercises/variable-length-quantity/example.py +6 -6
  143. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity.py +2 -2
  144. data/tracks/ruby/config.json +6 -0
  145. data/tracks/ruby/exercises/complex-numbers/.meta/.version +1 -0
  146. data/tracks/ruby/exercises/complex-numbers/.meta/generator/complex_numbers_case.rb +44 -0
  147. data/tracks/ruby/exercises/complex-numbers/.meta/solutions/complex_numbers.rb +49 -0
  148. data/tracks/ruby/exercises/complex-numbers/README.md +64 -0
  149. data/tracks/ruby/exercises/complex-numbers/complex_numbers_test.rb +207 -0
  150. data/tracks/ruby/exercises/crypto-square/.meta/.version +1 -0
  151. data/tracks/ruby/exercises/crypto-square/.meta/generator/crypto_square_case.rb +19 -0
  152. data/tracks/ruby/exercises/crypto-square/.meta/solutions/crypto_square.rb +20 -15
  153. data/tracks/ruby/exercises/crypto-square/README.md +10 -8
  154. data/tracks/ruby/exercises/crypto-square/crypto_square_test.rb +45 -81
  155. data/tracks/ruby/exercises/flatten-array/.meta/.version +1 -0
  156. data/tracks/ruby/exercises/flatten-array/.meta/generator/flatten_array_case.rb +11 -0
  157. data/tracks/ruby/exercises/flatten-array/.meta/solutions/flatten_array.rb +5 -2
  158. data/tracks/ruby/exercises/flatten-array/flatten_array_test.rb +32 -7
  159. data/tracks/ruby/exercises/hamming/hamming_test.rb +3 -3
  160. data/tracks/ruby/exercises/isogram/isogram_test.rb +4 -4
  161. data/tracks/ruby/exercises/leap/leap_test.rb +2 -2
  162. data/tracks/ruby/exercises/pig-latin/.meta/.version +1 -1
  163. data/tracks/ruby/exercises/pig-latin/.meta/solutions/pig_latin.rb +2 -2
  164. data/tracks/ruby/exercises/pig-latin/pig_latin_test.rb +17 -7
  165. data/tracks/ruby/exercises/queen-attack/.meta/generator/queen_attack_case.rb +1 -1
  166. data/tracks/ruby/exercises/queen-attack/queen_attack_test.rb +7 -7
  167. data/tracks/ruby/exercises/sum-of-multiples/.meta/.version +1 -1
  168. data/tracks/ruby/exercises/sum-of-multiples/.meta/solutions/sum_of_multiples.rb +1 -1
  169. data/tracks/ruby/exercises/sum-of-multiples/sum_of_multiples_test.rb +7 -2
  170. metadata +53 -2
@@ -0,0 +1,19 @@
1
+ require 'generator/exercise_case'
2
+
3
+ class CryptoSquareCase < Generator::ExerciseCase
4
+
5
+ def workload
6
+ indent_lines([plaintext_setter, assertion], 4)
7
+ end
8
+
9
+ private
10
+
11
+ def plaintext_setter
12
+ "plaintext = '#{plaintext}'"
13
+ end
14
+
15
+ def assertion
16
+ assert_equal { "Crypto.new(plaintext).ciphertext" }
17
+ end
18
+
19
+ end
@@ -4,36 +4,41 @@ class Crypto
4
4
  @plaintext = plaintext
5
5
  end
6
6
 
7
+ def ciphertext
8
+ transposed.join(' ')
9
+ end
10
+
11
+ private
12
+
7
13
  def normalize_plaintext
8
14
  @normalized ||= @plaintext.downcase.gsub(/\W/, '')
9
15
  end
10
16
 
11
17
  def plaintext_segments
12
- normalize_plaintext.chars.
13
- each_slice(size).
14
- map{ |s| s.join('') }.
15
- to_a
18
+ if size > 0
19
+ normalize_plaintext.chars.
20
+ each_slice(size).
21
+ map{ |s| s.join('') }.
22
+ to_a
23
+ else
24
+ []
25
+ end
16
26
  end
17
27
 
18
28
  def size
19
29
  Math.sqrt(normalize_plaintext.length).ceil
20
30
  end
21
31
 
22
- def ciphertext
23
- transposed.join('')
24
- end
25
-
26
- def normalize_ciphertext
27
- transposed.join(' ')
28
- end
29
-
30
- private
31
-
32
32
  def transposed
33
33
  chunk_size = size
34
34
  chunks = plaintext_segments.map do |s|
35
- Array.new(chunk_size) { |i| s[i] or '' }
35
+ Array.new(chunk_size) { |i| s[i] or ' ' }
36
36
  end
37
37
  chunks.transpose.map{ |s| s.join('') }
38
38
  end
39
+
40
+ end
41
+
42
+ module BookKeeping
43
+ VERSION = 1
39
44
  end
@@ -26,7 +26,7 @@ and `r` is the number of rows.
26
26
  Our normalized text is 54 characters long, dictating a rectangle with
27
27
  `c = 8` and `r = 7`:
28
28
 
29
- ```plain
29
+ ```text
30
30
  ifmanwas
31
31
  meanttos
32
32
  tayonthe
@@ -41,22 +41,24 @@ right.
41
41
 
42
42
  The message above is coded as:
43
43
 
44
- ```plain
44
+ ```text
45
45
  imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
46
46
  ```
47
47
 
48
- Output the encoded text in chunks. Phrases that fill perfect squares
49
- `(r X r)` should be output in `r`-length chunks separated by spaces.
50
- Imperfect squares will have `n` empty spaces. Those spaces should be distributed evenly across the last `n` rows.
48
+ Output the encoded text in chunks. Phrases that fill perfect rectangles
49
+ `(r X c)` should be output `c` chunks of `r` length, separated by spaces.
50
+ Phrases that do not fill perfect rectangles will have `n` empty spaces.
51
+ Those spaces should be distributed evenly, added to the end of the last
52
+ `n` chunks.
51
53
 
52
- ```plain
53
- imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
54
+ ```text
55
+ imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau
54
56
  ```
55
57
 
56
58
  Notice that were we to stack these, we could visually decode the
57
59
  cyphertext back in to the original message:
58
60
 
59
- ```plain
61
+ ```text
60
62
  imtgdvs
61
63
  fearwer
62
64
  mayoogo
@@ -1,105 +1,69 @@
1
1
  require 'minitest/autorun'
2
2
  require_relative 'crypto_square'
3
3
 
4
- class CryptoTest < Minitest::Test
5
- def test_normalize_strange_characters
6
- crypto = Crypto.new('s#$%^&plunk')
7
- assert_equal 'splunk', crypto.normalize_plaintext
4
+ # Common test data version: 3.1.0 e937744
5
+ class CryptoSquareTest < Minitest::Test
6
+ def test_empty_plaintext_results_in_an_empty_ciphertext
7
+ # skip
8
+ plaintext = ''
9
+ assert_equal "", Crypto.new(plaintext).ciphertext
8
10
  end
9
11
 
10
- def test_normalize_uppercase_characters
12
+ def test_lowercase
11
13
  skip
12
- crypto = Crypto.new('WHOA HEY!')
13
- assert_equal 'whoahey', crypto.normalize_plaintext
14
+ plaintext = 'A'
15
+ assert_equal "a", Crypto.new(plaintext).ciphertext
14
16
  end
15
17
 
16
- def test_normalize_with_numbers
18
+ def test_remove_spaces
17
19
  skip
18
- crypto = Crypto.new('1, 2, 3 GO!')
19
- assert_equal '123go', crypto.normalize_plaintext
20
+ plaintext = ' b '
21
+ assert_equal "b", Crypto.new(plaintext).ciphertext
20
22
  end
21
23
 
22
- def test_size_of_small_square
24
+ def test_remove_punctuation
23
25
  skip
24
- crypto = Crypto.new('1234')
25
- assert_equal 2, crypto.size
26
+ plaintext = '@1,%!'
27
+ assert_equal "1", Crypto.new(plaintext).ciphertext
26
28
  end
27
29
 
28
- def test_size_of_slightly_larger_square
30
+ def test_9_character_plaintext_results_in_3_chunks_of_3_characters
29
31
  skip
30
- crypto = Crypto.new('123456789')
31
- assert_equal 3, crypto.size
32
+ plaintext = 'This is fun!'
33
+ assert_equal "tsf hiu isn", Crypto.new(plaintext).ciphertext
32
34
  end
33
35
 
34
- def test_size_of_non_perfect_square
36
+ def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space
35
37
  skip
36
- crypto = Crypto.new('123456789abc')
37
- assert_equal 4, crypto.size
38
+ plaintext = 'Chill out.'
39
+ assert_equal "clu hlt io ", Crypto.new(plaintext).ciphertext
38
40
  end
39
41
 
40
- def test_size_is_determined_by_normalized_plaintext
42
+ def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces
41
43
  skip
42
- crypto = Crypto.new('Oh hey, this is nuts!')
43
- assert_equal 4, crypto.size
44
- end
45
-
46
- def test_plaintext_segments
47
- skip
48
- crypto = Crypto.new('Never vex thine heart with idle woes')
49
- expected = %w(neverv exthin eheart withid lewoes)
50
- assert_equal expected, crypto.plaintext_segments
51
- end
52
-
53
- def test_other_plaintext_segments
54
- skip
55
- crypto = Crypto.new('ZOMG! ZOMBIES!!!')
56
- assert_equal %w(zomg zomb ies), crypto.plaintext_segments
57
- end
58
-
59
- def test_ciphertext
60
- skip
61
- crypto = Crypto.new('Time is an illusion. Lunchtime doubly so.')
62
- assert_equal 'tasneyinicdsmiohooelntuillibsuuml', crypto.ciphertext
63
- end
64
-
65
- def test_another_ciphertext
66
- skip
67
- crypto = Crypto.new('We all know interspecies romance is weird.')
68
- assert_equal 'wneiaweoreneawssciliprerlneoidktcms', crypto.ciphertext
69
- end
70
-
71
- def test_normalized_ciphertext
72
- skip
73
- crypto = Crypto.new('Vampires are people too!')
74
- assert_equal 'vrel aepe mset paoo irpo', crypto.normalize_ciphertext
75
- end
76
-
77
- def test_normalized_ciphertext_spills_into_short_segment
78
- skip
79
- crypto = Crypto.new('Madness, and then illumination.')
80
- expected = 'msemo aanin dnin ndla etlt shui'
81
- assert_equal expected, crypto.normalize_ciphertext
82
- end
83
-
84
- def test_another_normalized_ciphertext
85
- skip
86
- crypto = Crypto.new(
87
- 'If man was meant to stay on the ground god would have given us roots',
88
- )
89
- expected = 'imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau'
90
- assert_equal expected, crypto.normalize_ciphertext
91
- end
92
-
93
- def test_normalized_ciphertext_with_punctuation
94
- skip
95
- crypto = Crypto.new('Have a nice day. Feed the dog & chill out!')
96
- expected = 'hifei acedl veeol eddgo aatcu nyhht'
97
- assert_equal expected, crypto.normalize_ciphertext
98
- end
99
-
100
- def test_normalized_ciphertext_when_just_less_then_a_full_square
44
+ plaintext = 'If man was meant to stay on the ground, god would have given us roots.'
45
+ assert_equal "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ", Crypto.new(plaintext).ciphertext
46
+ end
47
+
48
+ # Problems in exercism evolve over time, as we find better ways to ask
49
+ # questions.
50
+ # The version number refers to the version of the problem you solved,
51
+ # not your solution.
52
+ #
53
+ # Define a constant named VERSION inside of the top level BookKeeping
54
+ # module, which may be placed near the end of your file.
55
+ #
56
+ # In your file, it will look like this:
57
+ #
58
+ # module BookKeeping
59
+ # VERSION = 1 # Where the version number matches the one in the test.
60
+ # end
61
+ #
62
+ # If you are curious, read more about constants on RubyDoc:
63
+ # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
64
+
65
+ def test_bookkeeping
101
66
  skip
102
- crypto = Crypto.new('I am')
103
- assert_equal 'im a', crypto.normalize_ciphertext
67
+ assert_equal 1, BookKeeping::VERSION
104
68
  end
105
69
  end
@@ -0,0 +1,11 @@
1
+ require 'generator/exercise_case'
2
+
3
+ class FlattenArrayCase < Generator::ExerciseCase
4
+
5
+ def workload
6
+ declaration = "fa = FlattenArray.flatten(#{canonical.input})"
7
+ assertion = "assert_equal #{canonical.expected}, fa"
8
+ indent_lines([declaration, assertion], 4)
9
+ end
10
+
11
+ end
@@ -1,6 +1,9 @@
1
- class FlattenArray
1
+ module BookKeeping
2
2
  VERSION = 1
3
+ end
4
+
5
+ class FlattenArray
3
6
  def self.flatten(arr)
4
7
  arr.flatten.compact
5
8
  end
6
- end
9
+ end
@@ -1,38 +1,63 @@
1
1
  require 'minitest/autorun'
2
2
  require_relative 'flatten_array'
3
3
 
4
+ # Common test data version: 1.1.0 d7a3c09
4
5
  class FlattenArrayTest < Minitest::Test
5
- def test_two_level_nesting
6
+ def test_no_nesting
7
+ # skip
8
+ fa = FlattenArray.flatten([0, 1, 2])
9
+ assert_equal [0, 1, 2], fa
10
+ end
11
+
12
+ def test_flattens_array_with_just_integers_present
13
+ skip
6
14
  fa = FlattenArray.flatten([1, [2, 3, 4, 5, 6, 7], 8])
7
15
  assert_equal [1, 2, 3, 4, 5, 6, 7, 8], fa
8
16
  end
9
17
 
10
- def test_five_level_nesting
18
+ def test_5_level_nesting
11
19
  skip
12
20
  fa = FlattenArray.flatten([0, 2, [[2, 3], 8, 100, 4, [[[50]]]], -2])
13
21
  assert_equal [0, 2, 2, 3, 8, 100, 4, 50, -2], fa
14
22
  end
15
23
 
16
- def test_six_level_nesting
24
+ def test_6_level_nesting
17
25
  skip
18
26
  fa = FlattenArray.flatten([1, [2, [[3]], [4, [[5]]], 6, 7], 8])
19
27
  assert_equal [1, 2, 3, 4, 5, 6, 7, 8], fa
20
28
  end
21
29
 
22
- def test_six_level_nesting_with_nil_values
30
+ def test_6_level_nest_list_with_null_values
23
31
  skip
24
32
  fa = FlattenArray.flatten([0, 2, [[2, 3], 8, [[100]], nil, [[nil]]], -2])
25
33
  assert_equal [0, 2, 2, 3, 8, 100, -2], fa
26
34
  end
27
35
 
28
- def test_all_values_are_nil
36
+ def test_all_values_in_nested_list_are_null
29
37
  skip
30
- fa = FlattenArray.flatten([nil, [[[nil]]], nil, [[nil, nil], nil], nil])
38
+ fa = FlattenArray.flatten([nil, [[[nil]]], nil, nil, [[nil, nil], nil], nil])
31
39
  assert_equal [], fa
32
40
  end
33
41
 
42
+ # Problems in exercism evolve over time, as we find better ways to ask
43
+ # questions.
44
+ # The version number refers to the version of the problem you solved,
45
+ # not your solution.
46
+ #
47
+ # Define a constant named VERSION inside of the top level BookKeeping
48
+ # module, which may be placed near the end of your file.
49
+ #
50
+ # In your file, it will look like this:
51
+ #
52
+ # module BookKeeping
53
+ # VERSION = 1 # Where the version number matches the one in the test.
54
+ # end
55
+ #
56
+ # If you are curious, read more about constants on RubyDoc:
57
+ # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html
58
+
34
59
  def test_bookkeeping
35
60
  skip
36
- assert_equal 1, FlattenArray::VERSION
61
+ assert_equal 1, BookKeeping::VERSION
37
62
  end
38
63
  end
@@ -1,7 +1,7 @@
1
1
  require 'minitest/autorun'
2
2
  require_relative 'hamming'
3
3
 
4
- # Common test data version: 2.0.0 a2aff5b
4
+ # Common test data version: 2.0.1 f79dfd7
5
5
  class HammingTest < Minitest::Test
6
6
  def test_empty_strands
7
7
  # skip
@@ -45,12 +45,12 @@ class HammingTest < Minitest::Test
45
45
 
46
46
  def test_non_unique_character_in_first_strand
47
47
  skip
48
- assert_equal 1, Hamming.compute('AGA', 'AGG')
48
+ assert_equal 1, Hamming.compute('AAG', 'AAA')
49
49
  end
50
50
 
51
51
  def test_non_unique_character_in_second_strand
52
52
  skip
53
- assert_equal 1, Hamming.compute('AGG', 'AGA')
53
+ assert_equal 1, Hamming.compute('AAA', 'AAG')
54
54
  end
55
55
 
56
56
  def test_same_nucleotides_in_different_positions
@@ -1,7 +1,7 @@
1
1
  require 'minitest/autorun'
2
2
  require_relative 'isogram'
3
3
 
4
- # Common test data version: 1.1.0 857c40d
4
+ # Common test data version: 1.2.0 f9e0ebb
5
5
  class IsogramTest < Minitest::Test
6
6
  def test_empty_string
7
7
  # skip
@@ -39,10 +39,10 @@ class IsogramTest < Minitest::Test
39
39
  assert Isogram.isogram?(string), "Expected true, 'thumbscrew-japingly' is an isogram"
40
40
  end
41
41
 
42
- def test_isogram_with_duplicated_non_letter_character
42
+ def test_isogram_with_duplicated_hyphen
43
43
  skip
44
- string = "Hjelmqvist-Gryb-Zock-Pfund-Wax"
45
- assert Isogram.isogram?(string), "Expected true, 'Hjelmqvist-Gryb-Zock-Pfund-Wax' is an isogram"
44
+ string = "six-year-old"
45
+ assert Isogram.isogram?(string), "Expected true, 'six-year-old' is an isogram"
46
46
  end
47
47
 
48
48
  def test_made_up_name_that_is_an_isogram
@@ -1,7 +1,7 @@
1
1
  require 'minitest/autorun'
2
2
  require_relative 'leap'
3
3
 
4
- # Common test data version: 1.0.0 cc65ebe
4
+ # Common test data version: 1.1.0 7f4d0d8
5
5
  class Date
6
6
  def leap?
7
7
  raise RuntimeError, "Implement this yourself instead of using Ruby's implementation."
@@ -19,7 +19,7 @@ class YearTest < Minitest::Test
19
19
 
20
20
  def test_year_divisible_by_4_not_divisible_by_100_leap_year
21
21
  skip
22
- assert Year.leap?(2016), "Expected 'true', 2016 is a leap year."
22
+ assert Year.leap?(2020), "Expected 'true', 2020 is a leap year."
23
23
  end
24
24
 
25
25
  def test_year_divisible_by_100_not_divisible_by_400_common_year
@@ -1 +1 @@
1
- 1
1
+ 2
@@ -24,10 +24,10 @@ class PigLatin
24
24
  end
25
25
 
26
26
  def parse_initial_consonant_sound_and_remainder
27
- word.scan(/\A([^aeiou]?qu|[^aeiou]+)(.*)/).first
27
+ word.scan(/\A([^aeiou]?qu|[^aeiou]+(?=y)|[^aeiou]+)(.*)/).first
28
28
  end
29
29
  end
30
30
 
31
31
  module BookKeeping
32
- VERSION = 1
32
+ VERSION = 2
33
33
  end