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
data/tracks/bash/docs/ABOUT.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
Bash is the language that you will learn to love!
|
|
2
2
|
|
|
3
|
+
Many of your everyday computer tasks can be done using the concise scripts it can produce.
|
|
4
|
+
You will soon learn that while most things can be done through a Graphical User Interface, it can actually be vastly faster to use this powerful language!
|
|
5
|
+
The command interpreter typically runs in a text window, where users may input commands (operations may also come from some files, also known as Bash scripts).
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
More formally, Bash (an acronym for **B**ourne-**a**gain **sh**ell, a pun around the Bourne shell and the term "born-again") is a Unix command interpreter.
|
|
8
|
+
Offering a number of improvements over several other shells (Bash's has some useful functionality in regards to command history, job control and command line editing).
|
|
9
|
+
|
|
10
|
+
A really good way to think about Bash is the following:
|
|
11
|
+
|
|
12
|
+
> Although most users think of the shell as an interactive command interpreter, it is really a programming language in which each statement runs a command.
|
|
13
|
+
> Because it must satisfy both the interactive and programming aspects of command execution, it is a strange language, shaped as much by history as by design. —- Brian Kernighan & Rob Pike
|
|
14
|
+
|
|
15
|
+
_cite: Kernighan, Brian W.; Pike, Rob (1984). The UNIX Programming Environment. Englewood Cliffs: Prentice-Hall. ISBN 0-13-937699-2._
|
|
16
|
+
|
|
17
|
+
Though it was first released several decades ago after being written by Brian Fox of the Free Software Foundation, Bash is still used across the world every day!
|
|
18
|
+
From automation to stitching a project together, the language is still as versatile as it ever was.
|
|
19
|
+
Another benefit of the language's age is the rich documentation you'll find surrounding it.
|
|
20
|
+
If you're ever stuck and don't know exactly how to implement an exercise, a great place to start is the built-in help, available through the use of `info bash` or `man bash`.
|
|
21
|
+
|
|
22
|
+
This track is to help you gain some experience in this wonderful scripting language.
|
|
23
|
+
|
|
24
|
+
**Happy Bash'ing**
|
|
5
25
|
|
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
|
6
6
|
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
|
8
8
|
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
|
10
|
+
|
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
|
10
12
|
anything.
|
|
11
13
|
|
|
@@ -12,9 +12,8 @@ char *hey_bob(char *greeting)
|
|
|
12
12
|
char ch = greeting[i];
|
|
13
13
|
|
|
14
14
|
while (ch != 0) {
|
|
15
|
-
|
|
16
15
|
if (all_blank)
|
|
17
|
-
all_blank = ch == ' ';
|
|
16
|
+
all_blank = ch == ' ' || (ch >= '\t' && ch <= '\r');
|
|
18
17
|
|
|
19
18
|
if (all_shouty)
|
|
20
19
|
all_shouty = !(ch >= 'a' && ch <= 'z');
|
|
@@ -32,6 +31,9 @@ char *hey_bob(char *greeting)
|
|
|
32
31
|
if (all_blank)
|
|
33
32
|
return "Fine. Be that way!";
|
|
34
33
|
|
|
34
|
+
if (all_shouty && any_letters && final_char == '?')
|
|
35
|
+
return "Calm down, I know what I'm doing!";
|
|
36
|
+
|
|
35
37
|
if (any_letters && all_shouty)
|
|
36
38
|
return "Whoa, chill out!";
|
|
37
39
|
|
|
@@ -22,6 +22,13 @@ void test_shouting(void)
|
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
void test_shouting_gibberish(void)
|
|
26
|
+
{
|
|
27
|
+
TEST_IGNORE();
|
|
28
|
+
TEST_ASSERT_EQUAL_STRING("Whoa, chill out!", hey_bob("FCECDFCAAB")
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
void test_asking_a_question(void)
|
|
26
33
|
{
|
|
27
34
|
TEST_IGNORE();
|
|
@@ -31,6 +38,20 @@ void test_asking_a_question(void)
|
|
|
31
38
|
);
|
|
32
39
|
}
|
|
33
40
|
|
|
41
|
+
void test_asking_a_numeric_question(void)
|
|
42
|
+
{
|
|
43
|
+
TEST_IGNORE();
|
|
44
|
+
TEST_ASSERT_EQUAL_STRING("Sure.", hey_bob("You are, what, like 15?")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void test_asking_gibberish(void)
|
|
49
|
+
{
|
|
50
|
+
TEST_IGNORE();
|
|
51
|
+
TEST_ASSERT_EQUAL_STRING("Sure.", hey_bob("fffbbcbeab?")
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
34
55
|
void test_talking_forcefully(void)
|
|
35
56
|
{
|
|
36
57
|
TEST_IGNORE();
|
|
@@ -48,10 +69,10 @@ void test_using_acronyms_in_regular_speech(void)
|
|
|
48
69
|
);
|
|
49
70
|
}
|
|
50
71
|
|
|
51
|
-
void
|
|
72
|
+
void test_forceful_question(void)
|
|
52
73
|
{
|
|
53
74
|
TEST_IGNORE();
|
|
54
|
-
TEST_ASSERT_EQUAL_STRING("
|
|
75
|
+
TEST_ASSERT_EQUAL_STRING("Calm down, I know what I'm doing!",
|
|
55
76
|
hey_bob("WHAT THE HELL WERE YOU THINKING?")
|
|
56
77
|
);
|
|
57
78
|
}
|
|
@@ -101,18 +122,18 @@ void test_statement_containing_question_mark(void)
|
|
|
101
122
|
);
|
|
102
123
|
}
|
|
103
124
|
|
|
104
|
-
void
|
|
125
|
+
void test_non_letters_with_question(void)
|
|
105
126
|
{
|
|
106
127
|
TEST_IGNORE();
|
|
107
|
-
TEST_ASSERT_EQUAL_STRING("Sure.",
|
|
108
|
-
hey_bob("Wait! Hang on. Are you going to be OK?")
|
|
128
|
+
TEST_ASSERT_EQUAL_STRING("Sure.", hey_bob(":) ?")
|
|
109
129
|
);
|
|
110
130
|
}
|
|
111
131
|
|
|
112
|
-
void
|
|
132
|
+
void test_prattling_on(void)
|
|
113
133
|
{
|
|
114
134
|
TEST_IGNORE();
|
|
115
|
-
TEST_ASSERT_EQUAL_STRING("Sure.",
|
|
135
|
+
TEST_ASSERT_EQUAL_STRING("Sure.",
|
|
136
|
+
hey_bob("Wait! Hang on. Are you going to be OK?")
|
|
116
137
|
);
|
|
117
138
|
}
|
|
118
139
|
|
|
@@ -130,11 +151,52 @@ void test_prolonged_silence(void)
|
|
|
130
151
|
);
|
|
131
152
|
}
|
|
132
153
|
|
|
133
|
-
void
|
|
154
|
+
void test_alternate_silence(void)
|
|
155
|
+
{
|
|
156
|
+
TEST_IGNORE();
|
|
157
|
+
TEST_ASSERT_EQUAL_STRING("Fine. Be that way!",
|
|
158
|
+
hey_bob("\t\t\t\t\t\t\t\t\t\t")
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
void test_multiple_line_question(void)
|
|
163
|
+
{
|
|
164
|
+
TEST_IGNORE();
|
|
165
|
+
TEST_ASSERT_EQUAL_STRING("Whatever.",
|
|
166
|
+
hey_bob
|
|
167
|
+
("\nDoes this cryogenic chamber make me look fat?\nno")
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
void test_starting_with_whitespace(void)
|
|
172
|
+
{
|
|
173
|
+
TEST_IGNORE();
|
|
174
|
+
TEST_ASSERT_EQUAL_STRING("Whatever.", hey_bob(" hmmmmmmm...")
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
void test_ending_with_whitespace(void)
|
|
179
|
+
{
|
|
180
|
+
TEST_IGNORE();
|
|
181
|
+
TEST_ASSERT_EQUAL_STRING("Sure.",
|
|
182
|
+
hey_bob
|
|
183
|
+
("Okay if like my spacebar quite a bit? ")
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
void test_other_whitespace(void)
|
|
188
|
+
{
|
|
189
|
+
TEST_IGNORE();
|
|
190
|
+
TEST_ASSERT_EQUAL_STRING("Fine. Be that way!", hey_bob("\n\r \t")
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
void test_non_question_ending_with_whitespace(void)
|
|
134
195
|
{
|
|
135
196
|
TEST_IGNORE();
|
|
136
197
|
TEST_ASSERT_EQUAL_STRING("Whatever.",
|
|
137
|
-
hey_bob
|
|
198
|
+
hey_bob
|
|
199
|
+
("This is a statement ending with whitespace ")
|
|
138
200
|
);
|
|
139
201
|
}
|
|
140
202
|
|
|
@@ -144,21 +206,29 @@ int main(void)
|
|
|
144
206
|
|
|
145
207
|
RUN_TEST(test_stating_something);
|
|
146
208
|
RUN_TEST(test_shouting);
|
|
209
|
+
RUN_TEST(test_shouting_gibberish);
|
|
147
210
|
RUN_TEST(test_asking_a_question);
|
|
211
|
+
RUN_TEST(test_asking_a_numeric_question);
|
|
212
|
+
RUN_TEST(test_asking_gibberish);
|
|
148
213
|
RUN_TEST(test_talking_forcefully);
|
|
149
214
|
RUN_TEST(test_using_acronyms_in_regular_speech);
|
|
150
|
-
RUN_TEST(
|
|
215
|
+
RUN_TEST(test_forceful_question);
|
|
151
216
|
RUN_TEST(test_shouting_numbers);
|
|
152
217
|
RUN_TEST(test_only_numbers);
|
|
153
218
|
RUN_TEST(test_question_with_only_numbers);
|
|
154
219
|
RUN_TEST(test_shouting_with_special_characters);
|
|
155
220
|
RUN_TEST(test_shouting_with_no_exclamation_mark);
|
|
156
221
|
RUN_TEST(test_statement_containing_question_mark);
|
|
222
|
+
RUN_TEST(test_non_letters_with_question);
|
|
157
223
|
RUN_TEST(test_prattling_on);
|
|
158
|
-
RUN_TEST(test_question_with_trailing_whitespace);
|
|
159
224
|
RUN_TEST(test_silence);
|
|
160
225
|
RUN_TEST(test_prolonged_silence);
|
|
161
|
-
RUN_TEST(
|
|
226
|
+
RUN_TEST(test_alternate_silence);
|
|
227
|
+
RUN_TEST(test_multiple_line_question);
|
|
228
|
+
RUN_TEST(test_starting_with_whitespace);
|
|
229
|
+
RUN_TEST(test_ending_with_whitespace);
|
|
230
|
+
RUN_TEST(test_other_whitespace);
|
|
231
|
+
RUN_TEST(test_non_question_ending_with_whitespace);
|
|
162
232
|
|
|
163
233
|
UnityEnd();
|
|
164
234
|
return 0;
|
|
@@ -1,36 +1,109 @@
|
|
|
1
1
|
#include "palindrome_products.h"
|
|
2
|
-
#include <
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <stdio.h>
|
|
4
|
+
#include <limits.h>
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
static int palindrome(int n);
|
|
7
|
+
static int addfactors(factor_t ** p, int i, int k);
|
|
8
|
+
static void free_ll(struct factors *p);
|
|
9
|
+
|
|
10
|
+
product_t *get_palindrome_product(int from, int to)
|
|
6
11
|
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
prod /= 10;
|
|
12
|
+
product_t *res = malloc(sizeof(product_t));
|
|
13
|
+
if (res == NULL) {
|
|
14
|
+
fprintf(stderr, "Memory error!\n");
|
|
15
|
+
return NULL;
|
|
12
16
|
}
|
|
13
|
-
return (a * b) == ret;
|
|
14
|
-
}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
res->error[MAXERR - 1] = '\0';
|
|
19
|
+
res->smallest = INT_MAX;
|
|
20
|
+
res->largest = INT_MIN;
|
|
21
|
+
res->factors_lg = NULL;
|
|
22
|
+
res->factors_sm = NULL;
|
|
23
|
+
|
|
24
|
+
if (from > to) {
|
|
25
|
+
snprintf(res->error, MAXERR - 1,
|
|
26
|
+
"invalid input: min is %i and max is %i", from, to);
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
int i, k, n;
|
|
31
|
+
int err = 0;
|
|
32
|
+
for (i = from; i <= to; i++)
|
|
33
|
+
for (k = i; k <= to; k++)
|
|
34
|
+
if (palindrome(n = i * k)) {
|
|
35
|
+
if (n <= res->smallest) {
|
|
36
|
+
res->smallest = n;
|
|
37
|
+
err = addfactors(&res->factors_sm, i, k);
|
|
38
|
+
} else if (n >= res->largest) {
|
|
39
|
+
res->largest = n;
|
|
40
|
+
err = addfactors(&res->factors_lg, i, k);
|
|
41
|
+
}
|
|
42
|
+
if (err) {
|
|
43
|
+
free(res);
|
|
44
|
+
return NULL;
|
|
31
45
|
}
|
|
32
46
|
}
|
|
33
|
-
|
|
47
|
+
|
|
48
|
+
if ((res->smallest == INT_MAX) || (res->largest == INT_MIN)) {
|
|
49
|
+
snprintf(res->error, MAXERR - 1,
|
|
50
|
+
"no palindrome with factors in the range %i to %i", from, to);
|
|
51
|
+
return res;
|
|
34
52
|
}
|
|
35
|
-
return
|
|
53
|
+
return res;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void free_product(product_t * p)
|
|
57
|
+
{
|
|
58
|
+
if (p == NULL)
|
|
59
|
+
return;
|
|
60
|
+
free_ll(p->factors_lg);
|
|
61
|
+
free_ll(p->factors_sm);
|
|
62
|
+
free(p);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static void free_ll(struct factors *p)
|
|
66
|
+
{
|
|
67
|
+
if (p == NULL)
|
|
68
|
+
return;
|
|
69
|
+
if (p->next != NULL)
|
|
70
|
+
free_ll(p->next);
|
|
71
|
+
free(p);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static int addfactors(factor_t ** p, int i, int k)
|
|
75
|
+
{
|
|
76
|
+
int n = i * k;
|
|
77
|
+
if ((*p == NULL) || (((*p)->factor_a) * (*p)->factor_b != n)) {
|
|
78
|
+
free_ll(*p);
|
|
79
|
+
*p = NULL;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
factor_t *tmp = malloc(sizeof(factor_t));
|
|
83
|
+
if (tmp == NULL) {
|
|
84
|
+
fprintf(stderr, "Memory error!\n");
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
tmp->next = *p;
|
|
89
|
+
tmp->factor_a = i;
|
|
90
|
+
tmp->factor_b = k;
|
|
91
|
+
*p = tmp;
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static int palindrome(int n)
|
|
96
|
+
{
|
|
97
|
+
if (n < 0)
|
|
98
|
+
n *= -1;
|
|
99
|
+
int r = 0;
|
|
100
|
+
int nn = n;
|
|
101
|
+
|
|
102
|
+
/* inverse n in r */
|
|
103
|
+
while (n >= 1) {
|
|
104
|
+
r = (r * 10) + (n % 10);
|
|
105
|
+
n /= 10;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (nn == r);
|
|
36
109
|
}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
#ifndef PALINDROME_PRODUCTS_H
|
|
2
2
|
#define PALINDROME_PRODUCTS_H
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
#define MAXERR 100
|
|
5
|
+
|
|
6
|
+
struct factors {
|
|
7
|
+
int factor_a;
|
|
8
|
+
int factor_b;
|
|
9
|
+
struct factors *next;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
typedef struct factors factor_t;
|
|
13
|
+
|
|
14
|
+
struct product {
|
|
5
15
|
int smallest;
|
|
6
16
|
int largest;
|
|
7
|
-
|
|
17
|
+
factor_t *factors_sm;
|
|
18
|
+
factor_t *factors_lg;
|
|
19
|
+
char error[MAXERR];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
typedef struct product product_t;
|
|
8
23
|
|
|
9
|
-
|
|
10
|
-
|
|
24
|
+
product_t *get_palindrome_product(int from, int to);
|
|
25
|
+
void free_product(product_t * p);
|
|
11
26
|
|
|
12
27
|
#endif
|
|
@@ -9,27 +9,195 @@ void tearDown(void)
|
|
|
9
9
|
{
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
void
|
|
12
|
+
void check_factors(factor_t * actual, int depth, factor_t expected[])
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (depth == 0) {
|
|
15
|
+
TEST_ASSERT_EQUAL_PTR(NULL, actual);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
int i;
|
|
19
|
+
int count_ok = 0;
|
|
20
|
+
for (i = 0; i < depth; i++) {
|
|
21
|
+
if (actual == NULL)
|
|
22
|
+
break;
|
|
23
|
+
if ((actual->factor_a == expected[i].factor_a) &&
|
|
24
|
+
(actual->factor_b == expected[i].factor_b))
|
|
25
|
+
count_ok++;
|
|
26
|
+
actual = actual->next;
|
|
27
|
+
}
|
|
28
|
+
TEST_ASSERT_EQUAL_PTR(NULL, actual);
|
|
29
|
+
TEST_ASSERT_EQUAL_INT(depth, count_ok);
|
|
17
30
|
}
|
|
18
31
|
|
|
19
|
-
void
|
|
32
|
+
void test_smallest_palindrome_from_single_digit_factors(void)
|
|
33
|
+
{
|
|
34
|
+
product_t *product = get_palindrome_product(1, 9);
|
|
35
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
36
|
+
TEST_ASSERT_EQUAL_INT(1, product->smallest);
|
|
37
|
+
|
|
38
|
+
factor_t expected_sm[] = { {1, 1, NULL} };
|
|
39
|
+
check_factors(product->factors_sm, 1, expected_sm);
|
|
40
|
+
|
|
41
|
+
free_product(product);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void test_largest_palindrome_from_single_digit_factors(void)
|
|
45
|
+
{
|
|
46
|
+
TEST_IGNORE(); // delete this line to run test
|
|
47
|
+
product_t *product = get_palindrome_product(1, 9);
|
|
48
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
49
|
+
TEST_ASSERT_EQUAL_INT(9, product->largest);
|
|
50
|
+
|
|
51
|
+
factor_t expected_lg[] = { {3, 3, NULL}, {1, 9, NULL} };
|
|
52
|
+
check_factors(product->factors_lg, 2, expected_lg);
|
|
53
|
+
|
|
54
|
+
free_product(product);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void test_smallest_palindrome_from_double_digit_factors(void)
|
|
58
|
+
{
|
|
59
|
+
TEST_IGNORE(); // delete this line to run test
|
|
60
|
+
product_t *product = get_palindrome_product(10, 99);
|
|
61
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
62
|
+
TEST_ASSERT_EQUAL_INT(121, product->smallest);
|
|
63
|
+
|
|
64
|
+
factor_t expected_sm[] = { {11, 11, NULL} };
|
|
65
|
+
check_factors(product->factors_sm, 1, expected_sm);
|
|
66
|
+
|
|
67
|
+
free_product(product);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void test_largest_palindrome_from_double_digit_factors(void)
|
|
71
|
+
{
|
|
72
|
+
TEST_IGNORE(); // delete this line to run test
|
|
73
|
+
product_t *product = get_palindrome_product(10, 99);
|
|
74
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
75
|
+
TEST_ASSERT_EQUAL_INT(9009, product->largest);
|
|
76
|
+
|
|
77
|
+
factor_t expected_lg[] = { {91, 99, NULL} };
|
|
78
|
+
check_factors(product->factors_lg, 1, expected_lg);
|
|
79
|
+
|
|
80
|
+
free_product(product);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
void test_smallest_palindrome_from_triple_digit_factors(void)
|
|
84
|
+
{
|
|
85
|
+
TEST_IGNORE(); // delete this line to run test
|
|
86
|
+
product_t *product = get_palindrome_product(100, 999);
|
|
87
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
88
|
+
TEST_ASSERT_EQUAL_INT(10201, product->smallest);
|
|
89
|
+
|
|
90
|
+
factor_t expected_sm[] = { {101, 101, NULL} };
|
|
91
|
+
check_factors(product->factors_sm, 1, expected_sm);
|
|
92
|
+
|
|
93
|
+
free_product(product);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void test_largest_palindrome_from_triple_digit_factors(void)
|
|
97
|
+
{
|
|
98
|
+
TEST_IGNORE(); // delete this line to run test
|
|
99
|
+
product_t *product = get_palindrome_product(100, 999);
|
|
100
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
101
|
+
TEST_ASSERT_EQUAL_INT(906609, product->largest);
|
|
102
|
+
|
|
103
|
+
factor_t expected_lg[] = { {913, 993, NULL} };
|
|
104
|
+
check_factors(product->factors_lg, 1, expected_lg);
|
|
105
|
+
|
|
106
|
+
free_product(product);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void test_smallest_palindrome_from_four_digit_factors(void)
|
|
110
|
+
{
|
|
111
|
+
TEST_IGNORE(); // delete this line to run test
|
|
112
|
+
product_t *product = get_palindrome_product(1000, 9999);
|
|
113
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
114
|
+
TEST_ASSERT_EQUAL_INT(1002001, product->smallest);
|
|
115
|
+
|
|
116
|
+
factor_t expected_sm[] = { {1001, 1001, NULL} };
|
|
117
|
+
check_factors(product->factors_sm, 1, expected_sm);
|
|
118
|
+
|
|
119
|
+
free_product(product);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
void test_largest_palindrome_from_four_digit_factors(void)
|
|
123
|
+
{
|
|
124
|
+
TEST_IGNORE(); // delete this line to run test
|
|
125
|
+
product_t *product = get_palindrome_product(1000, 9999);
|
|
126
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
127
|
+
TEST_ASSERT_EQUAL_INT(99000099, product->largest);
|
|
128
|
+
|
|
129
|
+
factor_t expected_lg[] = { {9901, 9999, NULL} };
|
|
130
|
+
check_factors(product->factors_lg, 1, expected_lg);
|
|
131
|
+
|
|
132
|
+
free_product(product);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
void test_empty_result_for_smallest_if_no_palindrome_in_the_range(void)
|
|
136
|
+
{
|
|
137
|
+
TEST_IGNORE(); // delete this line to run test
|
|
138
|
+
product_t *product = get_palindrome_product(1002, 1003);
|
|
139
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
140
|
+
const char *expected =
|
|
141
|
+
"no palindrome with factors in the range 1002 to 1003";
|
|
142
|
+
TEST_ASSERT_EQUAL_STRING(expected, product->error);
|
|
143
|
+
|
|
144
|
+
free_product(product);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
void test_empty_result_for_largest_if_no_palindrome_in_the_range(void)
|
|
20
148
|
{
|
|
21
149
|
TEST_IGNORE(); // delete this line to run test
|
|
22
|
-
product_t product = get_palindrome_product(
|
|
23
|
-
|
|
24
|
-
|
|
150
|
+
product_t *product = get_palindrome_product(15, 15);
|
|
151
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
152
|
+
const char *expected = "no palindrome with factors in the range 15 to 15";
|
|
153
|
+
TEST_ASSERT_EQUAL_STRING(expected, product->error);
|
|
154
|
+
|
|
155
|
+
free_product(product);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
void test_error_result_for_smallest_if_min_is_more_than_max(void)
|
|
159
|
+
{
|
|
160
|
+
TEST_IGNORE(); // delete this line to run test
|
|
161
|
+
product_t *product = get_palindrome_product(10000, 1);
|
|
162
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
163
|
+
const char *expected = "invalid input: min is 10000 and max is 1";
|
|
164
|
+
TEST_ASSERT_EQUAL_STRING(expected, product->error);
|
|
165
|
+
|
|
166
|
+
free_product(product);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
void test_error_result_for_largest_if_min_is_more_than_max(void)
|
|
170
|
+
{
|
|
171
|
+
TEST_IGNORE(); // delete this line to run test
|
|
172
|
+
product_t *product = get_palindrome_product(2, 1);
|
|
173
|
+
TEST_ASSERT_NOT_NULL(product);
|
|
174
|
+
const char *expected = "invalid input: min is 2 and max is 1";
|
|
175
|
+
TEST_ASSERT_EQUAL_STRING(expected, product->error);
|
|
176
|
+
|
|
177
|
+
free_product(product);
|
|
25
178
|
}
|
|
26
179
|
|
|
27
180
|
int main(void)
|
|
28
181
|
{
|
|
29
182
|
UnityBegin("test/test_palindrome_products.c");
|
|
30
183
|
|
|
31
|
-
RUN_TEST(
|
|
32
|
-
RUN_TEST(
|
|
184
|
+
RUN_TEST(test_smallest_palindrome_from_single_digit_factors);
|
|
185
|
+
RUN_TEST(test_largest_palindrome_from_single_digit_factors);
|
|
186
|
+
|
|
187
|
+
RUN_TEST(test_smallest_palindrome_from_double_digit_factors);
|
|
188
|
+
RUN_TEST(test_largest_palindrome_from_double_digit_factors);
|
|
189
|
+
|
|
190
|
+
RUN_TEST(test_smallest_palindrome_from_triple_digit_factors);
|
|
191
|
+
RUN_TEST(test_largest_palindrome_from_triple_digit_factors);
|
|
192
|
+
|
|
193
|
+
RUN_TEST(test_smallest_palindrome_from_four_digit_factors);
|
|
194
|
+
RUN_TEST(test_largest_palindrome_from_four_digit_factors);
|
|
195
|
+
|
|
196
|
+
RUN_TEST(test_empty_result_for_smallest_if_no_palindrome_in_the_range);
|
|
197
|
+
RUN_TEST(test_empty_result_for_largest_if_no_palindrome_in_the_range);
|
|
198
|
+
|
|
199
|
+
RUN_TEST(test_error_result_for_smallest_if_min_is_more_than_max);
|
|
200
|
+
RUN_TEST(test_error_result_for_largest_if_min_is_more_than_max);
|
|
33
201
|
|
|
34
202
|
UnityEnd();
|
|
35
203
|
return 0;
|
|
@@ -6,6 +6,8 @@ Bob answers 'Sure.' if you ask him a question.
|
|
|
6
6
|
|
|
7
7
|
He answers 'Whoa, chill out!' if you yell at him.
|
|
8
8
|
|
|
9
|
+
He answers 'Calm down, I know what I'm doing!' if you yell a question at him.
|
|
10
|
+
|
|
9
11
|
He says 'Fine. Be that way!' if you address him without actually saying
|
|
10
12
|
anything.
|
|
11
13
|
|
|
@@ -12,9 +12,18 @@
|
|
|
12
12
|
(define-test responds-to-shouts
|
|
13
13
|
(assert-equal "Whoa, chill out!" (bob:response-for "WATCH OUT!")))
|
|
14
14
|
|
|
15
|
+
(define-test shouting-gibberish
|
|
16
|
+
(assert-equal "Whoa, chill out!" (bob:response-for "FCECDFCAAB")))
|
|
17
|
+
|
|
15
18
|
(define-test responds-to-questions
|
|
16
19
|
(assert-equal "Sure." (bob:response-for "Does this cryogenic chamber make me look fat?")))
|
|
17
20
|
|
|
21
|
+
(define-test asking-a-numeric-question
|
|
22
|
+
(assert-equal "Sure." (bob:response-for "You are, what, like 15?")))
|
|
23
|
+
|
|
24
|
+
(define-test asking-gibberish
|
|
25
|
+
(assert-equal "Sure." (bob:response-for "fffbbcbeab?")))
|
|
26
|
+
|
|
18
27
|
(define-test responds-to-forceful-talking
|
|
19
28
|
(assert-equal "Whatever." (bob:response-for "Let's go make out behind the gym!")))
|
|
20
29
|
|
|
@@ -22,31 +31,59 @@
|
|
|
22
31
|
(assert-equal "Whatever." (bob:response-for "It's OK if you don't want to go to the DMV.")))
|
|
23
32
|
|
|
24
33
|
(define-test responds-to-forceful-questions
|
|
25
|
-
(assert-equal "
|
|
26
|
-
|
|
27
|
-
(define-test responds-to-shouting-with-special-characters
|
|
28
|
-
(assert-equal "Whoa, chill out!" (bob:response-for "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")))
|
|
34
|
+
(assert-equal "Calm down, I know what I'm doing!"
|
|
35
|
+
(bob:response-for "WHAT THE HELL WERE YOU THINKING?")))
|
|
29
36
|
|
|
30
37
|
(define-test responds-to-shouting-numbers
|
|
31
38
|
(assert-equal "Whoa, chill out!" (bob:response-for "1, 2, 3 GO!")))
|
|
32
39
|
|
|
40
|
+
(define-test responds-to-only-numbers
|
|
41
|
+
(assert-equal "Whatever." (bob:response-for "1, 2, 3")))
|
|
42
|
+
|
|
43
|
+
(define-test responds-to-number-question
|
|
44
|
+
(assert-equal "Sure." (bob:response-for "4?")))
|
|
45
|
+
|
|
46
|
+
(define-test responds-to-shouting-with-special-characters
|
|
47
|
+
(assert-equal "Whoa, chill out!" (bob:response-for "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!")))
|
|
48
|
+
|
|
33
49
|
(define-test responds-to-shouting-with-no-exclamation-mark
|
|
34
50
|
(assert-equal "Whoa, chill out!" (bob:response-for "I HATE YOU")))
|
|
35
51
|
|
|
36
52
|
(define-test responds-to-statement-containing-question-mark
|
|
37
53
|
(assert-equal "Whatever." (bob:response-for "Ending with ? means a question.")))
|
|
38
54
|
|
|
55
|
+
(define-test non-letters-with-question
|
|
56
|
+
(assert-equal "Sure." (bob:response-for ":) ?")))
|
|
57
|
+
|
|
58
|
+
(define-test prattling-ton
|
|
59
|
+
(assert-equal "Sure." (bob:response-for "Wait! Hang on. Are you going to be OK?")))
|
|
60
|
+
|
|
39
61
|
(define-test responds-to-silence
|
|
40
62
|
(assert-equal "Fine. Be that way!" (bob:response-for "")))
|
|
41
63
|
|
|
42
64
|
(define-test responds-to-prolonged-silence
|
|
43
65
|
(assert-equal "Fine. Be that way!" (bob:response-for " ")))
|
|
44
66
|
|
|
45
|
-
(define-test responds-to-
|
|
46
|
-
(assert-equal "
|
|
67
|
+
(define-test responds-to-alternate-silence
|
|
68
|
+
(assert-equal "Fine. Be that way!"
|
|
69
|
+
(bob:response-for (coerce (list #\Tab #\Tab #\Tab #\Tab) 'string))))
|
|
47
70
|
|
|
48
|
-
(define-test
|
|
49
|
-
(assert-equal "
|
|
71
|
+
(define-test respond-to-multiline-question
|
|
72
|
+
(assert-equal "Whatever."
|
|
73
|
+
(bob:response-for (format nil "~%Does this cryogenic chamber make me look fat?~%no"))))
|
|
74
|
+
|
|
75
|
+
(define-test starting-with-whitespace
|
|
76
|
+
(assert-equal "Whatever." (bob:response-for " hmmmmmmm...")))
|
|
77
|
+
|
|
78
|
+
(define-test ending-with-whitespace
|
|
79
|
+
(assert-equal "Sure." (bob:response-for "Okay if like my spacebar quite a bit? ")))
|
|
80
|
+
|
|
81
|
+
(define-test other-whitespace
|
|
82
|
+
(assert-equal "Fine. Be that way!"
|
|
83
|
+
(bob:response-for (coerce (list #\Newline #\Tab #\Page) 'string))))
|
|
84
|
+
|
|
85
|
+
(define-test non-question-ending-with-whitespace
|
|
86
|
+
(assert-equal "Whatever." (bob:response-for "This is a statement ending with whitespace ")))
|
|
50
87
|
|
|
51
88
|
#-xlisp-test
|
|
52
89
|
(let ((*print-errors* t)
|