trackler 2.2.1.105 → 2.2.1.106
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/lib/trackler/version.rb +1 -1
- data/problem-specifications/.travis.yml +1 -41
- data/problem-specifications/exercises/bowling/canonical-data.json +17 -1
- data/problem-specifications/exercises/circular-buffer/canonical-data.json +317 -278
- data/problem-specifications/exercises/forth/canonical-data.json +155 -67
- data/problem-specifications/exercises/grains/canonical-data.json +32 -11
- data/problem-specifications/exercises/grep/canonical-data.json +106 -64
- data/problem-specifications/exercises/house/canonical-data.json +57 -29
- data/problem-specifications/exercises/isogram/canonical-data.json +28 -10
- data/problem-specifications/exercises/list-ops/canonical-data.json +77 -39
- data/problem-specifications/exercises/pov/canonical-data.json +386 -355
- data/problem-specifications/exercises/trinary/canonical-data.json +34 -12
- data/problem-specifications/exercises/two-bucket/description.md +1 -1
- data/problem-specifications/exercises/word-search/canonical-data.json +309 -269
- data/problem-specifications/exercises/zipper/canonical-data.json +337 -311
- data/tracks/bash/docs/ABOUT.md +22 -2
- data/tracks/c/exercises/bob/README.md +2 -0
- data/tracks/c/exercises/bob/src/example.c +4 -2
- data/tracks/c/exercises/bob/test/test_bob.c +82 -12
- data/tracks/c/exercises/palindrome-products/src/example.c +100 -27
- data/tracks/c/exercises/palindrome-products/src/example.h +19 -4
- data/tracks/c/exercises/palindrome-products/test/test_palindrome_products.c +178 -10
- data/tracks/common-lisp/exercises/bob/README.md +2 -0
- data/tracks/common-lisp/exercises/bob/bob-test.lisp +45 -8
- data/tracks/common-lisp/exercises/bob/example.lisp +11 -7
- data/tracks/cpp/docs/INSTALLATION.md +1 -1
- data/tracks/cpp/exercises/leap/leap_test.cpp +1 -1
- data/tracks/elixir/exercises/pig-latin/example.exs +1 -2
- data/tracks/elixir/exercises/pig-latin/pig_latin_test.exs +13 -4
- data/tracks/elm/config.json +4 -4
- data/tracks/elm/exercises/bob/Bob.example.elm +3 -1
- data/tracks/elm/exercises/bob/README.md +2 -0
- data/tracks/elm/exercises/bob/tests/Tests.elm +1 -1
- data/tracks/elm/exercises/phone-number/PhoneNumber.example.elm +33 -18
- data/tracks/elm/exercises/phone-number/tests/Tests.elm +40 -19
- data/tracks/elm/exercises/space-age/tests/Tests.elm +8 -8
- data/tracks/fsharp/exercises/all-your-base/AllYourBaseTest.fs +2 -2
- data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTree.fs +3 -7
- data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTreeTest.fs +63 -37
- data/tracks/fsharp/exercises/binary-search-tree/Example.fs +5 -5
- data/tracks/fsharp/exercises/circular-buffer/CircularBufferTest.fs +0 -13
- data/tracks/fsharp/exercises/complex-numbers/ComplexNumbersTest.fs +7 -1
- data/tracks/fsharp/exercises/react/ReactTest.fs +0 -12
- data/tracks/fsharp/exercises/scale-generator/Example.fs +11 -7
- data/tracks/fsharp/exercises/scale-generator/ScaleGenerator.fs +1 -1
- data/tracks/fsharp/exercises/scale-generator/ScaleGeneratorTest.fs +34 -49
- data/tracks/fsharp/generators/Common.fs +1 -1
- data/tracks/fsharp/generators/Exercise.fs +3 -2
- data/tracks/fsharp/generators/Generators.fs +95 -29
- data/tracks/fsharp/generators/Templates/_TestFunction.liquid +1 -1
- data/tracks/fsharp/generators/Templates/_TestFunctionBody.liquid +3 -1
- data/tracks/fsharp/generators/Templates/_TestMember.liquid +1 -1
- data/tracks/fsharp/generators/Templates/_TestMemberBody.liquid +3 -1
- data/tracks/go/exercises/simple-linked-list/linked_list_test.go +17 -13
- data/tracks/haskell/config.json +10 -0
- data/tracks/haskell/exercises/all-your-base/package.yaml +1 -1
- data/tracks/haskell/exercises/all-your-base/test/Tests.hs +1 -1
- data/tracks/haskell/exercises/bowling/package.yaml +1 -1
- data/tracks/haskell/exercises/bowling/test/Tests.hs +8 -0
- data/tracks/haskell/exercises/complex-numbers/package.yaml +1 -1
- data/tracks/haskell/exercises/diamond/examples/success-standard/src/Diamond.hs +2 -2
- data/tracks/haskell/exercises/diamond/package.yaml +1 -1
- data/tracks/haskell/exercises/diamond/src/Diamond.hs +1 -1
- data/tracks/haskell/exercises/diamond/test/Tests.hs +1 -1
- data/tracks/haskell/exercises/forth/package.yaml +1 -1
- data/tracks/haskell/exercises/grains/package.yaml +1 -1
- data/tracks/haskell/exercises/isogram/package.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/package.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/test/Tests.hs +81 -76
- data/tracks/haskell/exercises/pov/package.yaml +1 -1
- data/tracks/haskell/exercises/protein-translation/README.md +102 -0
- data/tracks/haskell/exercises/protein-translation/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/protein-translation/examples/success-standard/src/ProteinTranslation.hs +24 -0
- data/tracks/haskell/exercises/protein-translation/package.yaml +20 -0
- data/tracks/haskell/exercises/protein-translation/src/ProteinTranslation.hs +4 -0
- data/tracks/haskell/exercises/protein-translation/stack.yaml +1 -0
- data/tracks/haskell/exercises/protein-translation/test/Tests.hs +119 -0
- data/tracks/haskell/exercises/zipper/package.yaml +1 -1
- data/tracks/java/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- data/tracks/java/config.json +13 -0
- data/tracks/java/exercises/atbash-cipher/src/test/java/AtbashTest.java +78 -62
- data/tracks/java/exercises/binary/.meta/version +1 -0
- data/tracks/java/exercises/binary/src/test/java/BinaryTest.java +97 -32
- data/tracks/java/exercises/bracket-push/.meta/version +1 -1
- data/tracks/java/exercises/isbn-verifier/.meta/version +1 -1
- data/tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java +6 -0
- data/tracks/java/exercises/matrix/.meta/src/reference/java/Matrix.java +0 -8
- data/tracks/java/exercises/matrix/.meta/version +2 -0
- data/tracks/java/exercises/matrix/src/test/java/MatrixTest.java +95 -193
- data/tracks/java/exercises/octal/src/test/java/OctalTest.java +81 -32
- data/tracks/java/exercises/pascals-triangle/.meta/version +1 -1
- data/tracks/java/exercises/phone-number/.meta/version +1 -1
- data/tracks/java/exercises/pig-latin/.meta/version +1 -1
- data/tracks/java/exercises/pig-latin/src/test/java/PigLatinTranslatorTest.java +116 -55
- data/tracks/java/exercises/prime-factors/src/test/java/PrimeFactorsCalculatorTest.java +42 -24
- data/tracks/java/exercises/raindrops/.meta/version +1 -1
- data/tracks/java/exercises/raindrops/src/test/java/RaindropConverterTest.java +97 -41
- data/tracks/java/exercises/reverse-string/.meta/version +1 -1
- data/tracks/java/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java +118 -37
- data/tracks/java/exercises/run-length-encoding/.meta/version +1 -0
- data/tracks/java/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java +71 -29
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/java/exercises/two-bucket/.meta/src/reference/java/TwoBucket.java +145 -0
- data/tracks/java/exercises/two-bucket/.meta/version +1 -0
- data/tracks/java/exercises/two-bucket/README.md +48 -0
- data/tracks/java/exercises/two-bucket/build.gradle +18 -0
- data/{problem-specifications/exercises/circular-buffer/USE_OLD_SCHEMA → tracks/java/exercises/two-bucket/src/main/java/.keep} +0 -0
- data/tracks/java/exercises/two-bucket/src/test/java/TwoBucketTest.java +77 -0
- data/tracks/javascript/.eslintignore +0 -9
- data/tracks/javascript/exercises/binary-search/example.js +1 -1
- data/tracks/javascript/exercises/binary-search-tree/example.js +2 -2
- data/tracks/javascript/exercises/bracket-push/example.js +1 -1
- data/tracks/javascript/exercises/leap/example.js +7 -3
- data/tracks/javascript/exercises/leap/leap.js +2 -2
- data/tracks/javascript/exercises/list-ops/example.js +1 -1
- data/tracks/javascript/exercises/luhn/example.js +2 -2
- data/tracks/javascript/exercises/pythagorean-triplet/example.js +2 -1
- data/tracks/javascript/exercises/roman-numerals/example.js +3 -2
- data/tracks/julia/config.json +13 -0
- data/tracks/julia/exercises/isbn-verifier/README.md +51 -0
- data/tracks/julia/exercises/isbn-verifier/example.jl +26 -0
- data/{problem-specifications/exercises/forth/USE_OLD_SCHEMA → tracks/julia/exercises/isbn-verifier/isbn-verifier.jl} +0 -0
- data/tracks/julia/exercises/isbn-verifier/runtests.jl +73 -0
- data/tracks/perl5/.travis.yml +8 -1
- data/tracks/perl5/README.md +9 -11
- data/tracks/perl5/bin/exercise-gen.pl +14 -29
- data/tracks/perl5/config.json +1 -0
- data/tracks/perl5/cpanfile +2 -1
- data/tracks/perl5/exercises/accumulate/{Example.pm → .meta/solutions/Accumulate.pm} +1 -1
- data/tracks/perl5/exercises/accumulate/.meta/solutions/accumulate.t +1 -0
- data/tracks/perl5/exercises/accumulate/accumulate.t +1 -1
- data/tracks/perl5/exercises/all-your-base/{Example.pm → .meta/solutions/AllYourBase.pm} +1 -1
- data/tracks/perl5/exercises/all-your-base/.meta/solutions/all-your-base.t +1 -0
- data/tracks/perl5/exercises/all-your-base/all-your-base.t +1 -1
- data/tracks/perl5/exercises/allergies/{Example.pm → .meta/solutions/Allergies.pm} +1 -1
- data/tracks/perl5/exercises/allergies/.meta/solutions/allergies.t +1 -0
- data/tracks/perl5/exercises/allergies/allergies.t +75 -8
- data/tracks/perl5/exercises/anagram/{Example.pm → .meta/solutions/Anagram.pm} +1 -1
- data/tracks/perl5/exercises/anagram/.meta/solutions/anagram.t +1 -0
- data/tracks/perl5/exercises/anagram/anagram.t +61 -8
- data/tracks/perl5/exercises/atbash-cipher/{Example.pm → .meta/solutions/Cipher.pm} +1 -1
- data/tracks/perl5/exercises/atbash-cipher/.meta/solutions/cipher.t +1 -0
- data/tracks/perl5/exercises/atbash-cipher/cipher.t +81 -8
- data/tracks/perl5/exercises/beer-song/{Example.pm → .meta/solutions/Beer.pm} +1 -1
- data/tracks/perl5/exercises/beer-song/.meta/solutions/beer.t +1 -0
- data/tracks/perl5/exercises/beer-song/beer.t +80 -7
- data/tracks/perl5/exercises/binary/{Example.pm → .meta/solutions/Binary.pm} +1 -1
- data/tracks/perl5/exercises/binary/.meta/solutions/binary.t +1 -0
- data/tracks/perl5/exercises/binary/binary.t +1 -1
- data/tracks/perl5/exercises/binary-search/{Example.pm → .meta/solutions/BinarySearch.pm} +1 -1
- data/tracks/perl5/exercises/binary-search/.meta/solutions/binary-search.t +1 -0
- data/tracks/perl5/exercises/binary-search/binary-search.t +1 -1
- data/tracks/perl5/exercises/binary-search-tree/{Example.pm → .meta/solutions/BinarySearchTree.pm} +1 -1
- data/tracks/perl5/exercises/binary-search-tree/.meta/solutions/binary_search_tree.t +1 -0
- data/tracks/perl5/exercises/binary-search-tree/binary_search_tree.t +1 -1
- data/tracks/perl5/exercises/bob/{example.yaml → .meta/exercise-data.yaml} +0 -1
- data/tracks/perl5/exercises/bob/{Example.pm → .meta/solutions/Bob.pm} +0 -0
- data/tracks/perl5/exercises/bob/.meta/solutions/bob.t +1 -0
- data/tracks/perl5/exercises/bob/bob.t +1 -2
- data/tracks/perl5/exercises/clock/{Example.pm → .meta/solutions/Clock.pm} +2 -2
- data/tracks/perl5/exercises/clock/.meta/solutions/clock.t +1 -0
- data/tracks/perl5/exercises/clock/clock.t +1 -1
- data/tracks/perl5/exercises/crypto-square/{Example.pm → .meta/solutions/Crypto.pm} +1 -1
- data/tracks/perl5/exercises/crypto-square/.meta/solutions/crypto.t +1 -0
- data/tracks/perl5/exercises/crypto-square/crypto.t +1 -1
- data/tracks/perl5/exercises/custom-set/{Example.pm → .meta/solutions/CustomSet.pm} +1 -1
- data/tracks/perl5/exercises/custom-set/.meta/solutions/custom-set.t +1 -0
- data/tracks/perl5/exercises/custom-set/custom-set.t +1 -1
- data/tracks/perl5/exercises/difference-of-squares/{Example.pm → .meta/solutions/Squares.pm} +1 -1
- data/tracks/perl5/exercises/difference-of-squares/.meta/solutions/difference_of_squares.t +1 -0
- data/tracks/perl5/exercises/difference-of-squares/difference_of_squares.t +1 -1
- data/tracks/perl5/exercises/etl/{Example.pm → .meta/solutions/ETL.pm} +1 -1
- data/tracks/perl5/exercises/etl/.meta/solutions/etl.t +1 -0
- data/tracks/perl5/exercises/etl/etl.t +1 -1
- data/tracks/perl5/exercises/food-chain/{Example.pm → .meta/solutions/FoodChainSong.pm} +1 -1
- data/tracks/perl5/exercises/food-chain/.meta/solutions/food_chain.t +1 -0
- data/tracks/perl5/exercises/food-chain/food_chain.t +1 -1
- data/tracks/perl5/exercises/gigasecond/{Example.pm → .meta/solutions/Gigasecond.pm} +1 -1
- data/tracks/perl5/exercises/gigasecond/.meta/solutions/gigasecond.t +1 -0
- data/tracks/perl5/exercises/gigasecond/gigasecond.t +1 -1
- data/tracks/perl5/exercises/grade-school/{Example.pm → .meta/solutions/GradeSchool.pm} +1 -1
- data/tracks/perl5/exercises/grade-school/.meta/solutions/grade_school.t +1 -0
- data/tracks/perl5/exercises/grade-school/grade_school.t +1 -1
- data/tracks/perl5/exercises/grains/{Example.pm → .meta/solutions/Grains.pm} +1 -1
- data/tracks/perl5/exercises/grains/.meta/solutions/grains.t +1 -0
- data/tracks/perl5/exercises/grains/grains.t +54 -6
- data/tracks/perl5/exercises/hamming/{Example.pm → .meta/solutions/Hamming.pm} +1 -1
- data/tracks/perl5/exercises/hamming/.meta/solutions/hamming.t +1 -0
- data/tracks/perl5/exercises/hamming/hamming.t +1 -1
- data/tracks/perl5/exercises/hello-world/{example.yaml → .meta/exercise-data.yaml} +0 -1
- data/tracks/perl5/exercises/hello-world/{Example.pm → .meta/solutions/HelloWorld.pm} +0 -0
- data/tracks/perl5/exercises/hello-world/.meta/solutions/hello-world.t +1 -0
- data/tracks/perl5/exercises/hello-world/hello-world.t +1 -2
- data/tracks/perl5/exercises/hexadecimal/{Example.pm → .meta/solutions/Hexadecimal.pm} +1 -1
- data/tracks/perl5/exercises/hexadecimal/.meta/solutions/hexadecimal.t +1 -0
- data/tracks/perl5/exercises/hexadecimal/hexadecimal.t +1 -1
- data/tracks/perl5/exercises/house/{Example.pm → .meta/solutions/House.pm} +1 -1
- data/tracks/perl5/exercises/house/.meta/solutions/house.t +1 -0
- data/tracks/perl5/exercises/house/house.t +1 -1
- data/tracks/perl5/exercises/kindergarten-garden/{Example.pm → .meta/solutions/Kindergarten.pm} +1 -1
- data/tracks/perl5/exercises/kindergarten-garden/.meta/solutions/kindergarten.t +1 -0
- data/tracks/perl5/exercises/kindergarten-garden/kindergarten.t +1 -1
- data/tracks/perl5/exercises/largest-series-product/{Example.pm → .meta/solutions/Series.pm} +1 -1
- data/tracks/perl5/exercises/largest-series-product/.meta/solutions/series_product.t +1 -0
- data/tracks/perl5/exercises/largest-series-product/series_product.t +1 -1
- data/tracks/perl5/exercises/leap/{example.yaml → .meta/exercise-data.yaml} +0 -1
- data/tracks/perl5/exercises/leap/{Example.pm → .meta/solutions/Leap.pm} +0 -0
- data/tracks/perl5/exercises/leap/.meta/solutions/leap.t +1 -0
- data/tracks/perl5/exercises/leap/leap.t +1 -2
- data/tracks/perl5/exercises/linked-list/{Example.pm → .meta/solutions/Deque.pm} +1 -1
- data/tracks/perl5/exercises/linked-list/.meta/solutions/deque.t +1 -0
- data/tracks/perl5/exercises/linked-list/deque.t +60 -7
- data/tracks/perl5/exercises/list-ops/{Example.pm → .meta/solutions/ListOps.pm} +1 -1
- data/tracks/perl5/exercises/list-ops/.meta/solutions/list-ops.t +1 -0
- data/tracks/perl5/exercises/list-ops/list-ops.t +1 -1
- data/tracks/perl5/exercises/luhn/{example.yaml → .meta/exercise-data.yaml} +0 -0
- data/tracks/perl5/exercises/luhn/{Example.pm → .meta/solutions/Luhn.pm} +0 -0
- data/tracks/perl5/exercises/luhn/.meta/solutions/luhn.t +1 -0
- data/tracks/perl5/exercises/luhn/luhn.t +1 -2
- data/tracks/perl5/exercises/matrix/{Example.pm → .meta/solutions/Matrix.pm} +1 -1
- data/tracks/perl5/exercises/matrix/.meta/solutions/matrix.t +1 -0
- data/tracks/perl5/exercises/matrix/matrix.t +1 -1
- data/tracks/perl5/exercises/meetup/{Example.pm → .meta/solutions/Meetup.pm} +1 -1
- data/tracks/perl5/exercises/meetup/.meta/solutions/meetup.t +1 -0
- data/tracks/perl5/exercises/meetup/meetup.t +1 -1
- data/tracks/perl5/exercises/minesweeper/{Example.pm → .meta/solutions/Minesweeper.pm} +1 -1
- data/tracks/perl5/exercises/minesweeper/.meta/solutions/minesweeper.t +1 -0
- data/tracks/perl5/exercises/minesweeper/minesweeper.t +1 -1
- data/tracks/perl5/exercises/nucleotide-count/{Example.pm → .meta/solutions/NucleotideCount.pm} +1 -1
- data/tracks/perl5/exercises/nucleotide-count/.meta/solutions/nucleotide_count.t +1 -0
- data/tracks/perl5/exercises/nucleotide-count/nucleotide_count.t +1 -1
- data/tracks/perl5/exercises/ocr-numbers/{Example.pm → .meta/solutions/OCR.pm} +1 -1
- data/tracks/perl5/exercises/ocr-numbers/.meta/solutions/ocr.t +1 -0
- data/tracks/perl5/exercises/ocr-numbers/ocr.t +1 -1
- data/tracks/perl5/exercises/palindrome-products/{Example.pm → .meta/solutions/Palindrome.pm} +1 -1
- data/tracks/perl5/exercises/palindrome-products/.meta/solutions/palindrome.t +1 -0
- data/tracks/perl5/exercises/palindrome-products/palindrome.t +1 -1
- data/tracks/perl5/exercises/pascals-triangle/{Example.pm → .meta/solutions/Triangle.pm} +1 -1
- data/tracks/perl5/exercises/pascals-triangle/.meta/solutions/triangle.t +1 -0
- data/tracks/perl5/exercises/pascals-triangle/triangle.t +51 -7
- data/tracks/perl5/exercises/phone-number/{example.yaml → .meta/exercise-data.yaml} +0 -0
- data/tracks/perl5/exercises/phone-number/{Example.pm → .meta/solutions/PhoneNumber.pm} +0 -0
- data/tracks/perl5/exercises/phone-number/.meta/solutions/phone-number.t +1 -0
- data/tracks/perl5/exercises/phone-number/phone-number.t +1 -2
- data/tracks/perl5/exercises/pig-latin/{Example.pm → .meta/solutions/PigLatin.pm} +1 -1
- data/tracks/perl5/exercises/pig-latin/.meta/solutions/piglatin.t +1 -0
- data/tracks/perl5/exercises/pig-latin/piglatin.t +1 -1
- data/tracks/perl5/exercises/point-mutations/{Example.pm → .meta/solutions/DNA.pm} +1 -1
- data/tracks/perl5/exercises/point-mutations/.meta/solutions/dna.t +1 -0
- data/tracks/perl5/exercises/point-mutations/dna.t +75 -7
- data/tracks/perl5/exercises/prime-factors/{Example.pm → .meta/solutions/Prime.pm} +1 -1
- data/tracks/perl5/exercises/prime-factors/.meta/solutions/prime.t +1 -0
- data/tracks/perl5/exercises/prime-factors/prime.t +63 -7
- data/tracks/perl5/exercises/proverb/{Example.pm → .meta/solutions/Proverb.pm} +1 -1
- data/tracks/perl5/exercises/proverb/.meta/solutions/proverb.t +1 -0
- data/tracks/perl5/exercises/proverb/proverb.t +58 -7
- data/tracks/perl5/exercises/pythagorean-triplet/{Example.pm → .meta/solutions/Triplet.pm} +2 -2
- data/tracks/perl5/exercises/pythagorean-triplet/.meta/solutions/triplet.t +1 -0
- data/tracks/perl5/exercises/pythagorean-triplet/triplet.t +1 -1
- data/tracks/perl5/exercises/queen-attack/{Example.pm → .meta/solutions/Queens.pm} +1 -1
- data/tracks/perl5/exercises/queen-attack/.meta/solutions/queen.t +1 -0
- data/tracks/perl5/exercises/queen-attack/queen.t +186 -8
- data/tracks/perl5/exercises/raindrops/{Example.pm → .meta/solutions/Raindrops.pm} +1 -1
- data/tracks/perl5/exercises/raindrops/.meta/solutions/raindrops.t +1 -0
- data/tracks/perl5/exercises/raindrops/raindrops.t +89 -7
- data/tracks/perl5/exercises/rna-transcription/{Example.pm → .meta/solutions/DNA.pm} +1 -1
- data/tracks/perl5/exercises/rna-transcription/.meta/solutions/rna.t +1 -0
- data/tracks/perl5/exercises/rna-transcription/rna.t +1 -1
- data/tracks/perl5/exercises/robot-name/{Example.pm → .meta/solutions/RobotName.pm} +1 -1
- data/tracks/perl5/exercises/robot-name/.meta/solutions/robot_name.t +1 -0
- data/tracks/perl5/exercises/robot-name/robot_name.t +1 -1
- data/tracks/perl5/exercises/robot-simulator/{Example.pm → .meta/solutions/Robot.pm} +1 -1
- data/tracks/perl5/exercises/robot-simulator/.meta/solutions/robot_simulator.t +1 -0
- data/tracks/perl5/exercises/robot-simulator/robot_simulator.t +1 -1
- data/tracks/perl5/exercises/roman-numerals/{Example.pm → .meta/solutions/Decimal.pm} +1 -1
- data/tracks/perl5/exercises/roman-numerals/.meta/solutions/roman.t +1 -0
- data/tracks/perl5/exercises/roman-numerals/roman.t +1 -1
- data/tracks/perl5/exercises/saddle-points/{Example.pm → .meta/solutions/Matrix.pm} +1 -1
- data/tracks/perl5/exercises/saddle-points/.meta/solutions/saddle_points.t +1 -0
- data/tracks/perl5/exercises/saddle-points/saddle_points.t +1 -1
- data/tracks/perl5/exercises/say/{Example.pm → .meta/solutions/Say.pm} +1 -1
- data/tracks/perl5/exercises/say/.meta/solutions/say.t +1 -0
- data/tracks/perl5/exercises/say/say.t +1 -1
- data/tracks/perl5/exercises/scrabble-score/{Example.pm → .meta/solutions/Word.pm} +1 -1
- data/tracks/perl5/exercises/scrabble-score/.meta/solutions/scrabble.t +1 -0
- data/tracks/perl5/exercises/scrabble-score/scrabble.t +1 -1
- data/tracks/perl5/exercises/secret-handshake/{Example.pm → .meta/solutions/SecretHandshake.pm} +1 -1
- data/tracks/perl5/exercises/secret-handshake/.meta/solutions/handshake.t +1 -0
- data/tracks/perl5/exercises/secret-handshake/handshake.t +1 -1
- data/tracks/perl5/exercises/series/{Example.pm → .meta/solutions/Series.pm} +1 -1
- data/tracks/perl5/exercises/series/.meta/solutions/series.t +1 -0
- data/tracks/perl5/exercises/series/series.t +1 -1
- data/tracks/perl5/exercises/sieve/{Example.pm → .meta/solutions/Sieve.pm} +1 -1
- data/tracks/perl5/exercises/sieve/.meta/solutions/sieve.t +1 -0
- data/tracks/perl5/exercises/sieve/sieve.t +1 -1
- data/tracks/perl5/exercises/simple-cipher/{Example.pm → .meta/solutions/Cipher.pm} +1 -1
- data/tracks/perl5/exercises/simple-cipher/.meta/solutions/cipher.t +1 -0
- data/tracks/perl5/exercises/simple-cipher/cipher.t +1 -1
- data/tracks/perl5/exercises/simple-linked-list/{Example.pm → .meta/solutions/LinkedList.pm} +1 -1
- data/tracks/perl5/exercises/simple-linked-list/.meta/solutions/simple_linked_list.t +1 -0
- data/tracks/perl5/exercises/simple-linked-list/simple_linked_list.t +1 -1
- data/tracks/perl5/exercises/space-age/{Example.pm → .meta/solutions/SpaceAge.pm} +1 -1
- data/tracks/perl5/exercises/space-age/.meta/solutions/space.t +1 -0
- data/tracks/perl5/exercises/space-age/space.t +1 -1
- data/tracks/perl5/exercises/strain/{Example.pm → .meta/solutions/Strain.pm} +1 -1
- data/tracks/perl5/exercises/strain/.meta/solutions/strain.t +1 -0
- data/tracks/perl5/exercises/strain/strain.t +1 -1
- data/tracks/perl5/exercises/sublist/{Example.pm → .meta/solutions/Sublist.pm} +1 -1
- data/tracks/perl5/exercises/sublist/.meta/solutions/sublist.t +1 -0
- data/tracks/perl5/exercises/sublist/sublist.t +1 -1
- data/tracks/perl5/exercises/sum-of-multiples/{Example.pm → .meta/solutions/SumOfMultiples.pm} +1 -1
- data/tracks/perl5/exercises/sum-of-multiples/.meta/solutions/sum_of_multiples.t +1 -0
- data/tracks/perl5/exercises/sum-of-multiples/sum_of_multiples.t +1 -1
- data/tracks/perl5/exercises/triangle/{Example.pm → .meta/solutions/Triangle.pm} +1 -1
- data/tracks/perl5/exercises/triangle/.meta/solutions/triangle.t +1 -0
- data/tracks/perl5/exercises/triangle/triangle.t +87 -8
- data/tracks/perl5/exercises/trinary/{Example.pm → .meta/solutions/Trinary.pm} +1 -1
- data/tracks/perl5/exercises/trinary/.meta/solutions/trinary.t +1 -0
- data/tracks/perl5/exercises/trinary/trinary.t +1 -1
- data/tracks/perl5/exercises/twelve-days/{Example.pm → .meta/solutions/TwelveDays.pm} +1 -1
- data/tracks/perl5/exercises/twelve-days/.meta/solutions/song.t +1 -0
- data/tracks/perl5/exercises/twelve-days/song.t +1 -1
- data/tracks/perl5/exercises/word-count/{Example.pm → .meta/solutions/Phrase.pm} +1 -1
- data/tracks/perl5/exercises/word-count/.meta/solutions/word_count.t +1 -0
- data/tracks/perl5/exercises/word-count/word_count.t +1 -1
- data/tracks/perl5/exercises/wordy/{Example.pm → .meta/solutions/Wordy.pm} +1 -1
- data/tracks/perl5/exercises/wordy/.meta/solutions/wordy.t +1 -0
- data/tracks/perl5/exercises/wordy/wordy.t +87 -9
- data/tracks/perl5/lib/Exercism/Generator.pm +48 -0
- data/tracks/perl5/t/generated-tests.t +26 -0
- data/tracks/perl5/templates/test.mustache +4 -17
- data/tracks/perl6/.proverc +1 -0
- data/tracks/perl6/.travis.yml +6 -10
- data/tracks/perl6/README.md +1 -3
- data/tracks/perl6/bin/exercise-gen.pl6 +2 -0
- data/tracks/perl6/exercises/accumulate/.meta/solutions/accumulate.t +1 -0
- data/tracks/perl6/exercises/acronym/.meta/solutions/acronym.t +1 -0
- data/tracks/perl6/exercises/all-your-base/.meta/solutions/all-your-base.t +1 -0
- data/tracks/perl6/exercises/allergies/.meta/solutions/allergies.t +1 -0
- data/tracks/perl6/exercises/anagram/.meta/solutions/anagram.t +1 -0
- data/tracks/perl6/exercises/atbash-cipher/.meta/solutions/atbash-cipher.t +1 -0
- data/tracks/perl6/exercises/bob/.meta/solutions/bob.t +1 -0
- data/tracks/perl6/exercises/clock/.meta/solutions/clock.t +1 -0
- data/tracks/perl6/exercises/etl/.meta/solutions/etl.t +1 -0
- data/tracks/perl6/exercises/flatten-array/.meta/solutions/flatten-array.t +1 -0
- data/tracks/perl6/exercises/grade-school/.meta/solutions/grade-school.t +1 -0
- data/tracks/perl6/exercises/grains/.meta/solutions/grains.t +1 -0
- data/tracks/perl6/exercises/hamming/.meta/solutions/hamming.t +1 -0
- data/tracks/perl6/exercises/hello-world/.meta/solutions/hello-world.t +1 -0
- data/tracks/perl6/exercises/leap/.meta/solutions/leap.t +1 -0
- data/tracks/perl6/exercises/linked-list/.meta/solutions/linked-list.t +1 -0
- data/tracks/perl6/exercises/luhn/.meta/solutions/luhn.t +1 -0
- data/tracks/perl6/exercises/meetup/.meta/solutions/meetup.t +1 -0
- data/tracks/perl6/exercises/nucleotide-count/.meta/solutions/nucleotide-count.t +1 -0
- data/tracks/perl6/exercises/pangram/.meta/solutions/pangram.t +1 -0
- data/tracks/perl6/exercises/phone-number/.meta/solutions/phone-number.t +1 -0
- data/tracks/perl6/exercises/raindrops/.meta/solutions/raindrops.t +1 -0
- data/tracks/perl6/exercises/rna-transcription/.meta/solutions/rna-transcription.t +1 -0
- data/tracks/perl6/exercises/robot-name/.meta/solutions/robot-name.t +1 -0
- data/tracks/perl6/exercises/roman-numerals/.meta/solutions/roman-numerals.t +1 -0
- data/tracks/perl6/exercises/scrabble-score/.meta/solutions/scrabble-score.t +1 -0
- data/tracks/perl6/exercises/space-age/.meta/solutions/space-age.t +1 -0
- data/tracks/perl6/exercises/two-fer/.meta/solutions/two-fer.t +1 -0
- data/tracks/perl6/exercises/word-count/.meta/solutions/word-count.t +1 -0
- data/tracks/perl6/exercises/wordy/.meta/solutions/wordy.t +1 -0
- data/tracks/python/config/exercise_readme.go.tmpl +23 -4
- data/tracks/python/exercises/accumulate/README.md +2 -3
- data/tracks/python/exercises/acronym/README.md +2 -3
- data/tracks/python/exercises/acronym/acronym_test.py +2 -5
- data/tracks/python/exercises/all-your-base/README.md +2 -4
- data/tracks/python/exercises/allergies/README.md +2 -3
- data/tracks/python/exercises/allergies/allergies_test.py +1 -1
- data/tracks/python/exercises/alphametics/README.md +2 -4
- data/tracks/python/exercises/anagram/README.md +2 -3
- data/tracks/python/exercises/anagram/anagram_test.py +2 -16
- data/tracks/python/exercises/armstrong-numbers/README.md +16 -2
- data/tracks/python/exercises/atbash-cipher/README.md +2 -3
- data/tracks/python/exercises/atbash-cipher/atbash_cipher_test.py +1 -1
- data/tracks/python/exercises/beer-song/README.md +2 -3
- data/tracks/python/exercises/binary/README.md +2 -3
- data/tracks/python/exercises/binary-search/README.md +2 -3
- data/tracks/python/exercises/binary-search-tree/README.md +2 -3
- data/tracks/python/exercises/bob/README.md +4 -3
- data/tracks/python/exercises/book-store/README.md +2 -3
- data/tracks/python/exercises/bowling/README.md +2 -3
- data/tracks/python/exercises/bracket-push/README.md +2 -3
- data/tracks/python/exercises/change/README.md +2 -3
- data/tracks/python/exercises/circular-buffer/README.md +2 -3
- data/tracks/python/exercises/clock/README.md +2 -3
- data/tracks/python/exercises/collatz-conjecture/README.md +2 -3
- data/tracks/python/exercises/complex-numbers/README.md +3 -3
- data/tracks/python/exercises/connect/README.md +2 -4
- data/tracks/python/exercises/crypto-square/README.md +2 -3
- data/tracks/python/exercises/crypto-square/crypto_square_test.py +1 -1
- data/tracks/python/exercises/custom-set/README.md +17 -3
- data/tracks/python/exercises/diamond/README.md +2 -3
- data/tracks/python/exercises/difference-of-squares/README.md +2 -3
- data/tracks/python/exercises/difference-of-squares/difference_of_squares_test.py +1 -1
- data/tracks/python/exercises/diffie-hellman/README.md +2 -3
- data/tracks/python/exercises/dominoes/README.md +2 -4
- data/tracks/python/exercises/dot-dsl/README.md +20 -5
- data/tracks/python/exercises/error-handling/README.md +2 -4
- data/tracks/python/exercises/etl/README.md +2 -3
- data/tracks/python/exercises/flatten-array/README.md +2 -3
- data/tracks/python/exercises/flatten-array/flatten_array_test.py +1 -1
- data/tracks/python/exercises/food-chain/README.md +2 -3
- data/tracks/python/exercises/forth/README.md +2 -4
- data/tracks/python/exercises/gigasecond/README.md +2 -3
- data/tracks/python/exercises/gigasecond/gigasecond_test.py +1 -2
- data/tracks/python/exercises/go-counting/README.md +2 -4
- data/tracks/python/exercises/grade-school/README.md +2 -3
- data/tracks/python/exercises/grains/README.md +2 -3
- data/tracks/python/exercises/grep/README.md +2 -3
- data/tracks/python/exercises/hamming/README.md +2 -3
- data/tracks/python/exercises/hamming/hamming_test.py +1 -1
- data/tracks/python/exercises/hello-world/README.md +2 -3
- data/tracks/python/exercises/hello-world/hello_world_test.py +1 -1
- data/tracks/python/exercises/hexadecimal/README.md +2 -3
- data/tracks/python/exercises/house/README.md +2 -3
- data/tracks/python/exercises/isbn-verifier/README.md +48 -20
- data/tracks/python/exercises/isogram/README.md +2 -3
- data/tracks/python/exercises/kindergarten-garden/README.md +2 -3
- data/tracks/python/exercises/kindergarten-garden/kindergarten_garden_test.py +1 -1
- data/tracks/python/exercises/largest-series-product/README.md +2 -3
- data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +1 -1
- data/tracks/python/exercises/leap/README.md +2 -3
- data/tracks/python/exercises/leap/leap_test.py +1 -1
- data/tracks/python/exercises/linked-list/README.md +2 -3
- data/tracks/python/exercises/list-ops/README.md +2 -4
- data/tracks/python/exercises/luhn/README.md +2 -3
- data/tracks/python/exercises/markdown/README.md +2 -4
- data/tracks/python/exercises/matrix/README.md +2 -3
- data/tracks/python/exercises/matrix/example.py +6 -3
- data/tracks/python/exercises/matrix/matrix.py +6 -0
- data/tracks/python/exercises/matrix/matrix_test.py +25 -15
- data/tracks/python/exercises/meetup/README.md +2 -3
- data/tracks/python/exercises/meetup/meetup_test.py +1 -2
- data/tracks/python/exercises/minesweeper/README.md +2 -4
- data/tracks/python/exercises/nth-prime/README.md +2 -3
- data/tracks/python/exercises/nucleotide-count/README.md +2 -3
- data/tracks/python/exercises/ocr-numbers/README.md +2 -3
- data/tracks/python/exercises/octal/README.md +2 -3
- data/tracks/python/exercises/palindrome-products/README.md +2 -3
- data/tracks/python/exercises/pangram/README.md +2 -3
- data/tracks/python/exercises/pangram/pangram_test.py +1 -1
- data/tracks/python/exercises/parallel-letter-frequency/README.md +2 -4
- data/tracks/python/exercises/pascals-triangle/README.md +2 -3
- data/tracks/python/exercises/perfect-numbers/README.md +2 -3
- data/tracks/python/exercises/phone-number/README.md +2 -3
- data/tracks/python/exercises/pig-latin/README.md +2 -3
- data/tracks/python/exercises/pig-latin/pig_latin_test.py +1 -1
- data/tracks/python/exercises/point-mutations/README.md +2 -3
- data/tracks/python/exercises/poker/README.md +2 -3
- data/tracks/python/exercises/pov/README.md +2 -5
- data/tracks/python/exercises/prime-factors/README.md +2 -3
- data/tracks/python/exercises/prime-factors/prime_factors_test.py +1 -1
- data/tracks/python/exercises/protein-translation/README.md +4 -5
- data/tracks/python/exercises/proverb/README.md +2 -2
- data/tracks/python/exercises/pythagorean-triplet/README.md +2 -3
- data/tracks/python/exercises/queen-attack/README.md +2 -3
- data/tracks/python/exercises/rail-fence-cipher/README.md +2 -3
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher.py +2 -6
- data/tracks/python/exercises/raindrops/README.md +2 -3
- data/tracks/python/exercises/react/README.md +2 -4
- data/tracks/python/exercises/rectangles/README.md +2 -4
- data/tracks/python/exercises/reverse-string/README.md +28 -0
- data/tracks/python/exercises/reverse-string/reverse_string_test.py +1 -1
- data/tracks/python/exercises/rna-transcription/README.md +3 -4
- data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +3 -25
- data/tracks/python/exercises/robot-name/README.md +2 -3
- data/tracks/python/exercises/robot-simulator/README.md +2 -3
- data/tracks/python/exercises/robot-simulator/robot_simulator_test.py +1 -1
- data/tracks/python/exercises/roman-numerals/README.md +2 -3
- data/tracks/python/exercises/rotational-cipher/README.md +2 -3
- data/tracks/python/exercises/rotational-cipher/rotational_cipher_test.py +1 -1
- data/tracks/python/exercises/run-length-encoding/README.md +2 -3
- data/tracks/python/exercises/saddle-points/README.md +2 -3
- data/tracks/python/exercises/say/README.md +2 -3
- data/tracks/python/exercises/say/say_test.py +1 -1
- data/tracks/python/exercises/scale-generator/README.md +2 -4
- data/tracks/python/exercises/scrabble-score/README.md +2 -3
- data/tracks/python/exercises/scrabble-score/scrabble_score_test.py +1 -1
- data/tracks/python/exercises/secret-handshake/README.md +3 -4
- data/tracks/python/exercises/series/README.md +2 -3
- data/tracks/python/exercises/sieve/README.md +2 -3
- data/tracks/python/exercises/sieve/sieve_test.py +1 -1
- data/tracks/python/exercises/simple-cipher/README.md +6 -9
- data/tracks/python/exercises/simple-linked-list/README.md +2 -3
- data/tracks/python/exercises/space-age/README.md +2 -3
- data/tracks/python/exercises/space-age/space_age_test.py +1 -1
- data/tracks/python/exercises/spiral-matrix/README.md +20 -8
- data/tracks/python/exercises/strain/README.md +2 -3
- data/tracks/python/exercises/sublist/README.md +2 -4
- data/tracks/python/exercises/sublist/sublist_test.py +1 -1
- data/tracks/python/exercises/sum-of-multiples/README.md +2 -3
- data/tracks/python/exercises/sum-of-multiples/sum_of_multiples_test.py +1 -1
- data/tracks/python/exercises/tournament/README.md +2 -4
- data/tracks/python/exercises/transpose/README.md +2 -3
- data/tracks/python/exercises/tree-building/README.md +2 -4
- data/tracks/python/exercises/triangle/README.md +2 -3
- data/tracks/python/exercises/trinary/README.md +2 -3
- data/tracks/python/exercises/twelve-days/README.md +2 -3
- data/tracks/python/exercises/two-bucket/README.md +2 -3
- data/tracks/python/exercises/two-fer/README.md +3 -4
- data/tracks/python/exercises/variable-length-quantity/README.md +2 -3
- data/tracks/python/exercises/word-count/README.md +2 -3
- data/tracks/python/exercises/word-search/README.md +2 -4
- data/tracks/python/exercises/wordy/README.md +2 -3
- data/tracks/python/exercises/zebra-puzzle/README.md +2 -3
- data/tracks/python/exercises/zipper/README.md +2 -4
- data/tracks/ruby/docs/24pullrequests.md +1 -1
- data/tracks/rust/exercises/robot-name/Cargo-example.toml +6 -0
- data/tracks/rust/exercises/robot-name/Cargo.toml +0 -1
- data/tracks/scala/exercises/beer-song/example.scala +3 -3
- data/tracks/scala/exercises/beer-song/src/test/scala/BeerSongTest.scala +29 -30
- data/tracks/scala/exercises/binary-search/src/test/scala/BinarySearchTest.scala +3 -3
- data/tracks/scala/exercises/book-store/example.scala +1 -1
- data/tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala +19 -15
- data/tracks/scala/testgen/src/main/scala/BeerSongTestGenerator.scala +21 -3
- data/tracks/scala/testgen/src/main/scala/BinarySearchTestGenerator.scala +3 -5
- data/tracks/scala/testgen/src/main/scala/BookStoreTestGenerator.scala +3 -3
- data/tracks/swift/.travis.yml +2 -2
- data/tracks/swift/config.json +12 -0
- data/tracks/swift/exercises/scale-generator/Package.swift +5 -0
- data/tracks/swift/exercises/scale-generator/README.md +65 -0
- data/tracks/swift/exercises/scale-generator/Sources/ScaleGenerator.swift +1 -0
- data/tracks/swift/exercises/scale-generator/Sources/ScaleGeneratorExample.swift +78 -0
- data/tracks/swift/exercises/scale-generator/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/scale-generator/Tests/ScaleGeneratorTests/ScaleGeneratorTests.swift +116 -0
- metadata +197 -101
- data/problem-specifications/exercises/grains/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/grep/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/house/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/isogram/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/list-ops/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/pov/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/trinary/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/word-search/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/exercises/zipper/USE_OLD_SCHEMA +0 -0
- data/problem-specifications/old-schema.json +0 -137
- data/tracks/c/exercises/bob/.meta/description.md +0 -10
- data/tracks/elm/exercises/bob/.meta/description.md +0 -10
- data/tracks/perl5/exercises/allergies/cases.json +0 -69
- data/tracks/perl5/exercises/anagram/cases.json +0 -56
- data/tracks/perl5/exercises/atbash-cipher/cases.json +0 -75
- data/tracks/perl5/exercises/beer-song/cases.json +0 -74
- data/tracks/perl5/exercises/grains/cases.json +0 -49
- data/tracks/perl5/exercises/linked-list/cases.json +0 -54
- data/tracks/perl5/exercises/pascals-triangle/cases.json +0 -45
- data/tracks/perl5/exercises/point-mutations/cases.json +0 -69
- data/tracks/perl5/exercises/prime-factors/cases.json +0 -57
- data/tracks/perl5/exercises/proverb/cases.json +0 -52
- data/tracks/perl5/exercises/queen-attack/cases.json +0 -182
- data/tracks/perl5/exercises/raindrops/cases.json +0 -83
- data/tracks/perl5/exercises/triangle/cases.json +0 -82
- data/tracks/perl5/exercises/wordy/cases.json +0 -82
- data/tracks/python/docs/EXERCISE_README_INSERT.md +0 -23
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
import org.scalatest.
|
|
1
|
+
import org.scalatest.{Matchers, FunSuite}
|
|
2
2
|
|
|
3
|
-
/** @version 1.0
|
|
4
|
-
class BeerSongTest extends FunSuite {
|
|
3
|
+
/** @version 2.1.0 */
|
|
4
|
+
class BeerSongTest extends FunSuite with Matchers {
|
|
5
5
|
|
|
6
6
|
test("first generic verse") {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
BeerSong.recite(99, 1) should be(
|
|
8
|
+
"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n")
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
test("last generic verse") {
|
|
12
|
-
pending
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
pending
|
|
13
|
+
BeerSong.recite(3, 1) should be(
|
|
14
|
+
"3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n")
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
test("verse 2") {
|
|
18
|
-
pending
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
test("verse with 2 bottles") {
|
|
18
|
+
pending
|
|
19
|
+
BeerSong.recite(2, 1) should be(
|
|
20
|
+
"2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n")
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
test("verse 1") {
|
|
24
|
-
pending
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
test("verse with 1 bottle") {
|
|
24
|
+
pending
|
|
25
|
+
BeerSong.recite(1, 1) should be(
|
|
26
|
+
"1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n")
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
test("verse 0") {
|
|
30
|
-
pending
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
test("verse with 0 bottles") {
|
|
30
|
+
pending
|
|
31
|
+
BeerSong.recite(0, 1) should be(
|
|
32
|
+
"No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n")
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
test("first two verses") {
|
|
36
|
-
pending
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
pending
|
|
37
|
+
BeerSong.recite(99, 2) should be(
|
|
38
|
+
"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n")
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
test("last three verses") {
|
|
42
|
-
pending
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
pending
|
|
43
|
+
BeerSong.recite(2, 3) should be(
|
|
44
|
+
"2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n")
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
test("all verses") {
|
|
48
|
-
pending
|
|
49
|
-
val expected = "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
|
50
|
-
assert(expected == BeerSong.verses(99, 0))
|
|
48
|
+
pending
|
|
49
|
+
BeerSong.recite(99, 100) should be(
|
|
50
|
+
"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n")
|
|
51
51
|
}
|
|
52
|
-
|
|
53
52
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import org.scalatest.{Matchers, FunSuite}
|
|
2
2
|
|
|
3
|
-
/** @version 1.
|
|
3
|
+
/** @version 1.1.0 */
|
|
4
4
|
class BinarySearchTest extends FunSuite with Matchers {
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
test("finds a value in an array with one element") {
|
|
7
7
|
BinarySearch.find(List(6), 6) should be (Some(0))
|
|
8
8
|
}
|
|
@@ -51,4 +51,4 @@ class BinarySearchTest extends FunSuite with Matchers {
|
|
|
51
51
|
pending
|
|
52
52
|
BinarySearch.find(List(), 1) should be (None)
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
1
|
import org.scalatest.{Matchers, FunSuite}
|
|
3
2
|
|
|
4
|
-
/** @version 1.0
|
|
3
|
+
/** @version 1.3.0 */
|
|
5
4
|
class BookStoreTest extends FunSuite with Matchers {
|
|
6
5
|
|
|
7
6
|
test("Only a single book") {
|
|
8
|
-
BookStore.total(List(1)) should be (
|
|
7
|
+
BookStore.total(List(1)) should be (800)
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
test("Two of the same book") {
|
|
12
11
|
pending
|
|
13
|
-
BookStore.total(List(2, 2)) should be (
|
|
12
|
+
BookStore.total(List(2, 2)) should be (1600)
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
test("Empty basket") {
|
|
@@ -20,51 +19,56 @@ class BookStoreTest extends FunSuite with Matchers {
|
|
|
20
19
|
|
|
21
20
|
test("Two different books") {
|
|
22
21
|
pending
|
|
23
|
-
BookStore.total(List(1, 2)) should be (
|
|
22
|
+
BookStore.total(List(1, 2)) should be (1520)
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
test("Three different books") {
|
|
27
26
|
pending
|
|
28
|
-
BookStore.total(List(1, 2, 3)) should be (
|
|
27
|
+
BookStore.total(List(1, 2, 3)) should be (2160)
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
test("Four different books") {
|
|
32
31
|
pending
|
|
33
|
-
BookStore.total(List(1, 2, 3, 4)) should be (
|
|
32
|
+
BookStore.total(List(1, 2, 3, 4)) should be (2560)
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
test("Five different books") {
|
|
37
36
|
pending
|
|
38
|
-
BookStore.total(List(1, 2, 3, 4, 5)) should be (
|
|
37
|
+
BookStore.total(List(1, 2, 3, 4, 5)) should be (3000)
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
test("Two groups of four is cheaper than group of five plus group of three") {
|
|
42
41
|
pending
|
|
43
|
-
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 5)) should be (
|
|
42
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 5)) should be (5120)
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
test("Group of four plus group of two is cheaper than two groups of three") {
|
|
47
46
|
pending
|
|
48
|
-
BookStore.total(List(1, 1, 2, 2, 3, 4)) should be (
|
|
47
|
+
BookStore.total(List(1, 1, 2, 2, 3, 4)) should be (4080)
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
test("Two each of first 4 books and 1 copy each of rest") {
|
|
52
51
|
pending
|
|
53
|
-
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5)) should be (
|
|
52
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5)) should be (5560)
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
test("Two copies of each book") {
|
|
57
56
|
pending
|
|
58
|
-
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)) should be (
|
|
57
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)) should be (6000)
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
test("Three copies of first book and 2 each of remaining") {
|
|
62
61
|
pending
|
|
63
|
-
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1)) should be (
|
|
62
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1)) should be (6800)
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
test("Three each of first 2 books and 2 each of remaining books") {
|
|
67
66
|
pending
|
|
68
|
-
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2)) should be (
|
|
67
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2)) should be (7520)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
test("Four groups of four are cheaper than two groups each of five and three") {
|
|
71
|
+
pending
|
|
72
|
+
BookStore.total(List(1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5)) should be (10240)
|
|
69
73
|
}
|
|
70
|
-
}
|
|
74
|
+
}
|
|
@@ -3,15 +3,33 @@ import TestSuiteBuilder._
|
|
|
3
3
|
import java.io.File
|
|
4
4
|
|
|
5
5
|
object BeerSongTestGenerator {
|
|
6
|
+
|
|
7
|
+
|
|
6
8
|
def main(args: Array[String]): Unit = {
|
|
7
9
|
val file = new File("src/main/resources/beer-song.json")
|
|
8
10
|
|
|
11
|
+
def toString(expected: CanonicalDataParser.Expected): String = {
|
|
12
|
+
expected match {
|
|
13
|
+
case Right(xs: List[String]) => s"""\"${xs.mkString("\\n")}\\n\""""
|
|
14
|
+
case _ => throw new IllegalArgumentException()
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def fromLabeledTestFromInput(argNames: String*): ToTestCaseData =
|
|
19
|
+
withLabeledTest { sut =>
|
|
20
|
+
labeledTest =>
|
|
21
|
+
val args = sutArgsFromInput(labeledTest.result, argNames: _*)
|
|
22
|
+
val property = labeledTest.property
|
|
23
|
+
val sutCall =
|
|
24
|
+
s"""$sut.$property($args)"""
|
|
25
|
+
val expected = toString(labeledTest.expected)
|
|
26
|
+
TestCaseData(labeledTest.description, sutCall, expected)
|
|
27
|
+
}
|
|
28
|
+
|
|
9
29
|
val code = TestSuiteBuilder.build(file,
|
|
10
|
-
|
|
30
|
+
fromLabeledTestFromInput("startBottles", "takeDown"))
|
|
11
31
|
println(s"-------------")
|
|
12
32
|
println(code)
|
|
13
33
|
println(s"-------------")
|
|
14
|
-
|
|
15
|
-
TestSuiteBuilder.writeToFile(code, new File("BeerSongTest.scala"))
|
|
16
34
|
}
|
|
17
35
|
}
|
|
@@ -15,10 +15,10 @@ object BinarySearchTestGenerator {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
def
|
|
18
|
+
def fromLabeledTestFromInput(argNames: String*): ToTestCaseData =
|
|
19
19
|
withLabeledTest { sut =>
|
|
20
20
|
labeledTest =>
|
|
21
|
-
val args =
|
|
21
|
+
val args = sutArgsFromInput(labeledTest.result, argNames: _*)
|
|
22
22
|
val property = labeledTest.property
|
|
23
23
|
val sutCall =
|
|
24
24
|
s"""$sut.$property($args)"""
|
|
@@ -28,11 +28,9 @@ object BinarySearchTestGenerator {
|
|
|
28
28
|
|
|
29
29
|
val code =
|
|
30
30
|
TestSuiteBuilder.build(file,
|
|
31
|
-
|
|
31
|
+
fromLabeledTestFromInput("array", "value"))
|
|
32
32
|
println(s"-------------")
|
|
33
33
|
println(code)
|
|
34
34
|
println(s"-------------")
|
|
35
|
-
|
|
36
|
-
TestSuiteBuilder.writeToFile(code, new File("AllYourBaseTest.scala"))
|
|
37
35
|
}
|
|
38
36
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import java.io.File
|
|
2
2
|
|
|
3
3
|
import testgen.TestSuiteBuilder
|
|
4
|
-
import testgen.TestSuiteBuilder.
|
|
4
|
+
import testgen.TestSuiteBuilder.fromLabeledTestFromInput
|
|
5
5
|
|
|
6
6
|
object BookStoreTestGenerator {
|
|
7
7
|
def main(args: Array[String]): Unit = {
|
|
8
|
-
val file = new File("book-store.json")
|
|
8
|
+
val file = new File("src/main/resources/book-store.json")
|
|
9
9
|
|
|
10
|
-
val code = TestSuiteBuilder.build(file,
|
|
10
|
+
val code = TestSuiteBuilder.build(file, fromLabeledTestFromInput("basket"))
|
|
11
11
|
println(s"-------------")
|
|
12
12
|
println(code)
|
|
13
13
|
println(s"-------------")
|
data/tracks/swift/.travis.yml
CHANGED
|
@@ -12,8 +12,8 @@ matrix:
|
|
|
12
12
|
- script:
|
|
13
13
|
- bin/fetch-configlet
|
|
14
14
|
- bin/configlet lint .
|
|
15
|
-
- docker run -v `pwd`:/swift norionomura/
|
|
16
|
-
env: JOB=
|
|
15
|
+
- docker run -v `pwd`:/swift norionomura/swift:swift-4.1-branch bash -c "cd /swift && ./xswift-test-spm"
|
|
16
|
+
env: JOB=Linux41x
|
|
17
17
|
sudo: required
|
|
18
18
|
services: docker
|
|
19
19
|
|
data/tracks/swift/config.json
CHANGED
|
@@ -426,6 +426,18 @@
|
|
|
426
426
|
"unlocked_by": null,
|
|
427
427
|
"uuid": "f5499564-62b9-47ab-9ba2-8be6ba453269"
|
|
428
428
|
},
|
|
429
|
+
{
|
|
430
|
+
"uuid": "1c9dfe22-de66-4437-862b-8921dc7eb25e",
|
|
431
|
+
"slug": "scale-generator",
|
|
432
|
+
"core": false,
|
|
433
|
+
"unlocked_by": null,
|
|
434
|
+
"difficulty": 3,
|
|
435
|
+
"topics": [
|
|
436
|
+
"strings",
|
|
437
|
+
"pattern_matching",
|
|
438
|
+
"loops"
|
|
439
|
+
]
|
|
440
|
+
},
|
|
429
441
|
{
|
|
430
442
|
"core": false,
|
|
431
443
|
"difficulty": 4,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Scale Generator
|
|
2
|
+
|
|
3
|
+
Given a tonic, or starting note, and a set of intervals, generate
|
|
4
|
+
the musical scale starting with the tonic and following the
|
|
5
|
+
specified interval pattern.
|
|
6
|
+
|
|
7
|
+
Scales in Western music are based on the chromatic (12-note) scale.This
|
|
8
|
+
scale can be expressed as the following group of pitches:
|
|
9
|
+
|
|
10
|
+
A, A#, B, C, C#, D, D#, E, F, F#, G, G#
|
|
11
|
+
|
|
12
|
+
A given sharp note (indicated by a #), can also be expressed as the flat
|
|
13
|
+
of the note above it (indicated by a b), so the chromatic scale can also be
|
|
14
|
+
written like this:
|
|
15
|
+
|
|
16
|
+
A, Bb, B, C, Db, D, Eb, E, F, Gb, G, Ab
|
|
17
|
+
|
|
18
|
+
The major and minor scale and modes are subsets of this twelve-pitch
|
|
19
|
+
collection. They have seven pitches, and are called diatonic scales.
|
|
20
|
+
The collection of notes in these scales is written with either sharps or
|
|
21
|
+
flats, depending on the tonic. Here is a list of which are which:
|
|
22
|
+
|
|
23
|
+
No Accidentals:
|
|
24
|
+
C major
|
|
25
|
+
A minor
|
|
26
|
+
|
|
27
|
+
Use Sharps:
|
|
28
|
+
G, D, A, E, B, F# major
|
|
29
|
+
e, b, f#, c#, g#, d# minor
|
|
30
|
+
|
|
31
|
+
Use Flats:
|
|
32
|
+
F, Bb, Eb, Ab, Db, Gb major
|
|
33
|
+
d, g, c, f, bb, eb minor
|
|
34
|
+
|
|
35
|
+
The diatonic scales, and all other scales that derive from the
|
|
36
|
+
chromatic scale, are built upon intervals. An interval is the space
|
|
37
|
+
between two pitches.
|
|
38
|
+
|
|
39
|
+
The simplest interval is between two adjacent notes, and is called a
|
|
40
|
+
"half step", or "minor second" (sometimes written as a lower-case "m").
|
|
41
|
+
The interval between two notes that have an interceding note is called
|
|
42
|
+
a "whole step" or "major second" (written as an upper-case "M"). The
|
|
43
|
+
diatonic scales are built using only these two intervals between
|
|
44
|
+
adjacent notes.
|
|
45
|
+
|
|
46
|
+
Non-diatonic scales can contain the same letter twice, and can contain other intervals.
|
|
47
|
+
Sometimes they may be smaller than usual (diminished, written "D"), or larger
|
|
48
|
+
(augmented, written "A"). Intervals larger than an augmented second have other names.
|
|
49
|
+
|
|
50
|
+
Here is a table of pitches with the names of their interval distance from the tonic (A).
|
|
51
|
+
|
|
52
|
+
| A | A# | B | C | C# | D | D# | E | F | F# | G | G# | A |
|
|
53
|
+
|:------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:------:|
|
|
54
|
+
| Unison | Min 2nd | Maj 2nd | Min 3rd | Maj 3rd | Per 4th | Tritone | Per 5th | Min 6th | Maj 6th | Min 7th | Maj 7th | Octave |
|
|
55
|
+
| | | Dim 3rd | Aug 2nd | Dim 4th | | Aug 4th | Dim 5th | Aug 5th | Dim 7th | Aug 6th | Dim 8ve | |
|
|
56
|
+
| | | | | | | Dim 5th | | | | | | |
|
|
57
|
+
|
|
58
|
+
## Setup
|
|
59
|
+
|
|
60
|
+
Go through the project setup instructions for Xcode using Swift:
|
|
61
|
+
|
|
62
|
+
http://exercism.io/languages/swift
|
|
63
|
+
|
|
64
|
+
## Submitting Incomplete Solutions
|
|
65
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//Solution goes in Sources
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
struct ScaleGenerator {
|
|
2
|
+
|
|
3
|
+
private let tonic: String
|
|
4
|
+
private let scaleName: String
|
|
5
|
+
private let pattern: String?
|
|
6
|
+
private let chromaticScale: [String]
|
|
7
|
+
|
|
8
|
+
private let sharpChromaticScale = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
|
|
9
|
+
private let flatChromaticScale = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B"]
|
|
10
|
+
private let flatKeys = ["F", "Bb", "Eb", "Ab", "Db", "Gb", "d", "g", "c", "f", "bb", "eb"]
|
|
11
|
+
|
|
12
|
+
private enum IntervalType: Character {
|
|
13
|
+
case minor = "m"
|
|
14
|
+
case major = "M"
|
|
15
|
+
case augmented = "A"
|
|
16
|
+
|
|
17
|
+
var halfSteps: Int {
|
|
18
|
+
switch self {
|
|
19
|
+
case .minor:
|
|
20
|
+
return 1
|
|
21
|
+
case .major:
|
|
22
|
+
return 2
|
|
23
|
+
case .augmented:
|
|
24
|
+
return 3
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var name: String {
|
|
30
|
+
return "\(tonic) \(scaleName)"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
init(tonic: String, scaleName: String, pattern: String? = nil) {
|
|
34
|
+
self.tonic = tonic.prefix(1).uppercased() + tonic.dropFirst()
|
|
35
|
+
self.scaleName = scaleName
|
|
36
|
+
self.pattern = pattern
|
|
37
|
+
if flatKeys.contains(tonic) {
|
|
38
|
+
self.chromaticScale = flatChromaticScale
|
|
39
|
+
} else {
|
|
40
|
+
self.chromaticScale = sharpChromaticScale
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func pitches() -> [String] {
|
|
45
|
+
var pitches = reorderChromaticScale()
|
|
46
|
+
|
|
47
|
+
if let pattern = pattern {
|
|
48
|
+
var lastIndex = 0
|
|
49
|
+
|
|
50
|
+
let scale: [String] = pattern.map {
|
|
51
|
+
let pitch = pitches[lastIndex]
|
|
52
|
+
lastIndex += IntervalType(rawValue: $0)?.halfSteps ?? 0
|
|
53
|
+
|
|
54
|
+
return pitch
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return scale
|
|
58
|
+
} else {
|
|
59
|
+
return pitches
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private func reorderChromaticScale() -> [String] {
|
|
64
|
+
let scale: [String]
|
|
65
|
+
|
|
66
|
+
if flatKeys.contains(tonic) {
|
|
67
|
+
scale = flatChromaticScale
|
|
68
|
+
} else {
|
|
69
|
+
scale = chromaticScale
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
guard let index = scale.index(of: tonic) else {
|
|
73
|
+
return scale
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return Array(scale[index...] + scale[0..<index])
|
|
77
|
+
}
|
|
78
|
+
}
|
data/tracks/swift/exercises/scale-generator/Tests/ScaleGeneratorTests/ScaleGeneratorTests.swift
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import ScaleGenerator
|
|
3
|
+
|
|
4
|
+
class ScaleGeneratorTests: XCTestCase {
|
|
5
|
+
|
|
6
|
+
func testNamingScale() {
|
|
7
|
+
let chromatic = ScaleGenerator(tonic: "c", scaleName: "chromatic")
|
|
8
|
+
XCTAssertEqual(chromatic.name, "C chromatic")
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
func testChromaticScale() {
|
|
12
|
+
let chromatic = ScaleGenerator(tonic: "C", scaleName: "chromatic")
|
|
13
|
+
XCTAssertEqual(chromatic.pitches(), ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"])
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
func testAnotherChromaticScale() {
|
|
17
|
+
let chromatic = ScaleGenerator(tonic: "F", scaleName: "chromatic")
|
|
18
|
+
XCTAssertEqual(chromatic.pitches(), ["F", "Gb", "G", "Ab", "A", "Bb", "B", "C", "Db", "D", "Eb", "E"])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func testNamingMajorScale() {
|
|
22
|
+
let major = ScaleGenerator(tonic: "G", scaleName: "major", pattern: "MMmMMMm")
|
|
23
|
+
XCTAssertEqual(major.name, "G major")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func testMajorScale() {
|
|
27
|
+
let major = ScaleGenerator(tonic: "C", scaleName: "major", pattern: "MMmMMMm")
|
|
28
|
+
XCTAssertEqual(major.pitches(), ["C", "D", "E", "F", "G", "A", "B"])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func testAnotherMajorScale() {
|
|
32
|
+
let major = ScaleGenerator(tonic: "G", scaleName: "major", pattern: "MMmMMMm")
|
|
33
|
+
XCTAssertEqual(major.pitches(), ["G", "A", "B", "C", "D", "E", "F#"])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func testMinorScale() {
|
|
37
|
+
let minor = ScaleGenerator(tonic: "f#", scaleName: "minor", pattern: "MmMMmMM")
|
|
38
|
+
XCTAssertEqual(minor.pitches(), ["F#", "G#", "A", "B", "C#", "D", "E"])
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func testAnotherMinorScale() {
|
|
42
|
+
let minor = ScaleGenerator(tonic: "bb", scaleName: "minor", pattern: "MmMMmMM")
|
|
43
|
+
XCTAssertEqual(minor.pitches(), ["Bb", "C", "Db", "Eb", "F", "Gb", "Ab"])
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func testDorianMode() {
|
|
47
|
+
let dorian = ScaleGenerator(tonic: "d", scaleName: "dorian", pattern: "MmMMMmM")
|
|
48
|
+
XCTAssertEqual(dorian.pitches(), ["D", "E", "F", "G", "A", "B", "C"])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func testMixolydianMode() {
|
|
52
|
+
let mixolydian = ScaleGenerator(tonic: "Eb", scaleName: "mixolydian", pattern: "MMmMMmM")
|
|
53
|
+
XCTAssertEqual(mixolydian.pitches(), ["Eb", "F", "G", "Ab", "Bb", "C", "Db"])
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func testLydianMode() {
|
|
57
|
+
let lydian = ScaleGenerator(tonic: "a", scaleName: "lydian", pattern: "MMMmMMm")
|
|
58
|
+
XCTAssertEqual(lydian.pitches(), ["A", "B", "C#", "D#", "E", "F#", "G#"])
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func testPhrygianMode() {
|
|
62
|
+
let phrygian = ScaleGenerator(tonic: "e", scaleName: "phrygian", pattern: "mMMMmMM")
|
|
63
|
+
XCTAssertEqual(phrygian.pitches(), ["E", "F", "G", "A", "B", "C", "D"])
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
func testLocrianMode() {
|
|
67
|
+
let locrian = ScaleGenerator(tonic: "g", scaleName: "locrian", pattern: "mMMmMMM")
|
|
68
|
+
XCTAssertEqual(locrian.pitches(), ["G", "Ab", "Bb", "C", "Db", "Eb", "F"])
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func testHarmonicMinor() {
|
|
72
|
+
let harmonicMinor = ScaleGenerator(tonic: "d", scaleName: "harmonic minor", pattern: "MmMMmAm")
|
|
73
|
+
XCTAssertEqual(harmonicMinor.pitches(), ["D", "E", "F", "G", "A", "Bb", "Db"])
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
func testOctatonic() {
|
|
77
|
+
let octatonic = ScaleGenerator(tonic: "C", scaleName: "octatonic", pattern: "MmMmMmMm")
|
|
78
|
+
XCTAssertEqual(octatonic.pitches(), ["C", "D", "D#", "F", "F#", "G#", "A", "B"])
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
func testHexatonic() {
|
|
82
|
+
let hexatonic = ScaleGenerator(tonic: "Db", scaleName: "hexatonic", pattern: "MMMMMM")
|
|
83
|
+
XCTAssertEqual(hexatonic.pitches(), ["Db", "Eb", "F", "G", "A", "B"])
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
func testPentatonic() {
|
|
87
|
+
let pentatonic = ScaleGenerator(tonic: "A", scaleName: "pentatonic", pattern: "MMAMA")
|
|
88
|
+
XCTAssertEqual(pentatonic.pitches(), ["A", "B", "C#", "E", "F#"])
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
func testEnigmatic() {
|
|
92
|
+
let enigmatic = ScaleGenerator(tonic: "G", scaleName: "enigma", pattern: "mAMMMmM")
|
|
93
|
+
XCTAssertEqual(enigmatic.pitches(), ["G", "G#", "B", "C#", "D#", "F", "F#"])
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static var allTests: [(String, (ScaleGeneratorTests) -> () throws -> Void)] {
|
|
97
|
+
return [
|
|
98
|
+
("testNamingScale", testNamingScale),
|
|
99
|
+
("testChromaticScale", testChromaticScale),
|
|
100
|
+
("testAnotherChromaticScale", testAnotherChromaticScale),
|
|
101
|
+
("testNamingMajorScale", testNamingMajorScale),
|
|
102
|
+
("testMajorScale", testMajorScale),
|
|
103
|
+
("testAnotherMajorScale", testAnotherMajorScale),
|
|
104
|
+
("testDorianMode", testDorianMode),
|
|
105
|
+
("testMixolydianMode", testMixolydianMode),
|
|
106
|
+
("testLydianMode", testLydianMode),
|
|
107
|
+
("testPhrygianMode", testPhrygianMode),
|
|
108
|
+
("testLocrianMode", testLocrianMode),
|
|
109
|
+
("testHarmonicMinor", testHarmonicMinor),
|
|
110
|
+
("testOctatonic", testOctatonic),
|
|
111
|
+
("testHexatonic", testHexatonic),
|
|
112
|
+
("testPentatonic", testPentatonic),
|
|
113
|
+
("testEnigmatic", testEnigmatic)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|