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.
- checksums.yaml +4 -4
- data/bin/verify-configs +1 -1
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +0 -37
- data/tracks/c/exercises/allergies/test/test_allergies.c +41 -41
- data/tracks/common-lisp/config.json +266 -252
- data/tracks/common-lisp/config/maintainers.json +23 -23
- data/tracks/common-lisp/exercises/allergies/README.md +0 -1
- data/tracks/common-lisp/exercises/atbash-cipher/README.md +2 -1
- data/tracks/common-lisp/exercises/beer-song/README.md +1 -1
- data/tracks/common-lisp/exercises/binary/README.md +2 -0
- data/tracks/common-lisp/exercises/collatz-conjecture/README.md +4 -8
- data/tracks/common-lisp/exercises/crypto-square/README.md +4 -4
- data/tracks/common-lisp/exercises/etl/README.md +2 -0
- data/tracks/common-lisp/exercises/grade-school/README.md +0 -1
- data/tracks/common-lisp/exercises/grains/README.md +0 -1
- data/tracks/common-lisp/exercises/leap/README.md +1 -1
- data/tracks/common-lisp/exercises/meetup/README.md +1 -2
- data/tracks/common-lisp/exercises/nucleotide-count/README.md +8 -22
- data/tracks/common-lisp/exercises/pascals-triangle/README.md +1 -1
- data/tracks/common-lisp/exercises/perfect-numbers/README.md +3 -4
- data/tracks/common-lisp/exercises/phone-number/README.md +3 -2
- data/tracks/common-lisp/exercises/roman-numerals/README.md +1 -1
- data/tracks/common-lisp/exercises/scrabble-score/README.md +3 -1
- data/tracks/common-lisp/exercises/space-age/README.md +2 -1
- data/tracks/common-lisp/exercises/sublist/README.md +65 -0
- data/tracks/common-lisp/exercises/sublist/example.lisp +24 -0
- data/tracks/common-lisp/exercises/sublist/sublist-test.lisp +87 -0
- data/tracks/common-lisp/exercises/sublist/sublist.lisp +8 -0
- data/tracks/common-lisp/exercises/triangle/README.md +9 -6
- data/tracks/common-lisp/exercises/trinary/README.md +1 -1
- data/tracks/common-lisp/exercises/word-count/README.md +1 -2
- data/tracks/ecmascript/config.json +30 -0
- data/tracks/ecmascript/exercises/bowling/README.md +80 -0
- data/tracks/ecmascript/exercises/bowling/bowling.spec.js +159 -0
- data/tracks/ecmascript/exercises/bowling/example.js +67 -0
- data/tracks/ecmascript/exercises/bowling/package.json +71 -0
- data/tracks/ecmascript/exercises/two-fer/README.md +47 -0
- data/tracks/ecmascript/exercises/two-fer/example.js +4 -0
- data/tracks/ecmascript/exercises/two-fer/package.json +69 -0
- data/tracks/ecmascript/exercises/two-fer/two-fer.spec.js +18 -0
- data/tracks/fsharp/exercises/pascals-triangle/Example.fs +12 -8
- data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangle.fs +2 -2
- data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangleTest.fs +15 -12
- data/tracks/fsharp/generators/Generators.fs +19 -0
- data/tracks/fsharp/generators/Templates/_AssertThrows.liquid +1 -0
- data/tracks/java/docs/ABOUT.md +13 -31
- data/tracks/java/exercises/bracket-push/.meta/version +1 -1
- data/tracks/java/exercises/bracket-push/src/test/java/BracketCheckerTest.java +7 -1
- data/tracks/java/exercises/collatz-conjecture/.meta/version +1 -1
- data/tracks/java/exercises/etl/README.md +1 -1
- data/tracks/java/exercises/ocr-numbers/README.md +1 -1
- data/tracks/java/exercises/pascals-triangle/README.md +1 -1
- data/tracks/java/exercises/perfect-numbers/.meta/version +1 -1
- data/tracks/java/exercises/rna-transcription/README.md +1 -1
- data/tracks/java/exercises/secret-handshake/.meta/version +1 -1
- data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +1 -9
- data/tracks/java/scripts/canonical_data_check.sh +104 -0
- data/tracks/javascript/exercises/twelve-days/example.js +23 -25
- data/tracks/julia/.travis.yml +1 -0
- data/tracks/kotlin/exercises/all-your-base/.meta/version +1 -0
- data/tracks/kotlin/exercises/all-your-base/src/test/kotlin/BaseConverterTest.kt +0 -3
- data/tracks/kotlin/exercises/change/.meta/version +1 -0
- data/tracks/kotlin/exercises/change/src/test/kotlin/ChangeCalculatorTest.kt +0 -3
- data/tracks/kotlin/exercises/clock/.meta/version +1 -0
- data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockAddTest.kt +1 -4
- data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockCreationTest.kt +1 -4
- data/tracks/kotlin/exercises/clock/src/test/kotlin/ClockEqualTest.kt +1 -4
- data/tracks/kotlin/exercises/collatz-conjecture/.meta/version +1 -0
- data/tracks/kotlin/exercises/collatz-conjecture/src/test/kotlin/CollatzCalculatorTest.kt +0 -3
- data/tracks/kotlin/exercises/complex-numbers/.meta/version +1 -0
- data/tracks/kotlin/exercises/complex-numbers/src/test/kotlin/ComplexNumberTest.kt +0 -3
- data/tracks/kotlin/exercises/diamond/.meta/version +1 -0
- data/tracks/kotlin/exercises/diamond/src/test/kotlin/DiamondPrinterTest.kt +0 -3
- data/tracks/kotlin/exercises/etl/README.md +1 -1
- data/tracks/kotlin/exercises/forth/.meta/version +1 -0
- data/tracks/kotlin/exercises/forth/src/test/kotlin/ForthEvaluatorTest.kt +0 -3
- data/tracks/kotlin/exercises/grains/.meta/version +1 -0
- data/tracks/kotlin/exercises/grains/src/test/kotlin/BoardTest.kt +0 -3
- data/tracks/kotlin/exercises/hamming/.meta/version +1 -0
- data/tracks/kotlin/exercises/hamming/src/test/kotlin/HammingTest.kt +0 -3
- data/tracks/kotlin/exercises/list-ops/.meta/version +1 -0
- data/tracks/kotlin/exercises/list-ops/src/test/kotlin/ListExtensionsTest.kt +0 -3
- data/tracks/kotlin/exercises/meetup/.meta/version +1 -0
- data/tracks/kotlin/exercises/meetup/src/test/kotlin/MeetupTest.kt +0 -3
- data/tracks/kotlin/exercises/minesweeper/.meta/version +1 -0
- data/tracks/kotlin/exercises/minesweeper/src/test/kotlin/MinesweeperBoardTest.kt +0 -3
- data/tracks/kotlin/exercises/pangram/.meta/version +1 -0
- data/tracks/kotlin/exercises/pangram/src/test/kotlin/PangramTest.kt +0 -3
- data/tracks/kotlin/exercises/pascals-triangle/README.md +1 -1
- data/tracks/kotlin/exercises/prime-factors/.meta/version +1 -0
- data/tracks/kotlin/exercises/prime-factors/src/test/kotlin/PrimeFactorCalculatorTest.kt +0 -3
- data/tracks/kotlin/exercises/rna-transcription/.meta/version +1 -0
- data/tracks/kotlin/exercises/rna-transcription/README.md +1 -1
- data/tracks/kotlin/exercises/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt +0 -3
- data/tracks/kotlin/exercises/robot-simulator/.meta/version +1 -0
- data/tracks/kotlin/exercises/robot-simulator/src/test/kotlin/RobotTest.kt +0 -3
- data/tracks/kotlin/exercises/rotational-cipher/.meta/version +1 -0
- data/tracks/kotlin/exercises/rotational-cipher/src/test/kotlin/RotationalCipherTest.kt +0 -3
- data/tracks/kotlin/exercises/saddle-points/.meta/version +1 -0
- data/tracks/kotlin/exercises/saddle-points/src/test/kotlin/MatrixTest.kt +0 -3
- data/tracks/kotlin/exercises/say/.meta/version +1 -0
- data/tracks/kotlin/exercises/say/src/test/kotlin/NumberSpellerTest.kt +0 -3
- data/tracks/kotlin/exercises/secret-handshake/.meta/version +1 -0
- data/tracks/kotlin/exercises/secret-handshake/src/test/kotlin/HandshakeCalculatorTest.kt +0 -3
- data/tracks/kotlin/exercises/spiral-matrix/.meta/version +1 -0
- data/tracks/kotlin/exercises/spiral-matrix/src/test/kotlin/SpiralMatrixTest.kt +0 -3
- data/tracks/kotlin/exercises/sublist/.meta/version +1 -0
- data/tracks/kotlin/exercises/sublist/src/test/kotlin/SublistTest.kt +0 -3
- data/tracks/kotlin/scripts/canonical_data_check.sh +104 -0
- data/tracks/perl6/exercises/accumulate/accumulate.t +2 -3
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +17 -18
- data/tracks/perl6/exercises/allergies/allergies.t +17 -18
- data/tracks/perl6/exercises/anagram/anagram.t +17 -18
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +17 -18
- data/tracks/perl6/exercises/bob/bob.t +20 -22
- data/tracks/perl6/exercises/bob/example.yaml +1 -2
- data/tracks/perl6/exercises/clock/clock.t +17 -18
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +17 -18
- data/tracks/perl6/exercises/grade-school/grade-school.t +2 -3
- data/tracks/perl6/exercises/grains/grains.t +17 -18
- data/tracks/perl6/exercises/hello-world/example.yaml +1 -2
- data/tracks/perl6/exercises/hello-world/hello-world.t +20 -22
- data/tracks/perl6/exercises/leap/leap.t +17 -18
- data/tracks/perl6/exercises/linked-list/linked-list.t +2 -3
- data/tracks/perl6/exercises/luhn/luhn.t +17 -18
- data/tracks/perl6/exercises/phone-number/phone-number.t +17 -18
- data/tracks/perl6/exercises/raindrops/raindrops.t +17 -18
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -18
- data/tracks/perl6/exercises/robot-name/robot-name.t +2 -3
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +17 -18
- data/tracks/perl6/exercises/space-age/space-age.t +17 -18
- data/tracks/perl6/exercises/word-count/word-count.t +17 -18
- data/tracks/perl6/exercises/wordy/wordy.t +17 -18
- data/tracks/perl6/templates/test.mustache +9 -10
- data/tracks/purescript/config.json +11 -0
- data/tracks/purescript/exercises/rna-transcription/README.md +25 -0
- data/tracks/purescript/exercises/rna-transcription/bower.json +26 -0
- data/tracks/purescript/exercises/rna-transcription/examples/src/RNATranscription.purs +18 -0
- data/tracks/purescript/exercises/rna-transcription/src/RNATranscription.purs +3 -0
- data/tracks/purescript/exercises/rna-transcription/test/Main.purs +48 -0
- data/tracks/python/exercises/variable-length-quantity/example.py +6 -6
- data/tracks/python/exercises/variable-length-quantity/variable_length_quantity.py +2 -2
- data/tracks/ruby/config.json +6 -0
- data/tracks/ruby/exercises/complex-numbers/.meta/.version +1 -0
- data/tracks/ruby/exercises/complex-numbers/.meta/generator/complex_numbers_case.rb +44 -0
- data/tracks/ruby/exercises/complex-numbers/.meta/solutions/complex_numbers.rb +49 -0
- data/tracks/ruby/exercises/complex-numbers/README.md +64 -0
- data/tracks/ruby/exercises/complex-numbers/complex_numbers_test.rb +207 -0
- data/tracks/ruby/exercises/crypto-square/.meta/.version +1 -0
- data/tracks/ruby/exercises/crypto-square/.meta/generator/crypto_square_case.rb +19 -0
- data/tracks/ruby/exercises/crypto-square/.meta/solutions/crypto_square.rb +20 -15
- data/tracks/ruby/exercises/crypto-square/README.md +10 -8
- data/tracks/ruby/exercises/crypto-square/crypto_square_test.rb +45 -81
- data/tracks/ruby/exercises/flatten-array/.meta/.version +1 -0
- data/tracks/ruby/exercises/flatten-array/.meta/generator/flatten_array_case.rb +11 -0
- data/tracks/ruby/exercises/flatten-array/.meta/solutions/flatten_array.rb +5 -2
- data/tracks/ruby/exercises/flatten-array/flatten_array_test.rb +32 -7
- data/tracks/ruby/exercises/hamming/hamming_test.rb +3 -3
- data/tracks/ruby/exercises/isogram/isogram_test.rb +4 -4
- data/tracks/ruby/exercises/leap/leap_test.rb +2 -2
- data/tracks/ruby/exercises/pig-latin/.meta/.version +1 -1
- data/tracks/ruby/exercises/pig-latin/.meta/solutions/pig_latin.rb +2 -2
- data/tracks/ruby/exercises/pig-latin/pig_latin_test.rb +17 -7
- data/tracks/ruby/exercises/queen-attack/.meta/generator/queen_attack_case.rb +1 -1
- data/tracks/ruby/exercises/queen-attack/queen_attack_test.rb +7 -7
- data/tracks/ruby/exercises/sum-of-multiples/.meta/.version +1 -1
- data/tracks/ruby/exercises/sum-of-multiples/.meta/solutions/sum_of_multiples.rb +1 -1
- data/tracks/ruby/exercises/sum-of-multiples/sum_of_multiples_test.rb +7 -2
- metadata +53 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
```
|
|
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
|
-
```
|
|
44
|
+
```text
|
|
45
45
|
imtgdvsfearwermayoogoanouuiontnnlvtwttddesaohghnsseoau
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Output the encoded text in chunks. Phrases that fill perfect
|
|
49
|
-
`(r X
|
|
50
|
-
|
|
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
|
-
```
|
|
53
|
-
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn
|
|
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
|
-
```
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
12
|
+
def test_lowercase
|
|
11
13
|
skip
|
|
12
|
-
|
|
13
|
-
assert_equal
|
|
14
|
+
plaintext = 'A'
|
|
15
|
+
assert_equal "a", Crypto.new(plaintext).ciphertext
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
def
|
|
18
|
+
def test_remove_spaces
|
|
17
19
|
skip
|
|
18
|
-
|
|
19
|
-
assert_equal
|
|
20
|
+
plaintext = ' b '
|
|
21
|
+
assert_equal "b", Crypto.new(plaintext).ciphertext
|
|
20
22
|
end
|
|
21
23
|
|
|
22
|
-
def
|
|
24
|
+
def test_remove_punctuation
|
|
23
25
|
skip
|
|
24
|
-
|
|
25
|
-
assert_equal
|
|
26
|
+
plaintext = '@1,%!'
|
|
27
|
+
assert_equal "1", Crypto.new(plaintext).ciphertext
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
def
|
|
30
|
+
def test_9_character_plaintext_results_in_3_chunks_of_3_characters
|
|
29
31
|
skip
|
|
30
|
-
|
|
31
|
-
assert_equal
|
|
32
|
+
plaintext = 'This is fun!'
|
|
33
|
+
assert_equal "tsf hiu isn", Crypto.new(plaintext).ciphertext
|
|
32
34
|
end
|
|
33
35
|
|
|
34
|
-
def
|
|
36
|
+
def test_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space
|
|
35
37
|
skip
|
|
36
|
-
|
|
37
|
-
assert_equal
|
|
38
|
+
plaintext = 'Chill out.'
|
|
39
|
+
assert_equal "clu hlt io ", Crypto.new(plaintext).ciphertext
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
def
|
|
42
|
+
def test_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces
|
|
41
43
|
skip
|
|
42
|
-
|
|
43
|
-
assert_equal
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
103
|
-
assert_equal 'im a', crypto.normalize_ciphertext
|
|
67
|
+
assert_equal 1, BookKeeping::VERSION
|
|
104
68
|
end
|
|
105
69
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1
|
|
@@ -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,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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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.
|
|
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('
|
|
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('
|
|
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.
|
|
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
|
|
42
|
+
def test_isogram_with_duplicated_hyphen
|
|
43
43
|
skip
|
|
44
|
-
string = "
|
|
45
|
-
assert Isogram.isogram?(string), "Expected true, '
|
|
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.
|
|
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?(
|
|
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
|
+
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 =
|
|
32
|
+
VERSION = 2
|
|
33
33
|
end
|