trackler 2.0.6.28 → 2.0.6.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/all-your-base/metadata.yml +1 -1
- data/common/exercises/allergies/metadata.yml +1 -1
- data/common/exercises/anagram/metadata.yml +1 -1
- data/common/exercises/beer-song/metadata.yml +1 -1
- data/common/exercises/binary-search-tree/metadata.yml +1 -1
- data/common/exercises/binary-search/metadata.yml +1 -1
- data/common/exercises/binary/metadata.yml +1 -1
- data/common/exercises/change/description.md +3 -3
- data/common/exercises/change/metadata.yml +1 -1
- data/common/exercises/crypto-square/description.md +1 -2
- data/common/exercises/etl/description.md +2 -2
- data/common/exercises/flatten-array/metadata.yml +1 -1
- data/common/exercises/food-chain/description.md +4 -5
- data/common/exercises/food-chain/metadata.yml +1 -1
- data/common/exercises/gigasecond/metadata.yml +1 -1
- data/common/exercises/grade-school/metadata.yml +1 -1
- data/common/exercises/grains/description.md +1 -1
- data/common/exercises/grains/metadata.yml +1 -1
- data/common/exercises/hamming/metadata.yml +1 -1
- data/common/exercises/hello-world/metadata.yml +1 -1
- data/common/exercises/hexadecimal/metadata.yml +1 -1
- data/common/exercises/house/metadata.yml +1 -1
- data/common/exercises/kindergarten-garden/metadata.yml +1 -1
- data/common/exercises/largest-series-product/metadata.yml +1 -1
- data/common/exercises/leap/metadata.yml +1 -1
- data/common/exercises/luhn/description.md +1 -1
- data/common/exercises/luhn/metadata.yml +1 -1
- data/common/exercises/matrix/metadata.yml +1 -1
- data/common/exercises/minesweeper/metadata.yml +1 -1
- data/common/exercises/nth-prime/metadata.yml +1 -1
- data/common/exercises/ocr-numbers/metadata.yml +1 -1
- data/common/exercises/octal/metadata.yml +1 -1
- data/common/exercises/paasio/metadata.yml +1 -1
- data/common/exercises/palindrome-products/description.md +30 -2
- data/common/exercises/palindrome-products/metadata.yml +1 -1
- data/common/exercises/parallel-letter-frequency/metadata.yml +1 -1
- data/common/exercises/pascals-triangle/metadata.yml +1 -1
- data/common/exercises/phone-number/metadata.yml +1 -1
- data/common/exercises/point-mutations/metadata.yml +1 -1
- data/common/exercises/protein-translation/description.md +1 -1
- data/common/exercises/protein-translation/metadata.yml +1 -1
- data/common/exercises/proverb/metadata.yml +1 -1
- data/common/exercises/queen-attack/metadata.yml +1 -1
- data/common/exercises/raindrops/metadata.yml +1 -1
- data/common/exercises/rna-transcription/metadata.yml +1 -1
- data/common/exercises/robot-name/metadata.yml +1 -1
- data/common/exercises/saddle-points/metadata.yml +1 -1
- data/common/exercises/say/metadata.yml +1 -1
- data/common/exercises/scale-generator/description.md +3 -4
- data/common/exercises/scale-generator/metadata.yml +1 -1
- data/common/exercises/scrabble-score/metadata.yml +1 -1
- data/common/exercises/secret-handshake/metadata.yml +1 -1
- data/common/exercises/series/metadata.yml +1 -1
- data/common/exercises/sieve/metadata.yml +1 -1
- data/common/exercises/space-age/metadata.yml +1 -1
- data/common/exercises/sum-of-multiples/description.md +2 -2
- data/common/exercises/sum-of-multiples/metadata.yml +1 -1
- data/common/exercises/transpose/description.md +1 -1
- data/common/exercises/transpose/metadata.yml +1 -1
- data/common/exercises/triangle/metadata.yml +1 -1
- data/common/exercises/trinary/metadata.yml +1 -1
- data/common/exercises/twelve-days/metadata.yml +1 -1
- data/common/exercises/two-bucket/description.md +1 -1
- data/common/exercises/two-bucket/metadata.yml +1 -1
- data/common/exercises/word-count/metadata.yml +1 -1
- data/common/exercises/zebra-puzzle/metadata.yml +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/erlang/.gitignore +2 -0
- data/tracks/erlang/.travis.yml +8 -4
- data/tracks/erlang/Makefile +16 -0
- data/tracks/erlang/README.md +77 -1
- data/tracks/erlang/_test/bootstrap.sh +17 -4
- data/tracks/erlang/_test/check-exercises.escript +64 -24
- data/tracks/erlang/config.json +63 -63
- data/tracks/erlang/docs/INSTALLATION.md +18 -0
- data/tracks/erlang/docs/TESTS.md +1 -3
- data/tracks/erlang/exercises/accumulate/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/accumulate/rebar.conf +30 -0
- data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +9 -0
- data/tracks/erlang/exercises/accumulate/{example.erl → src/example.erl} +3 -2
- data/tracks/erlang/exercises/accumulate/test/accumulate_tests.erl +27 -0
- data/tracks/erlang/exercises/allergies/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/allergies/rebar.conf +30 -0
- data/tracks/erlang/exercises/allergies/src/allergies.app.src +9 -0
- data/tracks/erlang/exercises/allergies/{example.erl → src/example.erl} +9 -10
- data/tracks/erlang/exercises/allergies/{allergies_tests.erl → test/allergies_tests.erl} +17 -20
- data/tracks/erlang/exercises/anagram/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/anagram/rebar.conf +32 -0
- data/tracks/erlang/exercises/anagram/src/anagram.app.src +9 -0
- data/tracks/erlang/exercises/anagram/{example.erl → src/example.erl} +2 -1
- data/tracks/erlang/exercises/anagram/test/anagram_tests.erl +43 -0
- data/tracks/erlang/exercises/atbash-cipher/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/atbash-cipher/rebar.conf +30 -0
- data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +9 -0
- data/tracks/erlang/exercises/atbash-cipher/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/atbash-cipher/{atbash_cipher_tests.erl → test/atbash_cipher_tests.erl} +6 -2
- data/tracks/erlang/exercises/bank-account/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/bank-account/rebar.conf +30 -0
- data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +9 -0
- data/tracks/erlang/exercises/bank-account/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/bank-account/test/bank_account_tests.erl +98 -0
- data/tracks/erlang/exercises/beer-song/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/beer-song/rebar.conf +30 -0
- data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +9 -0
- data/tracks/erlang/exercises/beer-song/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/beer-song/{beer_song_tests.erl → test/beer_song_tests.erl} +9 -9
- data/tracks/erlang/exercises/binary/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/binary/rebar.conf +30 -0
- data/tracks/erlang/exercises/binary/src/binary.app.src +9 -0
- data/tracks/erlang/exercises/binary/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/binary/{binary_string_tests.erl → test/binary_string_tests.erl} +7 -3
- data/tracks/erlang/exercises/bob/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/bob/rebar.conf +30 -0
- data/tracks/erlang/exercises/bob/src/bob.app.src +9 -0
- data/tracks/erlang/exercises/bob/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/bob/{bob_tests.erl → test/bob_tests.erl} +4 -4
- data/tracks/erlang/exercises/circular-buffer/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/circular-buffer/rebar.conf +30 -0
- data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +9 -0
- data/tracks/erlang/exercises/circular-buffer/{example.erl → src/example.erl} +1 -34
- data/tracks/erlang/exercises/circular-buffer/test/circular_buffer_tests.erl +58 -0
- data/tracks/erlang/exercises/clock/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/clock/rebar.conf +30 -0
- data/tracks/erlang/exercises/clock/src/clock.app.src +9 -0
- data/tracks/erlang/exercises/clock/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/clock/{clock_tests.erl → test/clock_tests.erl} +51 -48
- data/tracks/erlang/exercises/difference-of-squares/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/difference-of-squares/rebar.conf +30 -0
- data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +9 -0
- data/tracks/erlang/exercises/difference-of-squares/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/difference-of-squares/{difference_of_squares_tests.erl → test/difference_of_squares_tests.erl} +7 -3
- data/tracks/erlang/exercises/etl/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/etl/rebar.conf +30 -0
- data/tracks/erlang/exercises/etl/src/etl.app.src +9 -0
- data/tracks/erlang/exercises/etl/{example.erl → src/example.erl} +1 -2
- data/tracks/erlang/exercises/etl/{etl_tests.erl → test/etl_tests.erl} +3 -4
- data/tracks/erlang/exercises/gigasecond/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/gigasecond/rebar.conf +30 -0
- data/tracks/erlang/exercises/gigasecond/{example.erl → src/example.erl} +1 -2
- data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +9 -0
- data/tracks/erlang/exercises/gigasecond/test/gigasecond_tests.erl +22 -0
- data/tracks/erlang/exercises/grade-school/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/grade-school/rebar.conf +30 -0
- data/tracks/erlang/exercises/grade-school/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +9 -0
- data/tracks/erlang/exercises/grade-school/test/grade_school_tests.erl +47 -0
- data/tracks/erlang/exercises/grains/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/grains/rebar.conf +30 -0
- data/tracks/erlang/exercises/grains/{example.erl → src/example.erl} +1 -2
- data/tracks/erlang/exercises/grains/src/grains.app.src +9 -0
- data/tracks/erlang/exercises/grains/test/grains_tests.erl +32 -0
- data/tracks/erlang/exercises/hamming/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/hamming/rebar.conf +30 -0
- data/tracks/erlang/exercises/hamming/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/hamming/src/hamming.app.src +9 -0
- data/tracks/erlang/exercises/hamming/test/hamming_tests.erl +24 -0
- data/tracks/erlang/exercises/hello-world/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/hello-world/rebar.conf +30 -0
- data/tracks/erlang/exercises/hello-world/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +9 -0
- data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +18 -0
- data/tracks/erlang/exercises/largest-series-product/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/largest-series-product/rebar.conf +30 -0
- data/tracks/erlang/exercises/largest-series-product/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +9 -0
- data/tracks/erlang/exercises/largest-series-product/test/largest_series_product_tests.erl +57 -0
- data/tracks/erlang/exercises/leap/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/leap/rebar.conf +30 -0
- data/tracks/erlang/exercises/leap/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/leap/src/leap.app.src +9 -0
- data/tracks/erlang/exercises/leap/test/leap_tests.erl +18 -0
- data/tracks/erlang/exercises/luhn/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/luhn/rebar.conf +30 -0
- data/tracks/erlang/exercises/luhn/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/luhn/src/luhn.app.src +9 -0
- data/tracks/erlang/exercises/luhn/test/luhn_tests.erl +18 -0
- data/tracks/erlang/exercises/meetup/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/meetup/rebar.conf +30 -0
- data/tracks/erlang/exercises/meetup/{example.erl → src/example.erl} +1 -2
- data/tracks/erlang/exercises/meetup/src/meetup.app.src +9 -0
- data/tracks/erlang/exercises/meetup/{meetup_tests.erl → test/meetup_tests.erl} +94 -95
- data/tracks/erlang/exercises/nucleotide-count/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/nucleotide-count/rebar.conf +30 -0
- data/tracks/erlang/exercises/nucleotide-count/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +9 -0
- data/tracks/erlang/exercises/nucleotide-count/test/dna_tests.erl +30 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/rebar.conf +30 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +9 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/{parallel_letter_frequency_tests.erl → test/parallel_letter_frequency_tests.erl} +6 -2
- data/tracks/erlang/exercises/phone-number/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/phone-number/rebar.conf +30 -0
- data/tracks/erlang/exercises/phone-number/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +9 -0
- data/tracks/erlang/exercises/phone-number/test/phone_tests.erl +28 -0
- data/tracks/erlang/exercises/rna-transcription/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/rna-transcription/rebar.conf +30 -0
- data/tracks/erlang/exercises/rna-transcription/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +9 -0
- data/tracks/erlang/exercises/rna-transcription/test/rna_transcription_tests.erl +24 -0
- data/tracks/erlang/exercises/robot-simulator/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/robot-simulator/rebar.conf +30 -0
- data/tracks/erlang/exercises/robot-simulator/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +9 -0
- data/tracks/erlang/exercises/robot-simulator/test/robot_simulator_tests.erl +100 -0
- data/tracks/erlang/exercises/roman-numerals/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/roman-numerals/rebar.conf +30 -0
- data/tracks/erlang/exercises/roman-numerals/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +9 -0
- data/tracks/erlang/exercises/roman-numerals/{roman_numerals_tests.erl → test/roman_numerals_tests.erl} +3 -4
- data/tracks/erlang/exercises/scrabble-score/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/scrabble-score/rebar.conf +30 -0
- data/tracks/erlang/exercises/scrabble-score/{example.erl → src/example.erl} +2 -2
- data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +9 -0
- data/tracks/erlang/exercises/scrabble-score/{scrabble_score_tests.erl → test/scrabble_score_tests.erl} +5 -1
- data/tracks/erlang/exercises/series/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/series/rebar.conf +30 -0
- data/tracks/erlang/exercises/series/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/series/src/series.app.src +9 -0
- data/tracks/erlang/exercises/series/test/series_tests.erl +10 -0
- data/tracks/erlang/exercises/space-age/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/space-age/rebar.conf +30 -0
- data/tracks/erlang/exercises/space-age/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/space-age/src/space_age.app.src +9 -0
- data/tracks/erlang/exercises/space-age/test/space_age_tests.erl +51 -0
- data/tracks/erlang/exercises/strain/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/strain/rebar.conf +30 -0
- data/tracks/erlang/exercises/strain/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/strain/src/strain.app.src +9 -0
- data/tracks/erlang/exercises/strain/test/strain_tests.erl +52 -0
- data/tracks/erlang/exercises/sum-of-multiples/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/sum-of-multiples/rebar.conf +30 -0
- data/tracks/erlang/exercises/sum-of-multiples/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +9 -0
- data/tracks/erlang/exercises/sum-of-multiples/test/sum_of_multiples_tests.erl +39 -0
- data/tracks/erlang/exercises/triangle/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/triangle/rebar.conf +30 -0
- data/tracks/erlang/exercises/triangle/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/triangle/src/triangle.app.src +9 -0
- data/tracks/erlang/exercises/triangle/{triangle_tests.erl → test/triangle_tests.erl} +19 -18
- data/tracks/erlang/exercises/trinary/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/trinary/rebar.conf +30 -0
- data/tracks/erlang/exercises/trinary/{example.erl → src/example.erl} +1 -2
- data/tracks/erlang/exercises/trinary/src/trinary.app.src +9 -0
- data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +36 -0
- data/tracks/erlang/exercises/word-count/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/word-count/rebar.conf +30 -0
- data/tracks/erlang/exercises/word-count/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/word-count/src/word_count.app.src +9 -0
- data/tracks/erlang/exercises/word-count/{word_count_tests.erl → test/word_count_tests.erl} +4 -2
- data/tracks/erlang/exercises/zipper/include/exercism.hrl +6 -0
- data/tracks/erlang/exercises/zipper/rebar.conf +30 -0
- data/tracks/erlang/exercises/zipper/{example.erl → src/example.erl} +1 -1
- data/tracks/erlang/exercises/zipper/src/zipper.app.src +9 -0
- data/tracks/erlang/exercises/zipper/test/zipper_tests.erl +100 -0
- data/tracks/go/config.json +14 -4
- data/tracks/go/exercises/acronym/acronym_test.go +1 -1
- data/tracks/go/exercises/all-your-base/all_your_base_test.go +8 -8
- data/tracks/go/exercises/luhn/luhn_test.go +6 -6
- data/tracks/go/exercises/word-search/word_search_test.go +4 -1
- data/tracks/go/exercises/wordy/example.go +2 -0
- data/tracks/go/exercises/wordy/wordy_test.go +8 -0
- data/tracks/haskell/.travis.yml +3 -57
- data/tracks/haskell/README.md +13 -10
- data/tracks/haskell/bin/test-all-examples +20 -0
- data/tracks/haskell/bin/test-example +73 -0
- data/tracks/haskell/bin/test-stub +43 -0
- data/tracks/haskell/config.json +0 -1
- data/tracks/haskell/exercises/accumulate/examples/fail-reverse/package.yaml +16 -0
- data/tracks/haskell/exercises/accumulate/examples/fail-reverse/src/Accumulate.hs +7 -0
- data/tracks/haskell/exercises/accumulate/examples/success-standard/src/Accumulate.hs +0 -7
- data/tracks/haskell/exercises/atbash-cipher/test/Tests.hs +1 -5
- data/tracks/haskell/exercises/forth/test/Tests.hs +1 -4
- data/tracks/haskell/exercises/leap/examples/error-nosig/package.yaml +16 -0
- data/tracks/haskell/exercises/leap/examples/error-nosig/src/LeapYear.hs +4 -0
- data/tracks/haskell/exercises/nucleotide-count/examples/success-standard/src/DNA.hs +2 -5
- data/tracks/haskell/exercises/nucleotide-count/src/DNA.hs +1 -4
- data/tracks/haskell/exercises/nucleotide-count/test/Tests.hs +3 -22
- data/tracks/haskell/exercises/prime-factors/test/Tests.hs +9 -15
- data/tracks/haskell/exercises/scrabble-score/test/Tests.hs +1 -5
- data/tracks/haskell/exercises/secret-handshake/examples/success-standard/src/SecretHandshake.hs +3 -21
- data/tracks/haskell/exercises/secret-handshake/src/SecretHandshake.hs +1 -0
- data/tracks/haskell/exercises/secret-handshake/test/Tests.hs +20 -23
- data/tracks/haskell/exercises/strain/examples/fail-reverse/package.yaml +16 -0
- data/tracks/haskell/exercises/strain/examples/fail-reverse/src/Strain.hs +9 -0
- data/tracks/haskell/exercises/triangle/test/Tests.hs +6 -1
- data/tracks/julia/config.json +20 -2
- data/tracks/julia/exercises/raindrops/example.jl +16 -0
- data/tracks/julia/exercises/raindrops/raindrops.jl +3 -0
- data/tracks/julia/exercises/raindrops/runtests.jl +72 -0
- data/tracks/julia/exercises/secret-handshake/example.jl +12 -0
- data/tracks/julia/exercises/secret-handshake/runtests.jl +51 -0
- data/tracks/julia/exercises/secret-handshake/secret-handshake.jl +3 -0
- metadata +198 -79
- data/tracks/erlang/exercises/accumulate/accumulate_tests.erl +0 -28
- data/tracks/erlang/exercises/anagram/anagram_tests.erl +0 -39
- data/tracks/erlang/exercises/bank-account/bank_account_tests.erl +0 -95
- data/tracks/erlang/exercises/circular-buffer/circular_buffer_tests.erl +0 -54
- data/tracks/erlang/exercises/clock/clock.erl +0 -14
- data/tracks/erlang/exercises/gigasecond/gigasecond_tests.erl +0 -29
- data/tracks/erlang/exercises/grade-school/grade_school_tests.erl +0 -49
- data/tracks/erlang/exercises/grains/grains_tests.erl +0 -31
- data/tracks/erlang/exercises/hamming/dna_tests.erl +0 -21
- data/tracks/erlang/exercises/hello-world/hello_world_tests.erl +0 -19
- data/tracks/erlang/exercises/largest-series-product/largest_series_product.erl +0 -5
- data/tracks/erlang/exercises/largest-series-product/largest_series_product_tests.erl +0 -54
- data/tracks/erlang/exercises/leap/leap_tests.erl +0 -20
- data/tracks/erlang/exercises/luhn/luhn_tests.erl +0 -19
- data/tracks/erlang/exercises/nucleotide-count/dna_tests.erl +0 -27
- data/tracks/erlang/exercises/phone-number/phone_tests.erl +0 -29
- data/tracks/erlang/exercises/rna-transcription/rna_transcription_tests.erl +0 -24
- data/tracks/erlang/exercises/robot-simulator/robot_simulator_tests.erl +0 -96
- data/tracks/erlang/exercises/roman-numerals/roman_numerals.erl +0 -6
- data/tracks/erlang/exercises/series/series_tests.erl +0 -6
- data/tracks/erlang/exercises/space-age/space_age_tests.erl +0 -48
- data/tracks/erlang/exercises/strain/strain_tests.erl +0 -49
- data/tracks/erlang/exercises/sum-of-multiples/sum_of_multiples_tests.erl +0 -37
- data/tracks/erlang/exercises/trinary/trinary_tests.erl +0 -37
- data/tracks/erlang/exercises/zipper/zipper_tests.erl +0 -103
- data/tracks/haskell/exercises/secret-handshake/.meta/DONT-TEST-STUB +0 -1
- data/tracks/haskell/exercises/secret-handshake/HINTS.md +0 -6
@@ -1,20 +0,0 @@
|
|
1
|
-
% To run tests:
|
2
|
-
% erl -make
|
3
|
-
% erl -noshell -eval "eunit:test(leap, [verbose])" -s init stop
|
4
|
-
%
|
5
|
-
|
6
|
-
-module(leap_tests).
|
7
|
-
|
8
|
-
-include_lib("eunit/include/eunit.hrl").
|
9
|
-
|
10
|
-
leap_year_test() ->
|
11
|
-
?assert(leap:leap_year(1996)).
|
12
|
-
|
13
|
-
non_leap_year_test() ->
|
14
|
-
?assertNot(leap:leap_year(1997)).
|
15
|
-
|
16
|
-
century_test() ->
|
17
|
-
?assertNot(leap:leap_year(1900)).
|
18
|
-
|
19
|
-
fourth_century_test() ->
|
20
|
-
?assert(leap:leap_year(2400)).
|
@@ -1,19 +0,0 @@
|
|
1
|
-
-module(luhn_tests).
|
2
|
-
-include_lib("eunit/include/eunit.hrl").
|
3
|
-
|
4
|
-
% To run tests:
|
5
|
-
% erl -make
|
6
|
-
% erl -noshell -eval "eunit:test(luhn, [verbose])" -s init stop
|
7
|
-
|
8
|
-
invalid_test() ->
|
9
|
-
?assertNot(luhn:valid("1111")),
|
10
|
-
?assertNot(luhn:valid("738")).
|
11
|
-
|
12
|
-
valid_test() ->
|
13
|
-
?assert(luhn:valid("8739567")),
|
14
|
-
?assert(luhn:valid("8763")),
|
15
|
-
?assert(luhn:valid("2323 2005 7766 3554")).
|
16
|
-
|
17
|
-
create_test() ->
|
18
|
-
?assertEqual("2323 2005 7766 3554", luhn:create("2323 2005 7766 355")).
|
19
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
-module(dna_tests).
|
2
|
-
|
3
|
-
-include_lib("eunit/include/eunit.hrl").
|
4
|
-
|
5
|
-
empty_dna_string_has_no_adenine_test() ->
|
6
|
-
?assertEqual(0, dna:count("", "A")).
|
7
|
-
|
8
|
-
repetitive_cytosine_gets_counted_test() ->
|
9
|
-
?assertEqual(5, dna:count("CCCCC", "C")).
|
10
|
-
|
11
|
-
counts_only_thymine_test() ->
|
12
|
-
?assertEqual(1, dna:count("GGGGGTAACCCGG", "T")).
|
13
|
-
|
14
|
-
validates_nucleotides_test() ->
|
15
|
-
?assertException(error, "Invalid nucleotide", dna:count("GACT", "X")).
|
16
|
-
|
17
|
-
empty_dna_string_has_no_nucleotides_test() ->
|
18
|
-
?assertEqual([{"A", 0}, {"T", 0}, {"C", 0}, {"G", 0}], dna:nucleotide_counts("")).
|
19
|
-
|
20
|
-
repetitive_sequence_has_only_guanine_test() ->
|
21
|
-
?assertEqual([{"A", 0}, {"T", 0}, {"C", 0}, {"G", 8}], dna:nucleotide_counts("GGGGGGGG")).
|
22
|
-
|
23
|
-
counts_all_nucleotides_test() ->
|
24
|
-
?assertEqual(
|
25
|
-
[{"A", 20}, {"T", 21}, {"C", 12}, {"G", 17}],
|
26
|
-
dna:nucleotide_counts(
|
27
|
-
"AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC")).
|
@@ -1,29 +0,0 @@
|
|
1
|
-
% To run tests:
|
2
|
-
% elc *.erl
|
3
|
-
% erl -noshell -eval "eunit:test(phone, [verbose])" -s init stop
|
4
|
-
%
|
5
|
-
-module(phone_tests).
|
6
|
-
|
7
|
-
-include_lib("eunit/include/eunit.hrl").
|
8
|
-
|
9
|
-
cleans_number_test() ->
|
10
|
-
?assertEqual("1234567890", phone:number("(123) 456-7890")).
|
11
|
-
|
12
|
-
cleans_number_with_dots_test() ->
|
13
|
-
?assertEqual("1234567890", phone:number("123.456.7890")).
|
14
|
-
|
15
|
-
valid_when_eleven_digits_test() ->
|
16
|
-
?assertEqual("1234567890", phone:number("11234567890")).
|
17
|
-
|
18
|
-
invalid_when_eleven_digits_test() ->
|
19
|
-
?assertEqual("0000000000", phone:number("21234567890")).
|
20
|
-
|
21
|
-
invalid_when_nine_digits_test() ->
|
22
|
-
?assertEqual("0000000000", phone:number("123456789")).
|
23
|
-
|
24
|
-
area_code_test() ->
|
25
|
-
?assertEqual("123", phone:areacode("1234567890")).
|
26
|
-
|
27
|
-
pretty_print_test() ->
|
28
|
-
?assertEqual("(123) 456-7890", phone:pretty_print("1234567890")),
|
29
|
-
?assertEqual("(123) 456-7890", phone:pretty_print("11234567890")).
|
@@ -1,24 +0,0 @@
|
|
1
|
-
% to run tests:
|
2
|
-
% erl -make
|
3
|
-
% erl -noshell -eval "eunit:test(rna_transcription, [verbose])" -s init stop
|
4
|
-
|
5
|
-
-module(rna_transcription_tests).
|
6
|
-
-include_lib("eunit/include/eunit.hrl").
|
7
|
-
|
8
|
-
transcribes_cytidine_unchanged_test() ->
|
9
|
-
?assertEqual("C", rna_transcription:to_rna("G")).
|
10
|
-
|
11
|
-
transcribes_guanosine_unchanged_test() ->
|
12
|
-
?assertEqual("G", rna_transcription:to_rna("C")).
|
13
|
-
|
14
|
-
transcribes_adenosine_unchanged_test() ->
|
15
|
-
?assertEqual("A", rna_transcription:to_rna("T")).
|
16
|
-
|
17
|
-
transcribes_thymidine_to_uracil_test() ->
|
18
|
-
?assertEqual("U", rna_transcription:to_rna("A")).
|
19
|
-
|
20
|
-
transcribes_all_occurences_test() ->
|
21
|
-
?assertEqual(
|
22
|
-
"UGCACCAGAAUU",
|
23
|
-
rna_transcription:to_rna("ACGTGGTCTTAA")
|
24
|
-
).
|
@@ -1,96 +0,0 @@
|
|
1
|
-
-module( robot_simulator_tests ).
|
2
|
-
-include_lib( "eunit/include/eunit.hrl" ).
|
3
|
-
|
4
|
-
create_test() ->
|
5
|
-
Robot = robot_simulator:create(),
|
6
|
-
?assert( robot_simulator:direction(Robot) =:= undefined ),
|
7
|
-
?assert( robot_simulator:position(Robot) =:= {undefined, undefined} ).
|
8
|
-
|
9
|
-
place_test() ->
|
10
|
-
Robot = robot_simulator:create(),
|
11
|
-
Position = {1, 2},
|
12
|
-
robot_simulator:place( Robot, north, Position ),
|
13
|
-
?assert( robot_simulator:direction(Robot) =:= north ),
|
14
|
-
?assert( robot_simulator:position(Robot) =:= Position ).
|
15
|
-
|
16
|
-
left_test() ->
|
17
|
-
Robot = robot_simulator:create(),
|
18
|
-
Position = {3, 4},
|
19
|
-
robot_simulator:place( Robot, north, Position ),
|
20
|
-
robot_simulator:left( Robot ),
|
21
|
-
?assert( robot_simulator:direction(Robot) =:= west ),
|
22
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
23
|
-
robot_simulator:left( Robot ),
|
24
|
-
?assert( robot_simulator:direction(Robot) =:= south ),
|
25
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
26
|
-
robot_simulator:left( Robot ),
|
27
|
-
?assert( robot_simulator:direction(Robot) =:= east ),
|
28
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
29
|
-
robot_simulator:left( Robot ),
|
30
|
-
?assert( robot_simulator:direction(Robot) =:= north ),
|
31
|
-
?assert( robot_simulator:position(Robot) =:= Position ).
|
32
|
-
|
33
|
-
right_test() ->
|
34
|
-
Robot = robot_simulator:create(),
|
35
|
-
Position = {5, 6},
|
36
|
-
robot_simulator:place( Robot, north, Position ),
|
37
|
-
robot_simulator:right( Robot ),
|
38
|
-
?assert( robot_simulator:direction(Robot) =:= east ),
|
39
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
40
|
-
robot_simulator:right( Robot ),
|
41
|
-
?assert( robot_simulator:direction(Robot) =:= south ),
|
42
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
43
|
-
robot_simulator:right( Robot ),
|
44
|
-
?assert( robot_simulator:direction(Robot) =:= west ),
|
45
|
-
?assert( robot_simulator:position(Robot) =:= Position ),
|
46
|
-
robot_simulator:right( Robot ),
|
47
|
-
?assert( robot_simulator:direction(Robot) =:= north ),
|
48
|
-
?assert( robot_simulator:position(Robot) =:= Position ).
|
49
|
-
|
50
|
-
advance_north_test() ->
|
51
|
-
Robot = robot_simulator:create(),
|
52
|
-
Direction = north,
|
53
|
-
robot_simulator:place( Robot, Direction, {7, 8} ),
|
54
|
-
robot_simulator:advance( Robot ),
|
55
|
-
?assert( robot_simulator:direction(Robot) =:= Direction ),
|
56
|
-
?assert( robot_simulator:position(Robot) =:= {7, 9} ).
|
57
|
-
|
58
|
-
advance_south_test() ->
|
59
|
-
Robot = robot_simulator:create(),
|
60
|
-
Direction = south,
|
61
|
-
robot_simulator:place( Robot, Direction, {9, 10} ),
|
62
|
-
robot_simulator:advance( Robot ),
|
63
|
-
?assert( robot_simulator:direction(Robot) =:= Direction ),
|
64
|
-
?assert( robot_simulator:position(Robot) =:= {9, 9} ).
|
65
|
-
|
66
|
-
advance_east_test() ->
|
67
|
-
Robot = robot_simulator:create(),
|
68
|
-
Direction = east,
|
69
|
-
robot_simulator:place( Robot, Direction, {11, 12} ),
|
70
|
-
robot_simulator:advance( Robot ),
|
71
|
-
?assert( robot_simulator:direction(Robot) =:= Direction ),
|
72
|
-
?assert( robot_simulator:position(Robot) =:= {12, 12} ).
|
73
|
-
|
74
|
-
advance_west_test() ->
|
75
|
-
Robot = robot_simulator:create(),
|
76
|
-
Direction = west,
|
77
|
-
robot_simulator:place( Robot, Direction, {13, 14} ),
|
78
|
-
robot_simulator:advance( Robot ),
|
79
|
-
?assert( robot_simulator:direction(Robot) =:= Direction ),
|
80
|
-
?assert( robot_simulator:position(Robot) =:= {12, 14} ).
|
81
|
-
|
82
|
-
control_test() ->
|
83
|
-
Robot = robot_simulator:create(),
|
84
|
-
robot_simulator:place( Robot, north, {7, 3} ),
|
85
|
-
robot_simulator:control( Robot, "RAALAL" ),
|
86
|
-
?assert( robot_simulator:direction(Robot) =:= west ),
|
87
|
-
?assert( robot_simulator:position(Robot) =:= {9, 4} ).
|
88
|
-
|
89
|
-
control_unknown_test() ->
|
90
|
-
Robot = robot_simulator:create(),
|
91
|
-
Direction = north,
|
92
|
-
Position = {7, 3},
|
93
|
-
robot_simulator:place( Robot, Direction, Position ),
|
94
|
-
robot_simulator:control( Robot, "unknown" ),
|
95
|
-
?assert( robot_simulator:direction(Robot) =:= Direction ),
|
96
|
-
?assert( robot_simulator:position(Robot) =:= Position ).
|
@@ -1,48 +0,0 @@
|
|
1
|
-
-module(space_age_tests).
|
2
|
-
|
3
|
-
-include_lib("eunit/include/eunit.hrl").
|
4
|
-
|
5
|
-
age_in_earth_years_test() ->
|
6
|
-
equalFloat(space_age:ageOn(earth, 1000000000), 31.69).
|
7
|
-
|
8
|
-
age_in_mercury_years_test() ->
|
9
|
-
Seconds = 2134835688,
|
10
|
-
equalFloat(space_age:ageOn(earth, Seconds), 67.65),
|
11
|
-
equalFloat(space_age:ageOn(mercury, Seconds), 280.88).
|
12
|
-
|
13
|
-
age_in_venus_years_test() ->
|
14
|
-
Seconds = 189839836,
|
15
|
-
equalFloat(space_age:ageOn(earth, Seconds), 6.02),
|
16
|
-
equalFloat(space_age:ageOn(venus, Seconds), 9.78).
|
17
|
-
|
18
|
-
age_in_mars_years_test() ->
|
19
|
-
Seconds = 2329871239,
|
20
|
-
equalFloat(space_age:ageOn(earth, Seconds), 73.83),
|
21
|
-
equalFloat(space_age:ageOn(mars, Seconds), 39.25).
|
22
|
-
|
23
|
-
age_in_jupiter_years_test() ->
|
24
|
-
Seconds = 901876382,
|
25
|
-
equalFloat(space_age:ageOn(earth, Seconds), 28.58),
|
26
|
-
equalFloat(space_age:ageOn(jupiter, Seconds), 2.41).
|
27
|
-
|
28
|
-
age_in_saturn_years_test() ->
|
29
|
-
Seconds = 3000000000,
|
30
|
-
equalFloat(space_age:ageOn(earth, Seconds), 95.06),
|
31
|
-
equalFloat(space_age:ageOn(saturn, Seconds), 3.23).
|
32
|
-
|
33
|
-
age_in_uranus_years_test() ->
|
34
|
-
Seconds = 3210123456,
|
35
|
-
equalFloat(space_age:ageOn(earth, Seconds), 101.72),
|
36
|
-
equalFloat(space_age:ageOn(uranus, Seconds), 1.21).
|
37
|
-
|
38
|
-
age_in_neptune_years_test() ->
|
39
|
-
Seconds = 8210123456,
|
40
|
-
equalFloat(space_age:ageOn(earth, Seconds), 260.16),
|
41
|
-
equalFloat(space_age:ageOn(neptune, Seconds), 1.58).
|
42
|
-
|
43
|
-
equalFloat(A, B) ->
|
44
|
-
?assertEqual(B, round(A,2)).
|
45
|
-
|
46
|
-
round(Number, Precision) ->
|
47
|
-
P = math:pow(10, Precision),
|
48
|
-
round(Number * P) / P.
|
@@ -1,49 +0,0 @@
|
|
1
|
-
-module(strain_tests).
|
2
|
-
|
3
|
-
-include_lib("eunit/include/eunit.hrl").
|
4
|
-
|
5
|
-
empty_keep_test() ->
|
6
|
-
?assertEqual([], strain:keep(fun(X) -> X < 10 end, [])).
|
7
|
-
|
8
|
-
keep_everything_test() ->
|
9
|
-
?assertEqual([1, 2, 3], strain:keep(fun(X) -> X < 10 end, [1,2,3])).
|
10
|
-
|
11
|
-
keep_first_last_test() ->
|
12
|
-
?assertEqual([1, 3], strain:keep(fun(X) -> odd(X) end, [1,2,3])).
|
13
|
-
|
14
|
-
keep_nothin_test() ->
|
15
|
-
?assertEqual([], strain:keep(fun(X) -> even(X) end, [1,3,5,7])).
|
16
|
-
|
17
|
-
keep_neither_first_nor_last_test() ->
|
18
|
-
?assertEqual([2], strain:keep(fun(X) -> even(X) end, [1,2,3])).
|
19
|
-
|
20
|
-
keep_strings_test() ->
|
21
|
-
Str = ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"],
|
22
|
-
?assertEqual(
|
23
|
-
["zebra", "zombies", "zealot"],
|
24
|
-
strain:keep(fun(S) -> string:sub_string(S, 1,1) =:= "z" end, Str)).
|
25
|
-
|
26
|
-
empty_discard_test() ->
|
27
|
-
?assertEqual([], strain:discard(fun(X) -> X < 10 end, [])).
|
28
|
-
|
29
|
-
discard_everything_test() ->
|
30
|
-
?assertEqual([], strain:discard(fun(X) -> X < 10 end, [1,2,3])).
|
31
|
-
|
32
|
-
discard_first_and_last_test() ->
|
33
|
-
?assertEqual([2], strain:discard(fun(X) -> odd(X) end, [1,2,3])).
|
34
|
-
|
35
|
-
discard_nothing_test() ->
|
36
|
-
?assertEqual([1, 3, 5, 7], strain:discard(fun(X) -> even(X) end, [1,3,5,7])).
|
37
|
-
|
38
|
-
discard_neither_first_nor_last_test() ->
|
39
|
-
?assertEqual([1, 3], strain:discard(fun(X) -> even(X) end, [1,2,3])).
|
40
|
-
|
41
|
-
discard_strings_test() ->
|
42
|
-
Str = ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"],
|
43
|
-
?assertEqual(
|
44
|
-
["apple", "banana", "cherimoya"],
|
45
|
-
strain:discard(fun(S) -> string:sub_string(S, 1,1) =:= "z" end, Str)).
|
46
|
-
|
47
|
-
odd(N) -> N rem 2 > 0.
|
48
|
-
|
49
|
-
even(N) -> N rem 2 =:= 0.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
-module(sum_of_multiples_tests).
|
2
|
-
-import(sum_of_multiples, [sumOfMultiples/2]).
|
3
|
-
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
|
-
|
6
|
-
sum_with_3_5_to_1_test() ->
|
7
|
-
?assertEqual(0, sumOfMultiples([3, 5], 1)).
|
8
|
-
|
9
|
-
sum_with_3_5_to_3_test() ->
|
10
|
-
?assertEqual(3, sumOfMultiples([3, 5], 4)).
|
11
|
-
|
12
|
-
sum_with_3_5_to_10_test() ->
|
13
|
-
?assertEqual(23, sumOfMultiples([3, 5], 10)).
|
14
|
-
|
15
|
-
sum_with_3_5_to_100_test() ->
|
16
|
-
?assertEqual(2318, sumOfMultiples([3, 5], 100)).
|
17
|
-
|
18
|
-
sum_with_3_5_to_1000_test() ->
|
19
|
-
?assertEqual(233168, sumOfMultiples([3, 5], 1000)).
|
20
|
-
|
21
|
-
sum_with_7_13_17_to_20_test() ->
|
22
|
-
?assertEqual(51, sumOfMultiples([7,13,17], 20)).
|
23
|
-
|
24
|
-
sum_with_4_6_to_15_test() ->
|
25
|
-
?assertEqual(30, sumOfMultiples([4,6], 15)).
|
26
|
-
|
27
|
-
sum_with_5_6_8_to_150_test() ->
|
28
|
-
?assertEqual(4419, sumOfMultiples([5, 6, 8], 150)).
|
29
|
-
|
30
|
-
sum_with_43_47_to_10000_test() ->
|
31
|
-
?assertEqual(2203160, sumOfMultiples([43,47], 10000)).
|
32
|
-
|
33
|
-
sum_with_1_to_100_test() ->
|
34
|
-
?assertEqual(4950, sumOfMultiples([1], 100)).
|
35
|
-
|
36
|
-
sum_with_empty_to_10000_test() ->
|
37
|
-
?assertEqual(0, sumOfMultiples([], 10000)).
|
@@ -1,37 +0,0 @@
|
|
1
|
-
-module(trinary_tests).
|
2
|
-
-include_lib("eunit/include/eunit.hrl").
|
3
|
-
|
4
|
-
% To run tests:
|
5
|
-
% erl -make
|
6
|
-
% erl -noshell -eval "eunit:test(trinary, [verbose])" -s init stop
|
7
|
-
|
8
|
-
trinary_1_is_decimal_1_test() ->
|
9
|
-
?assertEqual(1, trinary:to_decimal("1")).
|
10
|
-
|
11
|
-
trinary_2_is_decimal_2_test() ->
|
12
|
-
?assertEqual(2, trinary:to_decimal("2")).
|
13
|
-
|
14
|
-
trinary_10_is_decimal_3_test() ->
|
15
|
-
?assertEqual(3, trinary:to_decimal("10")).
|
16
|
-
|
17
|
-
trinary_11_is_decimal_4_test() ->
|
18
|
-
?assertEqual(4, trinary:to_decimal("11")).
|
19
|
-
|
20
|
-
trinary_100_is_decimal_9_test() ->
|
21
|
-
?assertEqual(9, trinary:to_decimal("100")).
|
22
|
-
|
23
|
-
trinary_112_is_decimal_14_test() ->
|
24
|
-
?assertEqual(14, trinary:to_decimal("112")).
|
25
|
-
|
26
|
-
trinary_222_is_decimal_26_test() ->
|
27
|
-
?assertEqual(26, trinary:to_decimal("222")).
|
28
|
-
|
29
|
-
trinary_1120_is_decimal_42_test() ->
|
30
|
-
?assertEqual(42, trinary:to_decimal("1120")).
|
31
|
-
|
32
|
-
trinary_1122000120_is_decimal_32091_test() ->
|
33
|
-
?assertEqual(32091, trinary:to_decimal("1122000120")).
|
34
|
-
|
35
|
-
invalid_trinary_is_decimal_0_test() ->
|
36
|
-
?assertEqual(0, trinary:to_decimal("carrot")).
|
37
|
-
|
@@ -1,103 +0,0 @@
|
|
1
|
-
% To run tests:
|
2
|
-
% erl -make
|
3
|
-
% erl -noshell -eval "eunit:test(zipper, [verbose])" -s init stop
|
4
|
-
|
5
|
-
-module(zipper_tests).
|
6
|
-
-include_lib("eunit/include/eunit.hrl").
|
7
|
-
|
8
|
-
%% Fixtures and helpers
|
9
|
-
|
10
|
-
%% defp bt(value, left, right), do: %BT{value: value, left: left, right: right}
|
11
|
-
%% defp leaf(value), do: %BT{value: value}
|
12
|
-
|
13
|
-
bt(V, L, R) -> zipper:new_tree(V, L, R).
|
14
|
-
empty() -> zipper:empty().
|
15
|
-
leaf(V) -> zipper:new_tree(V, empty(), empty()).
|
16
|
-
|
17
|
-
|
18
|
-
t1() -> bt(1, bt(2, empty(), leaf(3)), leaf(4)).
|
19
|
-
t2() -> bt(1, bt(5, empty(), leaf(3)), leaf(4)).
|
20
|
-
t3() -> bt(1, bt(2, leaf(5), leaf(3)), leaf(4)).
|
21
|
-
t4() -> bt(1, leaf(2), leaf(4)).
|
22
|
-
t5() -> bt(1, bt(2, empty(), leaf(3)), bt(6, leaf(7), leaf(8))).
|
23
|
-
t6() -> bt(1, bt(2, empty(), leaf(5)), leaf(4)).
|
24
|
-
|
25
|
-
data_is_retained_test() ->
|
26
|
-
Exp = t1(),
|
27
|
-
?assertMatch(Exp, zipper:to_tree(zipper:from_tree(t1()))).
|
28
|
-
|
29
|
-
left_right_and_value_test() ->
|
30
|
-
?assertMatch(3, zipper:value(zipper:right(zipper:left(zipper:from_tree(t1()))))).
|
31
|
-
|
32
|
-
dead_end_test() ->
|
33
|
-
Exp = empty(),
|
34
|
-
?assertMatch(Exp, zipper:left(zipper:left(zipper:from_tree(t1())))).
|
35
|
-
|
36
|
-
tree_from_deep_focus_test() ->
|
37
|
-
Exp = t1(),
|
38
|
-
Zipper = zipper:right(zipper:left(zipper:from_tree(t1()))),
|
39
|
-
?assertMatch(Exp, zipper:to_tree(Zipper)).
|
40
|
-
|
41
|
-
traversing_up_from_top_test() ->
|
42
|
-
Exp = empty(),
|
43
|
-
?assertMatch(Exp, zipper:up(zipper:from_tree(t1()))).
|
44
|
-
|
45
|
-
left_right_and_up_test() ->
|
46
|
-
Act0 = zipper:from_tree(t1()),
|
47
|
-
Act1 = zipper:left(Act0),
|
48
|
-
Act2 = zipper:up(Act1),
|
49
|
-
Act3 = zipper:right(Act2),
|
50
|
-
Act4 = zipper:up(Act3),
|
51
|
-
Act5 = zipper:left(Act4),
|
52
|
-
Act6 = zipper:right(Act5),
|
53
|
-
?assertMatch(3, zipper:value(Act6)).
|
54
|
-
|
55
|
-
set_value_test() ->
|
56
|
-
Exp = t2(),
|
57
|
-
Act0 = zipper:from_tree(t1()),
|
58
|
-
Act1 = zipper:left(Act0),
|
59
|
-
Act2 = zipper:set_value(Act1, 5),
|
60
|
-
Act3 = zipper:to_tree(Act2),
|
61
|
-
?assertMatch(Exp, Act3).
|
62
|
-
|
63
|
-
set_value_after_traversiing_up_test() ->
|
64
|
-
Exp = t2(),
|
65
|
-
Act0 = zipper:from_tree(t1()),
|
66
|
-
Act1 = zipper:left(Act0),
|
67
|
-
Act2 = zipper:right(Act1),
|
68
|
-
Act3 = zipper:up(Act2),
|
69
|
-
Act4 = zipper:set_value(Act3, 5),
|
70
|
-
Act5 = zipper:to_tree(Act4),
|
71
|
-
?assertMatch(Exp, Act5).
|
72
|
-
|
73
|
-
set_left_with_leaf_test() ->
|
74
|
-
Exp = t3(),
|
75
|
-
Act0 = zipper:from_tree(t1()),
|
76
|
-
Act1 = zipper:left(Act0),
|
77
|
-
Act2 = zipper:set_left(Act1, leaf(5)),
|
78
|
-
Act3 = zipper:to_tree(Act2),
|
79
|
-
?assertMatch(Exp, Act3).
|
80
|
-
|
81
|
-
set_right_with_empty_test() ->
|
82
|
-
Exp = t4(),
|
83
|
-
Act0 = zipper:from_tree(t1()),
|
84
|
-
Act1 = zipper:left(Act0),
|
85
|
-
Act2 = zipper:set_right(Act1, empty()),
|
86
|
-
Act3 = zipper:to_tree(Act2),
|
87
|
-
?assertMatch(Exp, Act3).
|
88
|
-
|
89
|
-
set_right_with_subtree_test() ->
|
90
|
-
Exp = t5(),
|
91
|
-
Act0 = zipper:from_tree(t1()),
|
92
|
-
Act1 = zipper:set_right(Act0, bt(6, leaf(7), leaf(8))),
|
93
|
-
Act2 = zipper:to_tree(Act1),
|
94
|
-
?assertMatch(Exp, Act2).
|
95
|
-
|
96
|
-
set_value_from_deep_focus_test() ->
|
97
|
-
Exp = t6(),
|
98
|
-
Act0 = zipper:from_tree(t1()),
|
99
|
-
Act1 = zipper:left(Act0),
|
100
|
-
Act2 = zipper:right(Act1),
|
101
|
-
Act3 = zipper:set_value(Act2, 5),
|
102
|
-
Act4 = zipper:to_tree(Act3),
|
103
|
-
?assertMatch(Exp, Act4).
|