trackler 2.2.1.40 → 2.2.1.41
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/.gitmodules +3 -0
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/dot-dsl/metadata.yml +1 -0
- data/problem-specifications/exercises/etl/metadata.yml +1 -0
- data/problem-specifications/exercises/isogram/canonical-data.json +3 -3
- data/problem-specifications/exercises/ocr-numbers/metadata.yml +1 -0
- data/problem-specifications/exercises/pascals-triangle/metadata.yml +1 -0
- data/problem-specifications/exercises/pov/metadata.yml +1 -0
- data/problem-specifications/exercises/rna-transcription/metadata.yml +1 -0
- data/problem-specifications/exercises/sgf-parsing/metadata.yml +1 -0
- data/tracks/c/exercises/all-your-base/src/example.c +14 -14
- data/tracks/c/exercises/all-your-base/src/example.h +2 -2
- data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +1 -1
- data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/{RNAtest.ceylon → RNATest.ceylon} +0 -0
- data/tracks/cfml/.git +1 -0
- data/tracks/cfml/.gitignore +5 -0
- data/tracks/cfml/.travis.yml +18 -0
- data/tracks/cfml/CONTRIBUTING.md +10 -0
- data/tracks/cfml/LICENSE +21 -0
- data/tracks/cfml/README.md +92 -0
- data/tracks/cfml/bin/fetch-configlet +32 -0
- data/tracks/cfml/config/exercise_readme.go.tmpl +16 -0
- data/tracks/cfml/config/maintainers.json +13 -0
- data/tracks/cfml/config.json +223 -0
- data/tracks/cfml/docs/ABOUT.md +10 -0
- data/tracks/cfml/docs/EXERCISE_README_INSERT.md +15 -0
- data/tracks/cfml/docs/INSTALLATION.md +35 -0
- data/tracks/cfml/docs/LEARNING.md +37 -0
- data/tracks/cfml/docs/RESOURCES.md +29 -0
- data/tracks/cfml/docs/SNIPPET.txt +8 -0
- data/tracks/cfml/docs/TESTS.md +13 -0
- data/tracks/cfml/exercises/acronym/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/acronym/Acronym.cfc +13 -0
- data/tracks/cfml/exercises/acronym/AcronymTest.cfc +43 -0
- data/tracks/cfml/exercises/acronym/Solution.cfc +22 -0
- data/tracks/cfml/exercises/acronym/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/acronym/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/acronym/box.json +8 -0
- data/tracks/cfml/exercises/acronym/index.cfm +37 -0
- data/tracks/cfml/exercises/atbash-cipher/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/atbash-cipher/AtbashCipher.cfc +14 -0
- data/tracks/cfml/exercises/atbash-cipher/AtbashCipherTest.cfc +71 -0
- data/tracks/cfml/exercises/atbash-cipher/Solution.cfc +56 -0
- data/tracks/cfml/exercises/atbash-cipher/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/atbash-cipher/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/atbash-cipher/box.json +8 -0
- data/tracks/cfml/exercises/atbash-cipher/index.cfm +37 -0
- data/tracks/cfml/exercises/bob/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/bob/Bob.cfc +13 -0
- data/tracks/cfml/exercises/bob/BobTest.cfc +115 -0
- data/tracks/cfml/exercises/bob/Solution.cfc +27 -0
- data/tracks/cfml/exercises/bob/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/bob/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/bob/box.json +8 -0
- data/tracks/cfml/exercises/bob/index.cfm +37 -0
- data/tracks/cfml/exercises/diamond/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/diamond/Diamond.cfc +13 -0
- data/tracks/cfml/exercises/diamond/DiamondTest.cfc +35 -0
- data/tracks/cfml/exercises/diamond/Solution.cfc +35 -0
- data/tracks/cfml/exercises/diamond/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/diamond/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/diamond/box.json +8 -0
- data/tracks/cfml/exercises/diamond/index.cfm +37 -0
- data/tracks/cfml/exercises/difference-of-squares/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/difference-of-squares/DifferenceOfSquares.cfc +18 -0
- data/tracks/cfml/exercises/difference-of-squares/DifferenceOfSquaresTest.cfc +63 -0
- data/tracks/cfml/exercises/difference-of-squares/Solution.cfc +28 -0
- data/tracks/cfml/exercises/difference-of-squares/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/difference-of-squares/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/difference-of-squares/box.json +8 -0
- data/tracks/cfml/exercises/difference-of-squares/index.cfm +37 -0
- data/tracks/cfml/exercises/flatten-array/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/flatten-array/FlattenArray.cfc +13 -0
- data/tracks/cfml/exercises/flatten-array/FlattenArrayTest.cfc +42 -0
- data/tracks/cfml/exercises/flatten-array/Solution.cfc +26 -0
- data/tracks/cfml/exercises/flatten-array/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/flatten-array/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/flatten-array/box.json +8 -0
- data/tracks/cfml/exercises/flatten-array/index.cfm +37 -0
- data/tracks/cfml/exercises/gigasecond/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/gigasecond/Gigasecond.cfc +13 -0
- data/tracks/cfml/exercises/gigasecond/GigasecondTest.cfc +39 -0
- data/tracks/cfml/exercises/gigasecond/Solution.cfc +16 -0
- data/tracks/cfml/exercises/gigasecond/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/gigasecond/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/gigasecond/box.json +8 -0
- data/tracks/cfml/exercises/gigasecond/index.cfm +37 -0
- data/tracks/cfml/exercises/grains/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/grains/Grains.cfc +14 -0
- data/tracks/cfml/exercises/grains/GrainsTest.cfc +63 -0
- data/tracks/cfml/exercises/grains/Solution.cfc +22 -0
- data/tracks/cfml/exercises/grains/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/grains/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/grains/box.json +8 -0
- data/tracks/cfml/exercises/grains/index.cfm +37 -0
- data/tracks/cfml/exercises/hamming/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/hamming/Hamming.cfc +13 -0
- data/tracks/cfml/exercises/hamming/HammingTest.cfc +75 -0
- data/tracks/cfml/exercises/hamming/Solution.cfc +25 -0
- data/tracks/cfml/exercises/hamming/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/hamming/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/hamming/box.json +8 -0
- data/tracks/cfml/exercises/hamming/index.cfm +37 -0
- data/tracks/cfml/exercises/hello-world/HelloWorld.cfc +13 -0
- data/tracks/cfml/exercises/hello-world/HelloWorldTest.cfc +18 -0
- data/tracks/cfml/exercises/hello-world/Solution.cfc +13 -0
- data/tracks/cfml/exercises/hello-world/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/hello-world/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/hello-world/box.json +8 -0
- data/tracks/cfml/exercises/hello-world/index.cfm +37 -0
- data/tracks/cfml/exercises/isogram/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/isogram/Isogram.cfc +13 -0
- data/tracks/cfml/exercises/isogram/IsogramTest.cfc +55 -0
- data/tracks/cfml/exercises/isogram/Solution.cfc +23 -0
- data/tracks/cfml/exercises/isogram/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/isogram/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/isogram/box.json +8 -0
- data/tracks/cfml/exercises/isogram/index.cfm +37 -0
- data/tracks/cfml/exercises/largest-series-product/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/largest-series-product/LargestSeriesProduct.cfc +13 -0
- data/tracks/cfml/exercises/largest-series-product/LargestSeriesProductTest.cfc +75 -0
- data/tracks/cfml/exercises/largest-series-product/Solution.cfc +41 -0
- data/tracks/cfml/exercises/largest-series-product/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/largest-series-product/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/largest-series-product/box.json +8 -0
- data/tracks/cfml/exercises/largest-series-product/index.cfm +37 -0
- data/tracks/cfml/exercises/leap/Leap.cfc +15 -0
- data/tracks/cfml/exercises/leap/LeapTest.cfc +39 -0
- data/tracks/cfml/exercises/leap/README.md +33 -0
- data/tracks/cfml/exercises/leap/Solution.cfc +19 -0
- data/tracks/cfml/exercises/leap/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/leap/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/leap/box.json +8 -0
- data/tracks/cfml/exercises/leap/index.cfm +37 -0
- data/tracks/cfml/exercises/luhn/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/luhn/Luhn.cfc +13 -0
- data/tracks/cfml/exercises/luhn/LuhnTest.cfc +67 -0
- data/tracks/cfml/exercises/luhn/Solution.cfc +38 -0
- data/tracks/cfml/exercises/luhn/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/luhn/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/luhn/box.json +8 -0
- data/tracks/cfml/exercises/luhn/index.cfm +37 -0
- data/tracks/cfml/exercises/nth-prime/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/nth-prime/NthPrime.cfc +13 -0
- data/tracks/cfml/exercises/nth-prime/NthPrimeTest.cfc +35 -0
- data/tracks/cfml/exercises/nth-prime/Solution.cfc +33 -0
- data/tracks/cfml/exercises/nth-prime/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/nth-prime/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/nth-prime/box.json +8 -0
- data/tracks/cfml/exercises/nth-prime/index.cfm +37 -0
- data/tracks/cfml/exercises/pangram/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/pangram/Pangram.cfc +13 -0
- data/tracks/cfml/exercises/pangram/PangramTest.cfc +55 -0
- data/tracks/cfml/exercises/pangram/Solution.cfc +21 -0
- data/tracks/cfml/exercises/pangram/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/pangram/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/pangram/box.json +8 -0
- data/tracks/cfml/exercises/pangram/index.cfm +37 -0
- data/tracks/cfml/exercises/pig-latin/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/pig-latin/PigLatin.cfc +13 -0
- data/tracks/cfml/exercises/pig-latin/PigLatinTest.cfc +115 -0
- data/tracks/cfml/exercises/pig-latin/Solution.cfc +30 -0
- data/tracks/cfml/exercises/pig-latin/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/pig-latin/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/pig-latin/box.json +8 -0
- data/tracks/cfml/exercises/pig-latin/index.cfm +37 -0
- data/tracks/cfml/exercises/raindrops/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/raindrops/Raindrops.cfc +13 -0
- data/tracks/cfml/exercises/raindrops/RaindropsTest.cfc +87 -0
- data/tracks/cfml/exercises/raindrops/Solution.cfc +33 -0
- data/tracks/cfml/exercises/raindrops/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/raindrops/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/raindrops/box.json +8 -0
- data/tracks/cfml/exercises/raindrops/index.cfm +37 -0
- data/tracks/cfml/exercises/rna-transcription/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/rna-transcription/RnaTranscription.cfc +13 -0
- data/tracks/cfml/exercises/rna-transcription/RnaTranscriptionTest.cfc +47 -0
- data/tracks/cfml/exercises/rna-transcription/Solution.cfc +35 -0
- data/tracks/cfml/exercises/rna-transcription/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/rna-transcription/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/rna-transcription/box.json +8 -0
- data/tracks/cfml/exercises/rna-transcription/index.cfm +37 -0
- data/tracks/cfml/exercises/saddle-points/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/saddle-points/SaddlePoints.cfc +13 -0
- data/tracks/cfml/exercises/saddle-points/SaddlePointsTest.cfc +35 -0
- data/tracks/cfml/exercises/saddle-points/Solution.cfc +59 -0
- data/tracks/cfml/exercises/saddle-points/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/saddle-points/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/saddle-points/box.json +8 -0
- data/tracks/cfml/exercises/saddle-points/index.cfm +37 -0
- data/tracks/cfml/exercises/scrabble-score/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/scrabble-score/ScrabbleScore.cfc +13 -0
- data/tracks/cfml/exercises/scrabble-score/ScrabbleScoreTest.cfc +59 -0
- data/tracks/cfml/exercises/scrabble-score/Solution.cfc +50 -0
- data/tracks/cfml/exercises/scrabble-score/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/scrabble-score/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/scrabble-score/box.json +8 -0
- data/tracks/cfml/exercises/scrabble-score/index.cfm +37 -0
- data/tracks/cfml/exercises/secret-handshake/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/secret-handshake/SecretHandshake.cfc +13 -0
- data/tracks/cfml/exercises/secret-handshake/SecretHandshakeTest.cfc +63 -0
- data/tracks/cfml/exercises/secret-handshake/Solution.cfc +31 -0
- data/tracks/cfml/exercises/secret-handshake/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/secret-handshake/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/secret-handshake/box.json +8 -0
- data/tracks/cfml/exercises/secret-handshake/index.cfm +37 -0
- data/tracks/cfml/exercises/space-age/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/space-age/Solution.cfc +28 -0
- data/tracks/cfml/exercises/space-age/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/space-age/SpaceAge.cfc +13 -0
- data/tracks/cfml/exercises/space-age/SpaceAgeTest.cfc +47 -0
- data/tracks/cfml/exercises/space-age/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/space-age/box.json +8 -0
- data/tracks/cfml/exercises/space-age/index.cfm +37 -0
- data/tracks/cfml/exercises/sum-of-multiples/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/sum-of-multiples/Solution.cfc +27 -0
- data/tracks/cfml/exercises/sum-of-multiples/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/sum-of-multiples/SumOfMultiples.cfc +13 -0
- data/tracks/cfml/exercises/sum-of-multiples/SumOfMultiplesTest.cfc +63 -0
- data/tracks/cfml/exercises/sum-of-multiples/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/sum-of-multiples/box.json +8 -0
- data/tracks/cfml/exercises/sum-of-multiples/index.cfm +37 -0
- data/tracks/cfml/exercises/triangle/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/triangle/Solution.cfc +53 -0
- data/tracks/cfml/exercises/triangle/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/triangle/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/triangle/Triangle.cfc +18 -0
- data/tracks/cfml/exercises/triangle/TriangleTest.cfc +95 -0
- data/tracks/cfml/exercises/triangle/box.json +8 -0
- data/tracks/cfml/exercises/triangle/index.cfm +37 -0
- data/tracks/cfml/exercises/word-count/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/word-count/Solution.cfc +22 -0
- data/tracks/cfml/exercises/word-count/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/word-count/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/word-count/WordCount.cfc +13 -0
- data/tracks/cfml/exercises/word-count/WordCountTest.cfc +55 -0
- data/tracks/cfml/exercises/word-count/box.json +8 -0
- data/tracks/cfml/exercises/word-count/index.cfm +37 -0
- data/tracks/cfml/img/icon.png +0 -0
- data/tracks/cfml/tasks/GenerateTests.cfc +179 -0
- data/tracks/cfml/tasks/ScaffoldExercise.cfc +85 -0
- data/tracks/cfml/tasks/TestAllSolutions.cfc +24 -0
- data/tracks/cfml/tasks/exercise_template/.meta/HINTS.md +0 -0
- data/tracks/cfml/tasks/exercise_template/@@name@@.cfc +13 -0
- data/tracks/cfml/tasks/exercise_template/@@name@@Test.cfc +15 -0
- data/tracks/cfml/tasks/exercise_template/Solution.cfc +6 -0
- data/tracks/cfml/tasks/exercise_template/SolutionTest.cfc +7 -0
- data/tracks/cfml/tasks/exercise_template/TestRunner.cfc +103 -0
- data/tracks/cfml/tasks/exercise_template/box.json +8 -0
- data/tracks/cfml/tasks/exercise_template/index.cfm +37 -0
- data/tracks/coldfusion/docs/ABOUT.md +8 -6
- data/tracks/csharp/docs/GENERATORS.md +7 -0
- data/tracks/csharp/exercises/clock/ClockTest.cs +15 -15
- data/tracks/csharp/exercises/nucleotide-count/Example.cs +10 -11
- data/tracks/csharp/exercises/nucleotide-count/NucleotideCount.cs +2 -7
- data/tracks/csharp/exercises/nucleotide-count/NucleotideCountTest.cs +37 -47
- data/tracks/csharp/exercises/pig-latin/Example.cs +1 -1
- data/tracks/csharp/exercises/pig-latin/PigLatinTest.cs +19 -7
- data/tracks/csharp/exercises/sum-of-multiples/SumOfMultiplesTest.cs +7 -1
- data/tracks/csharp/exercises/tournament/Example.cs +1 -1
- data/tracks/csharp/exercises/tournament/TournamentTest.cs +151 -68
- data/tracks/csharp/exercises/triangle/Example.cs +26 -8
- data/tracks/csharp/exercises/triangle/Triangle.cs +16 -1
- data/tracks/csharp/exercises/triangle/TriangleTest.cs +44 -30
- data/tracks/csharp/generators/Exercise.cs +6 -1
- data/tracks/csharp/generators/Exercises/Clock.cs +17 -1
- data/tracks/csharp/generators/Exercises/NucleotideCount.cs +61 -0
- data/tracks/csharp/generators/Exercises/Tournament.cs +66 -0
- data/tracks/csharp/generators/Exercises/Triangle.cs +36 -0
- data/tracks/dart/config.json +15 -2
- data/tracks/dart/exercises/raindrops/lib/example.dart +23 -0
- data/tracks/dart/exercises/raindrops/lib/raindrops.dart +3 -0
- data/tracks/dart/exercises/raindrops/pubspec.lock +281 -0
- data/tracks/dart/exercises/raindrops/pubspec.yaml +3 -0
- data/tracks/dart/exercises/raindrops/test/raindrops_test.dart +94 -0
- data/tracks/delphi/exercises/pig-latin/uPigLatinExample.pas +1 -25
- data/tracks/haskell/config.json +9 -0
- data/tracks/haskell/exercises/acronym/README.md +0 -1
- data/tracks/haskell/exercises/all-your-base/README.md +1 -1
- data/tracks/haskell/exercises/allergies/README.md +0 -1
- data/tracks/haskell/exercises/alphametics/README.md +2 -2
- data/tracks/haskell/exercises/atbash-cipher/README.md +2 -1
- data/tracks/haskell/exercises/beer-song/README.md +1 -1
- data/tracks/haskell/exercises/binary/README.md +2 -0
- data/tracks/haskell/exercises/bowling/README.md +20 -6
- data/tracks/haskell/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/haskell/exercises/connect/README.md +1 -1
- data/tracks/haskell/exercises/crypto-square/README.md +4 -4
- data/tracks/haskell/exercises/diamond/README.md +113 -0
- data/tracks/haskell/exercises/diamond/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/diamond/examples/success-standard/src/Diamond.hs +16 -0
- data/tracks/haskell/exercises/diamond/package.yaml +20 -0
- data/tracks/haskell/exercises/diamond/src/Diamond.hs +4 -0
- data/tracks/haskell/exercises/diamond/stack.yaml +1 -0
- data/tracks/haskell/exercises/diamond/test/Tests.hs +109 -0
- data/tracks/haskell/exercises/etl/README.md +3 -1
- data/tracks/haskell/exercises/food-chain/README.md +1 -1
- data/tracks/haskell/exercises/go-counting/README.md +1 -1
- data/tracks/haskell/exercises/grade-school/README.md +0 -1
- data/tracks/haskell/exercises/grains/README.md +0 -1
- data/tracks/haskell/exercises/house/README.md +1 -2
- data/tracks/haskell/exercises/isogram/README.md +2 -1
- data/tracks/haskell/exercises/kindergarten-garden/README.md +3 -3
- data/tracks/haskell/exercises/leap/README.md +1 -1
- data/tracks/haskell/exercises/linked-list/README.md +10 -10
- data/tracks/haskell/exercises/luhn/README.md +7 -7
- data/tracks/haskell/exercises/matrix/README.md +6 -4
- data/tracks/haskell/exercises/meetup/README.md +1 -2
- data/tracks/haskell/exercises/nucleotide-count/README.md +8 -22
- data/tracks/haskell/exercises/ocr-numbers/README.md +6 -6
- data/tracks/haskell/exercises/octal/README.md +6 -2
- data/tracks/haskell/exercises/palindrome-products/README.md +12 -6
- data/tracks/haskell/exercises/pangram/README.md +1 -1
- data/tracks/haskell/exercises/pascals-triangle/README.md +2 -2
- data/tracks/haskell/exercises/phone-number/README.md +3 -2
- data/tracks/haskell/exercises/pov/README.md +3 -3
- data/tracks/haskell/exercises/pythagorean-triplet/README.md +3 -3
- data/tracks/haskell/exercises/queen-attack/README.md +1 -1
- data/tracks/haskell/exercises/rna-transcription/README.md +1 -1
- data/tracks/haskell/exercises/roman-numerals/README.md +1 -1
- data/tracks/haskell/exercises/run-length-encoding/README.md +4 -4
- data/tracks/haskell/exercises/saddle-points/README.md +1 -1
- data/tracks/haskell/exercises/scrabble-score/README.md +3 -1
- data/tracks/haskell/exercises/secret-handshake/README.md +1 -1
- data/tracks/haskell/exercises/sgf-parsing/README.md +4 -4
- data/tracks/haskell/exercises/simple-cipher/README.md +1 -1
- data/tracks/haskell/exercises/spiral-matrix/README.md +2 -2
- data/tracks/haskell/exercises/triangle/README.md +9 -6
- data/tracks/haskell/exercises/trinary/README.md +1 -1
- data/tracks/haskell/exercises/word-count/README.md +1 -2
- data/tracks/haskell/exercises/wordy/README.md +0 -5
- data/tracks/java/config.json +56 -9
- data/tracks/java/exercises/binary-search-tree/src/test/java/BSTTest.java +4 -4
- data/tracks/javascript/exercises/two-bucket/example.js +66 -69
- data/tracks/javascript/exercises/two-bucket/two-bucket.spec.js +18 -18
- data/tracks/julia/config.json +1 -0
- data/tracks/julia/docs/ABOUT.md +3 -8
- data/tracks/prolog/README.md +1 -1
- data/tracks/purescript/.travis.yml +1 -0
- data/tracks/purescript/README.md +9 -0
- data/tracks/purescript/bin/check-bower.sh +42 -0
- data/tracks/purescript/bin/test-separate.sh +46 -0
- data/tracks/python/README.md +2 -2
- data/tracks/python/exercises/all-your-base/all_your_base.py +2 -0
- data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +2 -2
- data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +2 -2
- data/tracks/python/exercises/complex-numbers/example.py +2 -2
- data/tracks/python/exercises/gigasecond/gigasecond.py +1 -1
- data/tracks/python/exercises/hamming/hamming.py +1 -1
- data/tracks/python/exercises/hexadecimal/hexadecimal.py +1 -1
- data/tracks/python/exercises/leap/leap.py +1 -1
- data/tracks/python/exercises/meetup/meetup.py +1 -1
- data/tracks/python/exercises/phone-number/example.py +4 -2
- data/tracks/python/exercises/phone-number/phone_number_test.py +47 -16
- data/tracks/python/exercises/pig-latin/pig_latin.py +1 -1
- data/tracks/python/exercises/scrabble-score/scrabble_score.py +1 -1
- data/tracks/python/exercises/wordy/wordy.py +1 -1
- data/tracks/scala/exercises/meetup/example.scala +29 -10
- data/tracks/scala/exercises/meetup/src/main/scala/Meetup.scala +23 -0
- data/tracks/scala/exercises/meetup/src/test/scala/MeetupTest.scala +273 -183
- data/tracks/sml/config.json +13 -0
- data/tracks/sml/exercises/anagram/README.md +21 -5
- data/tracks/sml/exercises/anagram/anagram.sml +2 -6
- data/tracks/sml/exercises/anagram/example.sml +29 -24
- data/tracks/sml/exercises/anagram/test.sml +56 -50
- data/tracks/sml/exercises/anagram/testlib.sml +159 -0
- data/tracks/sml/exercises/diamond/README.md +89 -0
- data/tracks/sml/exercises/diamond/diamond.sml +2 -0
- data/tracks/sml/exercises/diamond/example.sml +25 -0
- data/tracks/sml/exercises/diamond/test.sml +27 -0
- data/tracks/sml/exercises/diamond/testlib.sml +159 -0
- data/tracks/sml/exercises/raindrops/raindrops.sml +2 -2
- data/tracks/sml/exercises/raindrops/test.sml +66 -95
- data/tracks/sml/exercises/raindrops/testlib.sml +159 -0
- metadata +265 -3
|
@@ -1,89 +1,86 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function TwoBucket(
|
|
4
|
-
this.
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
3
|
+
function TwoBucket(bucketOne, bucketTwo, goal, startBucket) {
|
|
4
|
+
this.bucketOne = bucketOne;
|
|
5
|
+
this.bucketTwo = bucketTwo;
|
|
6
|
+
this.goal = goal;
|
|
7
|
+
this.startBucket = startBucket;
|
|
7
8
|
|
|
8
|
-
this.reachedGoal = function (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
this.reachedGoal = function (currentBucketOne, currentBucketTwo) {
|
|
10
|
+
return (currentBucketOne === goal || currentBucketTwo === goal);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
this.recordGoal = function (currentBucketOne, currentBucketTwo) {
|
|
14
|
+
if (currentBucketOne === goal) {
|
|
15
|
+
this.goalBucket = 'one';
|
|
16
|
+
this.otherBucket = currentBucketTwo;
|
|
17
|
+
} else {
|
|
18
|
+
this.goalBucket = 'two';
|
|
19
|
+
this.otherBucket = currentBucketOne;
|
|
19
20
|
}
|
|
20
|
-
return reached;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
this.bigFirst = function (
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} else if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
this.bigFirst = function (initialBucketOne, initialBucketTwo) {
|
|
24
|
+
var currentBucketOne = initialBucketOne;
|
|
25
|
+
var currentBucketTwo = initialBucketTwo;
|
|
26
|
+
var moveCount = 0;
|
|
27
|
+
var pourOrReceive = true;
|
|
28
|
+
while (!this.reachedGoal(currentBucketOne, currentBucketTwo)) {
|
|
29
|
+
if (currentBucketTwo > bucketOne && currentBucketOne === 0 && moveCount === 0) {
|
|
30
|
+
currentBucketOne = bucketOne;
|
|
31
|
+
currentBucketTwo = bucketTwo - currentBucketOne;
|
|
32
|
+
} else if (currentBucketOne === bucketOne) {
|
|
33
|
+
currentBucketOne = 0;
|
|
34
|
+
} else if ((currentBucketTwo > bucketOne && currentBucketOne !== 0) || (currentBucketTwo > bucketOne && pourOrReceive)) {
|
|
35
|
+
currentBucketTwo = currentBucketTwo - (bucketOne - currentBucketOne);
|
|
36
|
+
currentBucketOne = bucketOne;
|
|
37
|
+
} else if (currentBucketTwo > bucketOne || currentBucketOne === 0) {
|
|
38
|
+
currentBucketOne = currentBucketTwo;
|
|
39
|
+
currentBucketTwo = currentBucketTwo - currentBucketOne;
|
|
40
|
+
} else if (currentBucketTwo === 0) {
|
|
41
|
+
currentBucketTwo = bucketTwo;
|
|
40
42
|
}
|
|
41
|
-
measurements = [j, k];
|
|
42
43
|
moveCount++;
|
|
43
|
-
|
|
44
|
+
pourOrReceive ? pourOrReceive = false : pourOrReceive = true;
|
|
44
45
|
}
|
|
46
|
+
this.recordGoal(currentBucketOne, currentBucketTwo);
|
|
45
47
|
return moveCount;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
this.smallFirst = function (
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} else if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else if (
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
this.smallFirst = function (initialBucketOne, initialBucketTwo) {
|
|
51
|
+
var currentBucketOne = initialBucketOne;
|
|
52
|
+
var currentBucketTwo = initialBucketTwo;
|
|
53
|
+
var moveCount = 0;
|
|
54
|
+
var pourOrReceive = true;
|
|
55
|
+
while (!this.reachedGoal(currentBucketOne, currentBucketTwo)) {
|
|
56
|
+
if (currentBucketOne === bucketOne && moveCount === 0) {
|
|
57
|
+
currentBucketOne = 0;
|
|
58
|
+
currentBucketTwo = bucketOne;
|
|
59
|
+
} else if (currentBucketOne === 0) {
|
|
60
|
+
currentBucketOne = bucketOne;
|
|
61
|
+
} else if (currentBucketOne === bucketOne && currentBucketTwo < bucketTwo) {
|
|
62
|
+
var temp = currentBucketTwo;
|
|
63
|
+
currentBucketTwo + currentBucketOne > bucketTwo ? currentBucketTwo = bucketTwo : currentBucketTwo = temp + currentBucketOne;
|
|
64
|
+
temp + currentBucketOne > bucketTwo ? currentBucketOne = currentBucketOne - (bucketTwo - temp) : currentBucketOne = 0;
|
|
65
|
+
} else if (currentBucketTwo === bucketTwo) {
|
|
66
|
+
currentBucketTwo = 0;
|
|
67
|
+
} else if (currentBucketTwo === 0 && currentBucketOne < bucketOne) {
|
|
68
|
+
currentBucketTwo = currentBucketOne;
|
|
69
|
+
currentBucketOne = 0;
|
|
66
70
|
}
|
|
67
|
-
measurements = [j, k];
|
|
68
71
|
moveCount++;
|
|
69
|
-
|
|
72
|
+
pourOrReceive ? pourOrReceive = false : pourOrReceive = true;
|
|
70
73
|
}
|
|
74
|
+
this.recordGoal(currentBucketOne, currentBucketTwo);
|
|
71
75
|
return moveCount;
|
|
72
76
|
};
|
|
73
|
-
}
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
moveCount = this.smallFirst(measurements, moveCount, prBool);
|
|
83
|
-
} else {
|
|
84
|
-
moveCount = this.bigFirst(measurements, moveCount, prBool);
|
|
85
|
-
}
|
|
86
|
-
return moveCount + 1; // accounts for first move made before loop (and moveCount starts at zero before loop)
|
|
87
|
-
};
|
|
78
|
+
this.moves = function () {
|
|
79
|
+
if (this.startBucket === 'one') {
|
|
80
|
+
return this.smallFirst(this.bucketOne, 0) + 1;
|
|
81
|
+
}
|
|
82
|
+
return this.bigFirst(0, this.bucketTwo) + 1;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
88
85
|
|
|
89
86
|
module.exports = TwoBucket;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
var TwoBucket = require('./two-bucket');
|
|
2
2
|
|
|
3
3
|
describe('TwoBucket', function () {
|
|
4
|
-
describe('
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
describe('Measure using bucket one of size 3 and bucket two of size 5 - ', function () {
|
|
5
|
+
var bucketOne = 3;
|
|
6
|
+
var bucketTwo = 5;
|
|
7
7
|
var goal = 1;
|
|
8
8
|
|
|
9
|
-
it('
|
|
10
|
-
var
|
|
11
|
-
|
|
9
|
+
it('start with bucket one', function () {
|
|
10
|
+
var twoBucket = new TwoBucket(bucketOne, bucketTwo, goal, 'one');
|
|
11
|
+
|
|
12
12
|
expect(twoBucket.moves()).toEqual(4); // includes the first fill
|
|
13
13
|
expect(twoBucket.goalBucket).toEqual('one'); // which bucket should end up with the desired # of liters
|
|
14
14
|
expect(twoBucket.otherBucket).toEqual(5); // leftover value in the "other" bucket once the goal has been reached
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
xit('
|
|
18
|
-
var
|
|
19
|
-
|
|
17
|
+
xit('start with bucket two', function () {
|
|
18
|
+
var twoBucket = new TwoBucket(bucketOne, bucketTwo, goal, 'two');
|
|
19
|
+
|
|
20
20
|
expect(twoBucket.moves()).toEqual(8);
|
|
21
21
|
expect(twoBucket.goalBucket).toEqual('two');
|
|
22
22
|
expect(twoBucket.otherBucket).toEqual(3);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
describe('
|
|
27
|
-
var
|
|
28
|
-
var
|
|
26
|
+
describe('Measure using bucket one of size 7 and bucket two of size 11 - ', function () {
|
|
27
|
+
var bucketOne = 7;
|
|
28
|
+
var bucketTwo = 11;
|
|
29
29
|
var goal = 2;
|
|
30
30
|
|
|
31
|
-
xit('
|
|
32
|
-
var
|
|
33
|
-
|
|
31
|
+
xit('start with bucket one', function () {
|
|
32
|
+
var twoBucket = new TwoBucket(bucketOne, bucketTwo, goal, 'one');
|
|
33
|
+
|
|
34
34
|
expect(twoBucket.moves()).toEqual(14);
|
|
35
35
|
expect(twoBucket.goalBucket).toEqual('one');
|
|
36
36
|
expect(twoBucket.otherBucket).toEqual(11);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
xit('
|
|
40
|
-
var
|
|
41
|
-
|
|
39
|
+
xit('start with bucket two', function () {
|
|
40
|
+
var twoBucket = new TwoBucket(bucketOne, bucketTwo, goal, 'two');
|
|
41
|
+
|
|
42
42
|
expect(twoBucket.moves()).toEqual(18);
|
|
43
43
|
expect(twoBucket.goalBucket).toEqual('two');
|
|
44
44
|
expect(twoBucket.otherBucket).toEqual(7);
|
data/tracks/julia/config.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"language": "Julia",
|
|
3
3
|
"active": false,
|
|
4
|
+
"blurb": "Julia is an open-source high-level, dynamic programming language whose sweet spot is technical and scientific computing. It is convenient for day-to-day work and fast enough for high performance computing.",
|
|
4
5
|
"exercises": [
|
|
5
6
|
{
|
|
6
7
|
"uuid": "a668410d-41aa-4710-a68f-54521da6486d",
|
data/tracks/julia/docs/ABOUT.md
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
Julia
|
|
1
|
+
The creators of Julia want to eat their cake and have it too. As they describe in their blog post ["Why We Created Julia"](http://julialang.org/blog/2012/02/why-we-created-julia) they want the speed of C, the dynamism of Ruby, the familiar mathematical notation of Matlab. They want it to be their favourite things from their favourite languages. String processing like Perl. Glue like the shell. Powerful but not impenetrably complex.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- Large parts of [Julia's base library](https://github.com/julialang/julia) are written in Julia itself. Understanding and contributing to the Julia core does not require knowledge of another language.
|
|
5
|
-
- Easy to use interfaces to call libraries written in other languages, such as [C, Fortran](http://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/) and [Python](https://github.com/JuliaPy/PyCall.jl), directly.
|
|
6
|
-
- [Multiple dispatch](http://docs.julialang.org/en/stable/manual/methods/#man-methods)
|
|
7
|
-
- A dynamic, nominative and parametric [type system](http://docs.julialang.org/en/stable/manual/types/).
|
|
8
|
-
- Homoiconicity: Julia code can be represented in Julia itself, making it a good language to learn about [metaprogramming](http://docs.julialang.org/en/stable/manual/metaprogramming/).
|
|
3
|
+
Julia has a dynamic, nominative and parametric [type system](http://docs.julialang.org/en/stable/manual/types/). This allows writing dynamic code and specifying types if additional expressiveness is needed for simplification or performance increases. The language features multiple dispatch, meaning it chooses which method is called based on the types of each argument. This lets you write specific methods for certain types while providing generic fallbacks and is particularly useful for mathematical code, where it is not clear why an operation should belong to a specific argument.
|
|
9
4
|
|
|
10
|
-
|
|
5
|
+
[Metaprogramming](http://docs.julialang.org/en/stable/manual/metaprogramming/) is easy in Julia due to its homoiconicity, i.e. Julia code can be represented in Julia itself. Large parts of [Julia's base library](https://github.com/julialang/julia) are also written in Julia. Understanding and changing it does not require knowledge of another language. If a library you need to use is written in another language, such as [C, Fortran](http://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/) or [Python](https://github.com/JuliaPy/PyCall.jl), you can use simple interfaces to call them directly from your code.
|
|
11
6
|
|
|
12
7
|
Despite its young age, Julia is already being used in the real world in a variety of fields, such as but not limited to Finance, Data Science and Scientific Computing. You can find many showcase applications on [juliabloggers.com](http://www.juliabloggers.com/) and a list of publications about the language and its technical computing applications [here](http://julialang.org/publications/).
|
data/tracks/prolog/README.md
CHANGED
data/tracks/purescript/README.md
CHANGED
|
@@ -29,6 +29,15 @@ As a first step we recommend you read the [contributing guide][cont-guide].
|
|
|
29
29
|
|
|
30
30
|
[cont-guide]: https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md
|
|
31
31
|
|
|
32
|
+
Due to Travis builds taking too long and timing out, the current build plan compiles and runs the tests for all exercises in a single run. This requires the following:
|
|
33
|
+
|
|
34
|
+
- A master bower is given in `etc/bower.json`. Test scripts assure this one is used when they are run
|
|
35
|
+
* Please only update the master one and then run `bin/update-bower.sh` to sync them up.
|
|
36
|
+
* After editing `etc/bower.json`, it is advisable to run `bin/check-bower.sh`. This checks for any discrepancies between various bower scripts.
|
|
37
|
+
- Make sure exercises have a single module in `examples/src`
|
|
38
|
+
|
|
39
|
+
See [this PR](https://github.com/exercism/purescript/pull/71) for more details and the background.
|
|
40
|
+
|
|
32
41
|
#### Reporting or fixing bugs
|
|
33
42
|
|
|
34
43
|
Typical examples for a bug: A typo, a missing test case, an unclear or
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# This script will check bower.json of all exercises
|
|
4
|
+
# to confirm there are no discrepancies between them
|
|
5
|
+
# and the master bower.json in etc/bower.json
|
|
6
|
+
|
|
7
|
+
xpurescript=$(dirname "$BASH_SOURCE")
|
|
8
|
+
xpurescript=$(readlink -f "$xpurescript/..")
|
|
9
|
+
cd "$xpurescript/exercises"
|
|
10
|
+
|
|
11
|
+
bower_master="$xpurescript/etc/bower.json"
|
|
12
|
+
md5_master=$(md5sum $bower_master | awk '{print $1}')
|
|
13
|
+
|
|
14
|
+
check_result_all=0
|
|
15
|
+
|
|
16
|
+
for exercise in *; do
|
|
17
|
+
bower=$exercise/bower.json
|
|
18
|
+
|
|
19
|
+
if [[ -f $bower ]]; then
|
|
20
|
+
md5=$(sed -r 's/"name": "'$exercise'",/"name": "purescript-exercise",/' $bower | md5sum | awk '{print $1}')
|
|
21
|
+
|
|
22
|
+
check_result=0
|
|
23
|
+
if [[ $md5_master != $md5 ]]; then
|
|
24
|
+
check_result=1
|
|
25
|
+
check_result_all=1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [[ $check_result == 0 ]]; then
|
|
29
|
+
echo -e "\e[1;32mOK $bower\e[0;39m"
|
|
30
|
+
else
|
|
31
|
+
echo -e "\e[1;31mNOT OK $bower\e[0;39m"
|
|
32
|
+
fi
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
if [[ $check_result_all != 0 ]]; then
|
|
37
|
+
echo -e "\e[1;31m"
|
|
38
|
+
echo -e "Please check Contributing section in README for more information about fixing the above issues."
|
|
39
|
+
echo -e "\e[0;39m"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
exit $check_result_all
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
xpurescript=$(dirname "$BASH_SOURCE")
|
|
4
|
+
xpurescript=$(readlink -f "$xpurescript/..")
|
|
5
|
+
cd "$xpurescript/exercises"
|
|
6
|
+
|
|
7
|
+
# Calling the script with 'clean' as the first argument
|
|
8
|
+
# will cause a fully clean build
|
|
9
|
+
|
|
10
|
+
clean=no
|
|
11
|
+
if [[ "$1" == clean ]]; then
|
|
12
|
+
clean=yes
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# Run for all exercises
|
|
16
|
+
|
|
17
|
+
for exercise in *; do
|
|
18
|
+
if [[ -f $exercise/bower.json ]]; then
|
|
19
|
+
cd $exercise
|
|
20
|
+
|
|
21
|
+
echo
|
|
22
|
+
echo -e "\e[1;32m--- [ $exercise ]\e[0;39m"
|
|
23
|
+
echo
|
|
24
|
+
|
|
25
|
+
# Clean local caches if clean build was requested
|
|
26
|
+
if [[ $clean == yes ]]; then
|
|
27
|
+
rm -rf bower_components output .pulp-cache
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Move the example solution temporarily
|
|
31
|
+
if [[ ! -d src.tmp ]]; then
|
|
32
|
+
mv src src.tmp
|
|
33
|
+
mv examples/src src
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Install and test
|
|
37
|
+
bower install
|
|
38
|
+
pulp test
|
|
39
|
+
|
|
40
|
+
# Revert to the previous state
|
|
41
|
+
mv src examples/src
|
|
42
|
+
mv src.tmp src
|
|
43
|
+
|
|
44
|
+
cd ..
|
|
45
|
+
fi
|
|
46
|
+
done
|
data/tracks/python/README.md
CHANGED
|
@@ -60,9 +60,9 @@ We even :sparkling_heart: them if they contain well written commit messages!
|
|
|
60
60
|
|
|
61
61
|
Please write the first line of your commit message in the following style:
|
|
62
62
|
|
|
63
|
-
```exercise-name:
|
|
63
|
+
```exercise-name: Change some things```
|
|
64
64
|
|
|
65
|
-
If there are more details to add, put those into the body of the commit message.
|
|
65
|
+
Please try to follow the [The seven rules of a great Git commit message](https://chris.beams.io/posts/git-commit/#seven-rules) like to capitalize the subject line and use the imperative mood. If there are more details to add, put those into the body of the commit message.
|
|
66
66
|
|
|
67
67
|
If you're interested, Tim Pope even has an [entire blog post](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) on good commit messages.
|
|
68
68
|
|
|
@@ -70,8 +70,8 @@ class ComplexNumbersTest(unittest.TestCase):
|
|
|
70
70
|
def test_multiply_numbers_with_real_and_imaginary_part(self):
|
|
71
71
|
first_input = ComplexNumber(1, 2)
|
|
72
72
|
second_input = ComplexNumber(-5, 10)
|
|
73
|
-
self.assertEqual(first_input.mul(second_input).real, -
|
|
74
|
-
self.assertEqual(first_input.mul(second_input).imaginary,
|
|
73
|
+
self.assertEqual(first_input.mul(second_input).real, -25)
|
|
74
|
+
self.assertEqual(first_input.mul(second_input).imaginary, 0)
|
|
75
75
|
|
|
76
76
|
def test_divide_purely_real_numbers(self):
|
|
77
77
|
input_number = ComplexNumber(1.0, 0.0)
|
|
@@ -12,8 +12,8 @@ class ComplexNumber(object):
|
|
|
12
12
|
return ComplexNumber(r, i)
|
|
13
13
|
|
|
14
14
|
def mul(self, other):
|
|
15
|
-
r = self.real * other.real
|
|
16
|
-
i = self.imaginary * other.
|
|
15
|
+
r = self.real * other.real - self.imaginary * other.imaginary
|
|
16
|
+
i = self.real * other.imaginary + self.imaginary * other.real
|
|
17
17
|
return ComplexNumber(r, i)
|
|
18
18
|
|
|
19
19
|
def sub(self, other):
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def add_gigasecond():
|
|
1
|
+
def add_gigasecond(birth_date):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def distance():
|
|
1
|
+
def distance(strand_a, strand_b):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def hexa():
|
|
1
|
+
def hexa(hex_string):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def is_leap_year():
|
|
1
|
+
def is_leap_year(year):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def meetup_day():
|
|
1
|
+
def meetup_day(year, month, day_of_the_week, which):
|
|
2
2
|
pass
|
|
@@ -27,8 +27,10 @@ class Phone(object):
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
def _normalize(self, number):
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if len(number) == 10 or len(number) == 11 and number.startswith('1'):
|
|
31
|
+
valid = number[-10] in "23456789" and number[-7] in "23456789"
|
|
32
|
+
else:
|
|
33
|
+
valid = False
|
|
32
34
|
|
|
33
35
|
if valid:
|
|
34
36
|
return number[-10:]
|
|
@@ -3,38 +3,69 @@ import unittest
|
|
|
3
3
|
from phone_number import Phone
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
# test cases adapted from `x-common//canonical-data.json` @ version: 1.2.0
|
|
7
|
+
|
|
6
8
|
class PhoneTest(unittest.TestCase):
|
|
7
9
|
def test_cleans_number(self):
|
|
8
|
-
number = Phone("(
|
|
9
|
-
self.assertEqual(number, "
|
|
10
|
+
number = Phone("(223) 456-7890").number
|
|
11
|
+
self.assertEqual(number, "2234567890")
|
|
10
12
|
|
|
11
13
|
def test_cleans_number_with_dots(self):
|
|
12
|
-
number = Phone("
|
|
13
|
-
self.assertEqual(number, "
|
|
14
|
+
number = Phone("223.456.7890").number
|
|
15
|
+
self.assertEqual(number, "2234567890")
|
|
16
|
+
|
|
17
|
+
def test_cleans_number_with_multiple_spaces(self):
|
|
18
|
+
number = Phone("223 456 7890 ").number
|
|
19
|
+
self.assertEqual(number, "2234567890")
|
|
20
|
+
|
|
21
|
+
def test_invalid_when_9_digits(self):
|
|
22
|
+
number = Phone("123456789").number
|
|
23
|
+
self.assertEqual(number, "0000000000")
|
|
24
|
+
|
|
25
|
+
def test_invalid_when_11_digits_and_first_not_1(self):
|
|
26
|
+
number = Phone("22234567890").number
|
|
27
|
+
self.assertEqual(number, "0000000000")
|
|
14
28
|
|
|
15
29
|
def test_valid_when_11_digits_and_first_is_1(self):
|
|
16
|
-
number = Phone("
|
|
17
|
-
self.assertEqual(number, "
|
|
30
|
+
number = Phone("12234567890").number
|
|
31
|
+
self.assertEqual(number, "2234567890")
|
|
32
|
+
|
|
33
|
+
def test_valid_when_11_digits_and_first_is_1_with_punctuation(self):
|
|
34
|
+
number = Phone("+1 (223) 456-7890").number
|
|
35
|
+
self.assertEqual(number, "2234567890")
|
|
18
36
|
|
|
19
|
-
def
|
|
20
|
-
number = Phone("
|
|
37
|
+
def test_invalid_when_more_than_11_digits(self):
|
|
38
|
+
number = Phone("321234567890").number
|
|
21
39
|
self.assertEqual(number, "0000000000")
|
|
22
40
|
|
|
23
|
-
def
|
|
24
|
-
number = Phone("
|
|
41
|
+
def test_invalid_with_letters(self):
|
|
42
|
+
number = Phone("123-abc-7890").number
|
|
43
|
+
self.assertEqual(number, "0000000000")
|
|
44
|
+
|
|
45
|
+
def test_invalid_with_punctuation(self):
|
|
46
|
+
number = Phone("123-@:!-7890").number
|
|
47
|
+
self.assertEqual(number, "0000000000")
|
|
48
|
+
|
|
49
|
+
def test_invalid_area_code(self):
|
|
50
|
+
number = Phone("(123) 456-7890").number
|
|
51
|
+
self.assertEqual(number, "0000000000")
|
|
52
|
+
|
|
53
|
+
def test_invalid_exchange_code(self):
|
|
54
|
+
number = Phone("(223) 056-7890").number
|
|
25
55
|
self.assertEqual(number, "0000000000")
|
|
26
56
|
|
|
57
|
+
# Track specific tests
|
|
27
58
|
def test_area_code(self):
|
|
28
|
-
number = Phone("
|
|
29
|
-
self.assertEqual(number.area_code(), "
|
|
59
|
+
number = Phone("2234567890")
|
|
60
|
+
self.assertEqual(number.area_code(), "223")
|
|
30
61
|
|
|
31
62
|
def test_pretty_print(self):
|
|
32
|
-
number = Phone("
|
|
33
|
-
self.assertEqual(number.pretty(), "(
|
|
63
|
+
number = Phone("2234567890")
|
|
64
|
+
self.assertEqual(number.pretty(), "(223) 456-7890")
|
|
34
65
|
|
|
35
66
|
def test_pretty_print_with_full_us_phone_number(self):
|
|
36
|
-
number = Phone("
|
|
37
|
-
self.assertEqual(number.pretty(), "(
|
|
67
|
+
number = Phone("12234567890")
|
|
68
|
+
self.assertEqual(number.pretty(), "(223) 456-7890")
|
|
38
69
|
|
|
39
70
|
|
|
40
71
|
if __name__ == '__main__':
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def translate():
|
|
1
|
+
def translate(text):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def score():
|
|
1
|
+
def score(word):
|
|
2
2
|
pass
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
def calculate():
|
|
1
|
+
def calculate(question):
|
|
2
2
|
pass
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import java.time.DayOfWeek
|
|
2
|
-
|
|
1
|
+
import java.time.{DayOfWeek, LocalDate}
|
|
2
|
+
|
|
3
|
+
import Schedule.Schedule
|
|
3
4
|
|
|
4
5
|
case class Meetup(month: Int, year: Int) {
|
|
5
6
|
private val thirteenth = LocalDate.of(year, month, 13)
|
|
6
|
-
private val
|
|
7
|
-
private val nextMonth =
|
|
7
|
+
private val firstDay = LocalDate.of(year, month, 1)
|
|
8
|
+
private val nextMonth = firstDay.plusMonths(1)
|
|
9
|
+
|
|
10
|
+
private val teenth: Scheduler = (dayOfWeek: Int) => thirteenth.next(dayOfWeek)
|
|
11
|
+
private val first: Scheduler = (dayOfWeek: Int) => firstDay.next(dayOfWeek)
|
|
12
|
+
private val second: Scheduler = (dayOfWeek: Int) => first.day(dayOfWeek).plusDays(7)
|
|
13
|
+
private val third: Scheduler = (dayOfWeek: Int) => second.day(dayOfWeek).plusDays(7)
|
|
14
|
+
private val fourth: Scheduler = (dayOfWeek: Int) => third.day(dayOfWeek).plusDays(7)
|
|
15
|
+
private val last: Scheduler = (dayOfWeek: Int) => nextMonth.next(dayOfWeek).minusDays(7)
|
|
16
|
+
private def schedulers: Map[Schedule, Scheduler] = Map(Schedule.Teenth -> teenth,
|
|
17
|
+
Schedule.First -> first,
|
|
18
|
+
Schedule.Second -> second,
|
|
19
|
+
Schedule.Third -> third,
|
|
20
|
+
Schedule.Fourth -> fourth,
|
|
21
|
+
Schedule.Last -> last)
|
|
8
22
|
|
|
9
|
-
def
|
|
10
|
-
|
|
11
|
-
def second(day: Int): LocalDate = first(day).plusDays(7)
|
|
12
|
-
def third(day: Int): LocalDate = second(day).plusDays(7)
|
|
13
|
-
def fourth(day: Int): LocalDate = third(day).plusDays(7)
|
|
14
|
-
def last(day: Int): LocalDate = nextMonth.next(day).minusDays(7)
|
|
23
|
+
def day(dayOfWeek: Int, schedule: Schedule): LocalDate =
|
|
24
|
+
schedulers(schedule).day(dayOfWeek)
|
|
15
25
|
|
|
16
26
|
implicit class LocalDateOps(self: LocalDate) {
|
|
17
27
|
def next(dayOfWeek: Int): LocalDate = self.plusDays(daysUntil(dayOfWeek))
|
|
@@ -20,6 +30,15 @@ case class Meetup(month: Int, year: Int) {
|
|
|
20
30
|
|
|
21
31
|
def dayOfWeek: Int = self.getDayOfWeek.getValue
|
|
22
32
|
}
|
|
33
|
+
|
|
34
|
+
trait Scheduler {
|
|
35
|
+
def day(dayOfWeek: Int): LocalDate
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
object Schedule extends Enumeration {
|
|
40
|
+
type Schedule = Value
|
|
41
|
+
val Teenth, First, Second, Third, Fourth, Last = Value
|
|
23
42
|
}
|
|
24
43
|
|
|
25
44
|
object Meetup {
|