trackler 2.2.1.56 → 2.2.1.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/TOPICS.txt +2 -2
- data/problem-specifications/exercises/zipper/description.md +1 -1
- data/tracks/dart/test/exercises_test.dart +9 -9
- data/tracks/delphi/exercises/circular-buffer/uCircularBufferExample.pas +3 -3
- data/tracks/delphi/exercises/circular-buffer/uCircularBufferTests.pas +160 -86
- data/tracks/delphi/exercises/phone-number/README.md +1 -1
- data/tracks/erlang/config.json +10 -0
- data/tracks/erlang/exercises/isogram/README.md +65 -0
- data/tracks/erlang/exercises/isogram/include/exercism.hrl +11 -0
- data/tracks/erlang/exercises/isogram/rebar.config +30 -0
- data/tracks/erlang/exercises/isogram/src/example.erl +16 -0
- data/tracks/erlang/exercises/isogram/src/isogram.app.src +9 -0
- data/tracks/erlang/exercises/isogram/src/isogram.erl +9 -0
- data/tracks/erlang/exercises/isogram/test/isogram_tests.erl +32 -0
- data/tracks/fsharp/exercises/binary-search/BinarySearch.fs +1 -1
- data/tracks/fsharp/exercises/binary-search/BinarySearchTest.fs +58 -30
- data/tracks/fsharp/exercises/binary-search/Example.fs +1 -1
- data/tracks/fsharp/exercises/poker/Example.fs +23 -20
- data/tracks/fsharp/exercises/poker/PokerTest.fs +135 -76
- data/tracks/fsharp/generators/Generators.fs +21 -0
- data/tracks/go/README.md +0 -15
- data/tracks/go/bin/run-generators +11 -0
- data/tracks/go/config.json +389 -277
- data/tracks/go/config/maintainers.json +2 -2
- data/tracks/go/docs/TESTS.md +0 -15
- data/tracks/go/exercises/accumulate/accumulate_test.go +0 -8
- data/tracks/go/exercises/accumulate/example.go +0 -2
- data/tracks/go/exercises/acronym/acronym.go +14 -2
- data/tracks/go/exercises/acronym/acronym_test.go +0 -8
- data/tracks/go/exercises/acronym/cases_test.go +2 -2
- data/tracks/go/exercises/acronym/example.go +0 -2
- data/tracks/go/exercises/all-your-base/all_your_base_test.go +0 -8
- data/tracks/go/exercises/all-your-base/example.go +0 -2
- data/tracks/go/exercises/allergies/allergies_test.go +0 -8
- data/tracks/go/exercises/allergies/example.go +0 -2
- data/tracks/go/exercises/anagram/.meta/gen.go +55 -0
- data/tracks/go/exercises/anagram/anagram_test.go +0 -130
- data/tracks/go/exercises/anagram/cases_test.go +164 -0
- data/tracks/go/exercises/anagram/example.go +0 -2
- data/tracks/go/exercises/atbash-cipher/atbash_cipher_test.go +0 -8
- data/tracks/go/exercises/atbash-cipher/cases_test.go +2 -2
- data/tracks/go/exercises/atbash-cipher/example.go +0 -2
- data/tracks/go/exercises/bank-account/bank_account_test.go +0 -8
- data/tracks/go/exercises/bank-account/example.go +0 -2
- data/tracks/go/exercises/beer-song/beer_test.go +0 -8
- data/tracks/go/exercises/beer-song/example.go +0 -2
- data/tracks/go/exercises/binary-search-tree/binary_search_tree_test.go +0 -8
- data/tracks/go/exercises/binary-search-tree/example.go +0 -2
- data/tracks/go/exercises/binary-search/binary_search_test.go +0 -8
- data/tracks/go/exercises/binary-search/example.go +0 -2
- data/tracks/go/exercises/binary/binary_test.go +0 -11
- data/tracks/go/exercises/binary/example.go +0 -2
- data/tracks/go/exercises/bob/bob.go +14 -0
- data/tracks/go/exercises/bob/bob_test.go +2 -10
- data/tracks/go/exercises/bob/cases_test.go +2 -2
- data/tracks/go/exercises/bob/example.go +12 -13
- data/tracks/go/exercises/book-store/README.md +92 -0
- data/tracks/go/exercises/book-store/book_store_test.go +91 -0
- data/tracks/go/exercises/book-store/example.go +52 -0
- data/tracks/go/exercises/bowling/bowling_test.go +0 -8
- data/tracks/go/exercises/bowling/cases_test.go +2 -2
- data/tracks/go/exercises/bowling/example.go +0 -2
- data/tracks/go/exercises/bracket-push/bracket_push_test.go +0 -8
- data/tracks/go/exercises/bracket-push/cases_test.go +2 -2
- data/tracks/go/exercises/bracket-push/example.go +0 -3
- data/tracks/go/exercises/change/cases_test.go +10 -3
- data/tracks/go/exercises/change/change_test.go +1 -9
- data/tracks/go/exercises/change/example.go +0 -2
- data/tracks/go/exercises/circular-buffer/circular_buffer_test.go +0 -8
- data/tracks/go/exercises/circular-buffer/example.go +0 -2
- data/tracks/go/exercises/clock/cases_test.go +2 -2
- data/tracks/go/exercises/clock/clock_test.go +2 -9
- data/tracks/go/exercises/clock/example.go +0 -2
- data/tracks/go/exercises/collatz-conjecture/README.md +51 -0
- data/tracks/go/exercises/collatz-conjecture/collatz_conjecture_test.go +77 -0
- data/tracks/go/exercises/collatz-conjecture/example.go +24 -0
- data/tracks/go/exercises/connect/cases_test.go +2 -2
- data/tracks/go/exercises/connect/connect_test.go +0 -8
- data/tracks/go/exercises/connect/example.go +0 -2
- data/tracks/go/exercises/crypto-square/crypto_square_test.go +0 -8
- data/tracks/go/exercises/crypto-square/example.go +0 -2
- data/tracks/go/exercises/custom-set/cases_test.go +2 -2
- data/tracks/go/exercises/custom-set/custom_set_test.go +0 -8
- data/tracks/go/exercises/custom-set/example.go +0 -2
- data/tracks/go/exercises/custom-set/example_slice.go +0 -2
- data/tracks/go/exercises/diamond/diamond_test.go +0 -8
- data/tracks/go/exercises/diamond/example.go +0 -2
- data/tracks/go/exercises/difference-of-squares/difference_of_squares_test.go +0 -8
- data/tracks/go/exercises/difference-of-squares/example.go +0 -2
- data/tracks/go/exercises/diffie-hellman/diffie_hellman_test.go +0 -8
- data/tracks/go/exercises/diffie-hellman/example.go +0 -2
- data/tracks/go/exercises/error-handling/error_handling_test.go +0 -7
- data/tracks/go/exercises/error-handling/example.go +0 -2
- data/tracks/go/exercises/etl/etl_test.go +0 -8
- data/tracks/go/exercises/etl/example.go +0 -2
- data/tracks/go/exercises/flatten-array/.meta/gen.go +52 -0
- data/tracks/go/exercises/flatten-array/README.md +35 -0
- data/tracks/go/exercises/flatten-array/cases_test.go +42 -0
- data/tracks/go/exercises/flatten-array/example.go +25 -0
- data/tracks/go/exercises/flatten-array/flatten_test.go +23 -0
- data/tracks/go/exercises/food-chain/example.go +0 -2
- data/tracks/go/exercises/food-chain/food_chain_test.go +0 -8
- data/tracks/go/exercises/forth/cases_test.go +2 -2
- data/tracks/go/exercises/forth/example.go +0 -2
- data/tracks/go/exercises/forth/forth_test.go +0 -8
- data/tracks/go/exercises/gigasecond/cases_test.go +2 -2
- data/tracks/go/exercises/gigasecond/example.go +0 -2
- data/tracks/go/exercises/gigasecond/gigasecond.go +13 -3
- data/tracks/go/exercises/gigasecond/gigasecond_test.go +0 -8
- data/tracks/go/exercises/grade-school/example.go +0 -2
- data/tracks/go/exercises/grade-school/grade_school_test.go +0 -8
- data/tracks/go/exercises/grains/example.go +0 -2
- data/tracks/go/exercises/grains/grains_test.go +0 -8
- data/tracks/go/exercises/hamming/.meta/hints.md +4 -0
- data/tracks/go/exercises/hamming/README.md +6 -0
- data/tracks/go/exercises/hamming/example.go +0 -2
- data/tracks/go/exercises/hamming/hamming.go +0 -2
- data/tracks/go/exercises/hamming/hamming_test.go +0 -8
- data/tracks/go/exercises/hello-world/hello_world.go +9 -1
- data/tracks/go/exercises/hexadecimal/example.go +0 -2
- data/tracks/go/exercises/hexadecimal/hexadecimal_test.go +0 -8
- data/tracks/go/exercises/house/example.go +0 -2
- data/tracks/go/exercises/house/house_test.go +0 -8
- data/tracks/go/exercises/isbn-verifier/README.md +60 -0
- data/tracks/go/exercises/isbn-verifier/example.go +57 -0
- data/tracks/go/exercises/isbn-verifier/isbn_verifier_test.go +35 -0
- data/tracks/go/exercises/isogram/example.go +0 -2
- data/tracks/go/exercises/isogram/isogram_test.go +0 -8
- data/tracks/go/exercises/kindergarten-garden/example.go +0 -2
- data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +0 -8
- data/tracks/go/exercises/largest-series-product/cases_test.go +2 -2
- data/tracks/go/exercises/largest-series-product/example.go +0 -2
- data/tracks/go/exercises/largest-series-product/largest_series_product_test.go +0 -8
- data/tracks/go/exercises/leap/.meta/hints.md +14 -0
- data/tracks/go/exercises/leap/README.md +16 -0
- data/tracks/go/exercises/leap/cases_test.go +4 -4
- data/tracks/go/exercises/leap/example.go +0 -2
- data/tracks/go/exercises/leap/leap.go +11 -2
- data/tracks/go/exercises/leap/leap_test.go +0 -15
- data/tracks/go/exercises/ledger/example.go +0 -2
- data/tracks/go/exercises/ledger/ledger.go +0 -2
- data/tracks/go/exercises/ledger/ledger_test.go +0 -8
- data/tracks/go/exercises/luhn/cases_test.go +2 -2
- data/tracks/go/exercises/luhn/example.go +0 -2
- data/tracks/go/exercises/luhn/luhn_test.go +0 -8
- data/tracks/go/exercises/matrix/example.go +0 -2
- data/tracks/go/exercises/matrix/matrix_test.go +0 -8
- data/tracks/go/exercises/meetup/cases_test.go +2 -2
- data/tracks/go/exercises/meetup/example.go +0 -2
- data/tracks/go/exercises/meetup/meetup_test.go +0 -8
- data/tracks/go/exercises/minesweeper/example.go +0 -2
- data/tracks/go/exercises/minesweeper/minesweeper_test.go +0 -8
- data/tracks/go/exercises/nth-prime/example.go +0 -2
- data/tracks/go/exercises/nth-prime/nth_prime_test.go +0 -8
- data/tracks/go/exercises/nucleotide-count/example.go +0 -2
- data/tracks/go/exercises/nucleotide-count/nucleotide_count.go +26 -0
- data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +0 -8
- data/tracks/go/exercises/ocr-numbers/example.go +0 -2
- data/tracks/go/exercises/ocr-numbers/ocr_numbers_test.go +0 -8
- data/tracks/go/exercises/octal/example.go +0 -2
- data/tracks/go/exercises/octal/octal_test.go +0 -8
- data/tracks/go/exercises/paasio/example.go +0 -2
- data/tracks/go/exercises/paasio/paasio_test.go +0 -8
- data/tracks/go/exercises/palindrome-products/example.go +0 -2
- data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +0 -8
- data/tracks/go/exercises/pangram/example.go +0 -2
- data/tracks/go/exercises/pangram/pangram_test.go +2 -8
- data/tracks/go/exercises/parallel-letter-frequency/example.go +0 -2
- data/tracks/go/exercises/parallel-letter-frequency/parallel_letter_frequency_test.go +0 -8
- data/tracks/go/exercises/pascals-triangle/example.go +0 -2
- data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +0 -8
- data/tracks/go/exercises/perfect-numbers/example.go +0 -2
- data/tracks/go/exercises/perfect-numbers/perfect_numbers_test.go +0 -8
- data/tracks/go/exercises/phone-number/cases_test.go +2 -2
- data/tracks/go/exercises/phone-number/example.go +0 -2
- data/tracks/go/exercises/phone-number/phone_number_test.go +0 -8
- data/tracks/go/exercises/pig-latin/example.go +0 -2
- data/tracks/go/exercises/pig-latin/pig_latin_test.go +0 -8
- data/tracks/go/exercises/poker/.meta/hints.md +7 -0
- data/tracks/go/exercises/poker/README.md +9 -0
- data/tracks/go/exercises/poker/cases_test.go +2 -2
- data/tracks/go/exercises/poker/example.go +0 -2
- data/tracks/go/exercises/poker/poker_test.go +0 -11
- data/tracks/go/exercises/pov/example.go +0 -2
- data/tracks/go/exercises/pov/pov_test.go +1 -9
- data/tracks/go/exercises/prime-factors/example.go +0 -2
- data/tracks/go/exercises/prime-factors/prime_factors_test.go +1 -9
- data/tracks/go/exercises/protein-translation/example.go +0 -2
- data/tracks/go/exercises/protein-translation/protein_translation_test.go +0 -8
- data/tracks/go/exercises/pythagorean-triplet/example.go +0 -2
- data/tracks/go/exercises/pythagorean-triplet/pythagorean_triplet_test.go +0 -8
- data/tracks/go/exercises/queen-attack/example.go +0 -2
- data/tracks/go/exercises/queen-attack/queen_attack_test.go +0 -8
- data/tracks/go/exercises/raindrops/.meta/hints.md +7 -0
- data/tracks/go/exercises/raindrops/cases_test.go +2 -2
- data/tracks/go/exercises/raindrops/example.go +0 -2
- data/tracks/go/exercises/raindrops/raindrops_test.go +0 -8
- data/tracks/go/exercises/react/example.go +0 -2
- data/tracks/go/exercises/react/react_test.go +0 -11
- data/tracks/go/exercises/rna-transcription/cases_test.go +2 -2
- data/tracks/go/exercises/rna-transcription/example.go +0 -2
- data/tracks/go/exercises/rna-transcription/rna_transcription.go +6 -0
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +0 -8
- data/tracks/go/exercises/robot-name/example.go +0 -2
- data/tracks/go/exercises/robot-name/robot_name_test.go +0 -8
- data/tracks/go/exercises/robot-simulator/example.go +0 -1
- data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +0 -8
- data/tracks/go/exercises/roman-numerals/cases_test.go +2 -2
- data/tracks/go/exercises/roman-numerals/example.go +0 -2
- data/tracks/go/exercises/roman-numerals/roman_numerals_test.go +0 -8
- data/tracks/go/exercises/rotational-cipher/README.md +56 -0
- data/tracks/go/exercises/rotational-cipher/example.go +20 -0
- data/tracks/go/exercises/rotational-cipher/rotational_cipher_test.go +86 -0
- data/tracks/go/exercises/run-length-encoding/README.md +31 -0
- data/tracks/go/exercises/run-length-encoding/example.go +53 -0
- data/tracks/go/exercises/run-length-encoding/run_length_encoding_test.go +59 -0
- data/tracks/go/exercises/saddle-points/example.go +0 -2
- data/tracks/go/exercises/saddle-points/saddle_points_test.go +0 -8
- data/tracks/go/exercises/say/.meta/gen.go +70 -0
- data/tracks/go/exercises/say/cases_test.go +88 -0
- data/tracks/go/exercises/say/example.go +12 -6
- data/tracks/go/exercises/say/say_test.go +17 -43
- data/tracks/go/exercises/scrabble-score/cases_test.go +2 -2
- data/tracks/go/exercises/scrabble-score/example.go +0 -3
- data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +0 -8
- data/tracks/go/exercises/secret-handshake/cases_test.go +2 -2
- data/tracks/go/exercises/secret-handshake/example.go +0 -2
- data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +0 -8
- data/tracks/go/exercises/series/example.go +0 -2
- data/tracks/go/exercises/series/series_test.go +0 -8
- data/tracks/go/exercises/sieve/example.go +0 -2
- data/tracks/go/exercises/sieve/sieve_test.go +0 -8
- data/tracks/go/exercises/simple-cipher/example.go +0 -2
- data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +0 -8
- data/tracks/go/exercises/space-age/.meta/gen.go +56 -0
- data/tracks/go/exercises/space-age/README.md +42 -0
- data/tracks/go/exercises/space-age/cases_test.go +61 -0
- data/tracks/go/exercises/space-age/example.go +36 -0
- data/tracks/go/exercises/space-age/space_age_test.go +22 -0
- data/tracks/go/exercises/spiral-matrix/README.md +48 -0
- data/tracks/go/exercises/spiral-matrix/example.go +93 -0
- data/tracks/go/exercises/spiral-matrix/spiral_matrix_test.go +71 -0
- data/tracks/go/exercises/strain/example.go +0 -2
- data/tracks/go/exercises/strain/strain_test.go +0 -8
- data/tracks/go/exercises/sublist/.meta/gen.go +56 -0
- data/tracks/go/exercises/sublist/README.md +39 -0
- data/tracks/go/exercises/sublist/cases_test.go +115 -0
- data/tracks/go/exercises/sublist/example.go +49 -0
- data/tracks/go/exercises/sublist/sublist_test.go +22 -0
- data/tracks/go/exercises/sum-of-multiples/cases_test.go +4 -3
- data/tracks/go/exercises/sum-of-multiples/example.go +0 -2
- data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +0 -8
- data/tracks/go/exercises/tournament/example.go +0 -2
- data/tracks/go/exercises/tournament/tournament_test.go +0 -11
- data/tracks/go/exercises/transpose/cases_test.go +2 -2
- data/tracks/go/exercises/transpose/example.go +0 -2
- data/tracks/go/exercises/transpose/transpose_test.go +0 -8
- data/tracks/go/exercises/tree-building/example.go +0 -2
- data/tracks/go/exercises/tree-building/tree_building.go +0 -2
- data/tracks/go/exercises/tree-building/tree_test.go +0 -11
- data/tracks/go/exercises/triangle/.meta/hints.md +10 -0
- data/tracks/go/exercises/triangle/example.go +0 -2
- data/tracks/go/exercises/triangle/triangle.go +21 -9
- data/tracks/go/exercises/triangle/triangle_test.go +0 -8
- data/tracks/go/exercises/trinary/example.go +0 -2
- data/tracks/go/exercises/trinary/trinary_test.go +0 -8
- data/tracks/go/exercises/twelve-days/example.go +0 -2
- data/tracks/go/exercises/twelve-days/twelve_days_test.go +0 -8
- data/tracks/go/exercises/two-fer/two_fer.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/cases_test.go +2 -2
- data/tracks/go/exercises/variable-length-quantity/example.go +0 -2
- data/tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go +0 -8
- data/tracks/go/exercises/word-count/cases_test.go +2 -2
- data/tracks/go/exercises/word-count/example.go +0 -2
- data/tracks/go/exercises/word-count/word_count_test.go +4 -7
- data/tracks/go/exercises/word-search/.meta/gen.go +96 -0
- data/tracks/go/exercises/word-search/cases_test.go +154 -0
- data/tracks/go/exercises/word-search/example.go +0 -2
- data/tracks/go/exercises/word-search/word_search_test.go +16 -52
- data/tracks/go/exercises/wordy/example.go +0 -2
- data/tracks/go/exercises/wordy/wordy_test.go +0 -8
- data/tracks/go/gen/gen.go +4 -1
- data/tracks/java/exercises/phone-number/README.md +1 -1
- data/tracks/kotlin/exercises/phone-number/README.md +1 -1
- data/tracks/perl6/config.json +50 -0
- data/tracks/perl6/exercises/etl/ETL.pm6 +6 -0
- data/tracks/perl6/exercises/etl/Example.pm6 +7 -0
- data/tracks/perl6/exercises/etl/README.md +72 -0
- data/tracks/perl6/exercises/etl/etl.t +139 -0
- data/tracks/perl6/exercises/etl/example.yaml +35 -0
- data/tracks/perl6/exercises/hamming/Example.pm6 +6 -0
- data/tracks/perl6/exercises/hamming/Hamming.pm6 +4 -0
- data/tracks/perl6/exercises/hamming/README.md +61 -0
- data/tracks/perl6/exercises/hamming/example.yaml +22 -0
- data/tracks/perl6/exercises/hamming/hamming.t +175 -0
- data/tracks/perl6/exercises/meetup/Example.pm6 +37 -0
- data/tracks/perl6/exercises/meetup/Meetup.pm6 +4 -0
- data/tracks/perl6/exercises/meetup/README.md +48 -0
- data/tracks/perl6/exercises/meetup/example.yaml +48 -0
- data/tracks/perl6/exercises/meetup/meetup.t +907 -0
- data/tracks/perl6/exercises/pangram/Example.pm6 +5 -0
- data/tracks/perl6/exercises/pangram/Pangram.pm6 +4 -0
- data/tracks/perl6/exercises/pangram/README.md +34 -0
- data/tracks/perl6/exercises/pangram/example.yaml +17 -0
- data/tracks/perl6/exercises/pangram/pangram.t +125 -0
- data/tracks/perl6/exercises/phone-number/README.md +1 -1
- data/tracks/perl6/exercises/two-fer/Example.pm6 +14 -0
- data/tracks/perl6/exercises/two-fer/README.md +38 -0
- data/tracks/perl6/exercises/two-fer/TwoFer.pm6 +15 -0
- data/tracks/perl6/exercises/two-fer/example.yaml +43 -0
- data/tracks/perl6/exercises/two-fer/two-fer.t +82 -0
- data/tracks/php/config.json +13 -0
- data/tracks/php/exercises/rail-fence-cipher/README.md +80 -0
- data/tracks/php/exercises/rail-fence-cipher/example.php +61 -0
- data/tracks/php/exercises/rail-fence-cipher/rail-fence-cipher_test.php +76 -0
- data/tracks/purescript/.travis.yml +1 -1
- data/tracks/python/config.json +13 -0
- data/tracks/python/exercises/alphametics/example.py +42 -29
- data/tracks/python/exercises/crypto-square/crypto_square_test.py +20 -13
- data/tracks/python/exercises/crypto-square/example.py +1 -1
- data/tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py +15 -2
- data/tracks/python/exercises/phone-number/README.md +2 -1
- data/tracks/python/exercises/pov/README.md +53 -0
- data/tracks/python/exercises/pov/example.py +70 -0
- data/tracks/python/exercises/pov/pov.py +25 -0
- data/tracks/python/exercises/pov/pov_test.py +200 -0
- data/tracks/python/test/check-exercises.py +11 -1
- data/tracks/ruby/exercises/meetup/.meta/.version +1 -0
- data/tracks/ruby/exercises/meetup/.meta/generator/meetup_case.rb +11 -0
- data/tracks/ruby/exercises/meetup/.meta/solutions/meetup.rb +5 -0
- data/tracks/ruby/exercises/meetup/meetup_test.rb +48 -4
- metadata +90 -8
- data/tracks/go/exercises/accumulate/accumulate.go +0 -5
- data/tracks/go/exercises/clock/clock.go +0 -19
- data/tracks/go/exercises/pangram/pangram.go +0 -5
- data/tracks/go/exercises/raindrops/raindrops.go +0 -8
- data/tracks/go/exercises/twelve-days/HINTS.md +0 -2
- data/tracks/go/exercises/word-count/word_count.go +0 -9
@@ -0,0 +1,20 @@
|
|
1
|
+
package rotationalcipher
|
2
|
+
|
3
|
+
import (
|
4
|
+
"unicode"
|
5
|
+
)
|
6
|
+
|
7
|
+
// RotationalCipher is an implementation for the rotational cipher exercise.
|
8
|
+
func RotationalCipher(plain string, shiftKey int) string {
|
9
|
+
var cipher []rune
|
10
|
+
for _, ru := range plain {
|
11
|
+
if unicode.IsUpper(ru) {
|
12
|
+
ru = rune('A' + (int(ru-'A')+shiftKey)%26)
|
13
|
+
} else if unicode.IsLower(ru) {
|
14
|
+
ru = rune('a' + (int(ru-'a')+shiftKey)%26)
|
15
|
+
}
|
16
|
+
cipher = append(cipher, ru)
|
17
|
+
}
|
18
|
+
|
19
|
+
return string(cipher)
|
20
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
package rotationalcipher
|
2
|
+
|
3
|
+
import (
|
4
|
+
"testing"
|
5
|
+
)
|
6
|
+
|
7
|
+
var testCases = []struct {
|
8
|
+
description string
|
9
|
+
inputPlain string
|
10
|
+
inputShiftKey int
|
11
|
+
expected string
|
12
|
+
}{
|
13
|
+
{
|
14
|
+
description: "rotate a by 0, same output as input",
|
15
|
+
inputPlain: "a",
|
16
|
+
inputShiftKey: 0,
|
17
|
+
expected: "a",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
description: "rotate a by 1",
|
21
|
+
inputPlain: "a",
|
22
|
+
inputShiftKey: 1,
|
23
|
+
expected: "b",
|
24
|
+
},
|
25
|
+
{
|
26
|
+
description: "rotate a by 26, same output as input",
|
27
|
+
inputPlain: "a",
|
28
|
+
inputShiftKey: 26,
|
29
|
+
expected: "a",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
description: "rotate n by 13 with wrap around alphabet",
|
33
|
+
inputPlain: "n",
|
34
|
+
inputShiftKey: 13,
|
35
|
+
expected: "a",
|
36
|
+
},
|
37
|
+
{
|
38
|
+
description: "rotate capital letters",
|
39
|
+
inputPlain: "OMG",
|
40
|
+
inputShiftKey: 5,
|
41
|
+
expected: "TRL",
|
42
|
+
},
|
43
|
+
{
|
44
|
+
description: "rotate spaces",
|
45
|
+
inputPlain: "O M G",
|
46
|
+
inputShiftKey: 5,
|
47
|
+
expected: "T R L",
|
48
|
+
},
|
49
|
+
{
|
50
|
+
description: "rotate numbers",
|
51
|
+
inputPlain: "Testing 1 2 3 testing",
|
52
|
+
inputShiftKey: 4,
|
53
|
+
expected: "Xiwxmrk 1 2 3 xiwxmrk",
|
54
|
+
},
|
55
|
+
{
|
56
|
+
description: "rotate punctuation",
|
57
|
+
inputPlain: "Let's eat, Grandma!",
|
58
|
+
inputShiftKey: 21,
|
59
|
+
expected: "Gzo'n zvo, Bmviyhv!",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
description: "rotate all letters",
|
63
|
+
inputPlain: "The quick brown fox jumps over the lazy dog.",
|
64
|
+
inputShiftKey: 13,
|
65
|
+
expected: "Gur dhvpx oebja sbk whzcf bire gur ynml qbt.",
|
66
|
+
},
|
67
|
+
}
|
68
|
+
|
69
|
+
func TestRotationalCipher(t *testing.T) {
|
70
|
+
for _, testCase := range testCases {
|
71
|
+
cipher := RotationalCipher(testCase.inputPlain, testCase.inputShiftKey)
|
72
|
+
if cipher != testCase.expected {
|
73
|
+
t.Fatalf("FAIL: %s\n\tRotationalCipher(%s, %d)\nexpected: %s, \ngot: %s",
|
74
|
+
testCase.description, testCase.inputPlain, testCase.inputShiftKey, testCase.expected, cipher)
|
75
|
+
}
|
76
|
+
t.Logf("PASS: %s", testCase.description)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
func BenchmarkRotationalCipher(b *testing.B) {
|
81
|
+
for i := 0; i < b.N; i++ {
|
82
|
+
for _, testCase := range testCases {
|
83
|
+
RotationalCipher(testCase.inputPlain, testCase.inputShiftKey)
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Run-length Encoding
|
2
|
+
|
3
|
+
Implement run-length encoding and decoding.
|
4
|
+
|
5
|
+
Run-length encoding (RLE) is a simple form of data compression, where runs (consecutive data elements) are replaced by just one data value and count.
|
6
|
+
|
7
|
+
For example we can represent the original 53 characters with only 13.
|
8
|
+
|
9
|
+
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB" -> "12WB12W3B24WB"
|
10
|
+
|
11
|
+
RLE allows the original data to be perfectly reconstructed from the compressed data, which makes it a lossless data compression.
|
12
|
+
|
13
|
+
"AABCCCDEEEE" -> "2AB3CD4E" -> "AABCCCDEEEE"
|
14
|
+
|
15
|
+
For simplicity, you can assume that the unencoded string will only contain the letters A through Z (either lower or upper case) and whitespace. This way data to be encoded will never contain any numbers and numbers inside data to be decoded always represent the count for the following character.
|
16
|
+
|
17
|
+
## Running the tests
|
18
|
+
|
19
|
+
To run the tests run the command `go test` from within the exercise directory.
|
20
|
+
|
21
|
+
## Further information
|
22
|
+
|
23
|
+
For more detailed information about the Go track, including how to get help if
|
24
|
+
you're having trouble, please visit the exercism.io [Go language page](http://exercism.io/languages/go/about).
|
25
|
+
|
26
|
+
## Source
|
27
|
+
|
28
|
+
Wikipedia [https://en.wikipedia.org/wiki/Run-length_encoding](https://en.wikipedia.org/wiki/Run-length_encoding)
|
29
|
+
|
30
|
+
## Submitting Incomplete Solutions
|
31
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,53 @@
|
|
1
|
+
package encode
|
2
|
+
|
3
|
+
import (
|
4
|
+
"fmt"
|
5
|
+
"strconv"
|
6
|
+
)
|
7
|
+
|
8
|
+
func RunLengthEncode(s string) string {
|
9
|
+
count := 1
|
10
|
+
var output string
|
11
|
+
for i, c := range s {
|
12
|
+
if i != 0 {
|
13
|
+
if rune(s[i-1]) == c {
|
14
|
+
count++
|
15
|
+
} else {
|
16
|
+
count, output = encode(count, i, s, output)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
if len(s) != 0 {
|
21
|
+
count, output = encode(count, len(s), s, output)
|
22
|
+
}
|
23
|
+
return output
|
24
|
+
}
|
25
|
+
|
26
|
+
func RunLengthDecode(s string) string {
|
27
|
+
count := 1
|
28
|
+
var stringCount, output string
|
29
|
+
for _, c := range s {
|
30
|
+
if _, err := strconv.Atoi(string(c)); err == nil {
|
31
|
+
stringCount += string(c)
|
32
|
+
} else {
|
33
|
+
if stringCount != "" {
|
34
|
+
count, _ = strconv.Atoi(stringCount)
|
35
|
+
}
|
36
|
+
for j := 0; j < count; j++ {
|
37
|
+
output += string(c)
|
38
|
+
}
|
39
|
+
count = 1
|
40
|
+
stringCount = ""
|
41
|
+
}
|
42
|
+
}
|
43
|
+
return output
|
44
|
+
}
|
45
|
+
|
46
|
+
func encode(count, i int, s, output string) (int, string) {
|
47
|
+
if count > 1 {
|
48
|
+
output += fmt.Sprintf("%d%c", count, s[i-1])
|
49
|
+
return 1, output
|
50
|
+
}
|
51
|
+
output += fmt.Sprintf("%c", s[i-1])
|
52
|
+
return 1, output
|
53
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
package encode
|
2
|
+
|
3
|
+
import "testing"
|
4
|
+
|
5
|
+
var encodeTests = []struct {
|
6
|
+
input string
|
7
|
+
expected string
|
8
|
+
}{
|
9
|
+
{"", ""},
|
10
|
+
{"XYZ", "XYZ"},
|
11
|
+
{"AABBBCCCC", "2A3B4C"},
|
12
|
+
{"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB", "12WB12W3B24WB"},
|
13
|
+
{" hsqq qww ", "2 hs2q q2w2 "},
|
14
|
+
{"aabbbcccc", "2a3b4c"},
|
15
|
+
}
|
16
|
+
|
17
|
+
var decodeTests = []struct {
|
18
|
+
input string
|
19
|
+
expected string
|
20
|
+
}{
|
21
|
+
{"", ""},
|
22
|
+
{"XYZ", "XYZ"},
|
23
|
+
{"2A3B4C", "AABBBCCCC"},
|
24
|
+
{"12WB12W3B24WB", "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"},
|
25
|
+
{"2 hs2q q2w2 ", " hsqq qww "},
|
26
|
+
{"2a3b4c", "aabbbcccc"},
|
27
|
+
}
|
28
|
+
|
29
|
+
var encodeDecodeTests = []struct {
|
30
|
+
input string
|
31
|
+
expected string
|
32
|
+
}{
|
33
|
+
{"zzz ZZ zZ", "zzz ZZ zZ"},
|
34
|
+
}
|
35
|
+
|
36
|
+
func TestRunLengthEncode(t *testing.T) {
|
37
|
+
for _, test := range encodeTests {
|
38
|
+
if actual := RunLengthEncode(test.input); actual != test.expected {
|
39
|
+
t.Errorf("RunLengthEncode(%s) = %q, expected %q.",
|
40
|
+
test.input, actual, test.expected)
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
func TestRunLengthDecode(t *testing.T) {
|
45
|
+
for _, test := range decodeTests {
|
46
|
+
if actual := RunLengthDecode(test.input); actual != test.expected {
|
47
|
+
t.Errorf("RunLengthDecode(%s) = %q, expected %q.",
|
48
|
+
test.input, actual, test.expected)
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
func TestRunLengthEncodeDecode(t *testing.T) {
|
53
|
+
for _, test := range encodeDecodeTests {
|
54
|
+
if actual := RunLengthDecode(RunLengthEncode(test.input)); actual != test.expected {
|
55
|
+
t.Errorf("RunLengthDecode(RunLengthEncode(%s)) = %q, expected %q.",
|
56
|
+
test.input, actual, test.expected)
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
@@ -8,8 +8,6 @@ package matrix
|
|
8
8
|
|
9
9
|
import "testing"
|
10
10
|
|
11
|
-
const targetTestVersion = 1
|
12
|
-
|
13
11
|
var tests = []struct {
|
14
12
|
m string
|
15
13
|
sp []Pair
|
@@ -20,12 +18,6 @@ var tests = []struct {
|
|
20
18
|
{"4 5 4\n3 5 5\n1 5 4", []Pair{{0, 1}, {1, 1}, {2, 1}}},
|
21
19
|
}
|
22
20
|
|
23
|
-
func TestTestVersion(t *testing.T) {
|
24
|
-
if testVersion != targetTestVersion {
|
25
|
-
t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
21
|
func TestSaddle(t *testing.T) {
|
30
22
|
for _, test := range tests {
|
31
23
|
m, err := New(test.m)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"fmt"
|
5
|
+
"log"
|
6
|
+
"text/template"
|
7
|
+
|
8
|
+
"../../../gen"
|
9
|
+
)
|
10
|
+
|
11
|
+
func main() {
|
12
|
+
t, err := template.New("").Parse(tmpl)
|
13
|
+
if err != nil {
|
14
|
+
log.Fatal(err)
|
15
|
+
}
|
16
|
+
var j js
|
17
|
+
if err := gen.Gen("say", &j, t); err != nil {
|
18
|
+
log.Fatal(err)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
// The JSON structure we expect to be able to unmarshal into
|
23
|
+
type js struct {
|
24
|
+
Exercise string
|
25
|
+
Version string
|
26
|
+
Comments []string
|
27
|
+
Cases []OneCase
|
28
|
+
}
|
29
|
+
|
30
|
+
// Test cases
|
31
|
+
type OneCase struct {
|
32
|
+
Description string
|
33
|
+
Property string
|
34
|
+
Input int64
|
35
|
+
Expected interface{}
|
36
|
+
}
|
37
|
+
|
38
|
+
func (c OneCase) ErrorExpected() bool {
|
39
|
+
switch value := c.Expected.(type) {
|
40
|
+
case float64: // you'd think int but no, JSON uses float for numbers
|
41
|
+
if value == -1 {
|
42
|
+
return true
|
43
|
+
}
|
44
|
+
case string:
|
45
|
+
return false
|
46
|
+
}
|
47
|
+
|
48
|
+
panic(fmt.Sprintf("Unexpected error value: %T => %v", c.Expected, c.Expected))
|
49
|
+
}
|
50
|
+
|
51
|
+
// Template to generate test cases.
|
52
|
+
var tmpl = `package say
|
53
|
+
|
54
|
+
{{.Header}}
|
55
|
+
|
56
|
+
var testCases = []struct {
|
57
|
+
description string
|
58
|
+
input int64
|
59
|
+
expected string
|
60
|
+
expectError bool
|
61
|
+
}{ {{range .J.Cases}}
|
62
|
+
{
|
63
|
+
description: {{printf "%q" .Description}},
|
64
|
+
input: {{printf "%v" .Input}},
|
65
|
+
{{if .ErrorExpected}}expectError: true,
|
66
|
+
{{else}}expected: {{printf "%q" .Expected}},
|
67
|
+
{{- end}}
|
68
|
+
},{{end}}
|
69
|
+
}
|
70
|
+
`
|
@@ -0,0 +1,88 @@
|
|
1
|
+
package say
|
2
|
+
|
3
|
+
// Source: exercism/problem-specifications
|
4
|
+
// Commit: be403e1 say: Fix canonical-data.json formatting
|
5
|
+
// Problem Specifications Version: 1.0.0
|
6
|
+
|
7
|
+
var testCases = []struct {
|
8
|
+
description string
|
9
|
+
input int64
|
10
|
+
expected string
|
11
|
+
expectError bool
|
12
|
+
}{
|
13
|
+
{
|
14
|
+
description: "zero",
|
15
|
+
input: 0,
|
16
|
+
expected: "zero",
|
17
|
+
},
|
18
|
+
{
|
19
|
+
description: "one",
|
20
|
+
input: 1,
|
21
|
+
expected: "one",
|
22
|
+
},
|
23
|
+
{
|
24
|
+
description: "fourteen",
|
25
|
+
input: 14,
|
26
|
+
expected: "fourteen",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
description: "twenty",
|
30
|
+
input: 20,
|
31
|
+
expected: "twenty",
|
32
|
+
},
|
33
|
+
{
|
34
|
+
description: "twenty-two",
|
35
|
+
input: 22,
|
36
|
+
expected: "twenty-two",
|
37
|
+
},
|
38
|
+
{
|
39
|
+
description: "one hundred",
|
40
|
+
input: 100,
|
41
|
+
expected: "one hundred",
|
42
|
+
},
|
43
|
+
{
|
44
|
+
description: "one hundred twenty-three",
|
45
|
+
input: 123,
|
46
|
+
expected: "one hundred twenty-three",
|
47
|
+
},
|
48
|
+
{
|
49
|
+
description: "one thousand",
|
50
|
+
input: 1000,
|
51
|
+
expected: "one thousand",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
description: "one thousand two hundred thirty-four",
|
55
|
+
input: 1234,
|
56
|
+
expected: "one thousand two hundred thirty-four",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
description: "one million",
|
60
|
+
input: 1000000,
|
61
|
+
expected: "one million",
|
62
|
+
},
|
63
|
+
{
|
64
|
+
description: "one million two thousand three hundred forty-five",
|
65
|
+
input: 1002345,
|
66
|
+
expected: "one million two thousand three hundred forty-five",
|
67
|
+
},
|
68
|
+
{
|
69
|
+
description: "one billion",
|
70
|
+
input: 1000000000,
|
71
|
+
expected: "one billion",
|
72
|
+
},
|
73
|
+
{
|
74
|
+
description: "a big number",
|
75
|
+
input: 987654321123,
|
76
|
+
expected: "nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three",
|
77
|
+
},
|
78
|
+
{
|
79
|
+
description: "numbers below zero are out of range",
|
80
|
+
input: -1,
|
81
|
+
expectError: true,
|
82
|
+
},
|
83
|
+
{
|
84
|
+
description: "numbers above 999,999,999,999 are out of range",
|
85
|
+
input: 1000000000000,
|
86
|
+
expectError: true,
|
87
|
+
},
|
88
|
+
}
|