trackler 2.0.6.30 → 2.0.6.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/beer-song/canonical-data.json +49 -0
- data/common/exercises/food-chain/description.md +1 -2
- data/common/exercises/list-ops/canonical-data.json +147 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/erlang/README.md +2 -3
- data/tracks/erlang/exercises/accumulate/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/accumulate/src/example.erl +4 -1
- data/tracks/erlang/exercises/accumulate/test/accumulate_tests.erl +2 -3
- data/tracks/erlang/exercises/allergies/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/allergies/src/example.erl +4 -1
- data/tracks/erlang/exercises/allergies/test/allergies_tests.erl +2 -3
- data/tracks/erlang/exercises/anagram/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/anagram/src/example.erl +4 -1
- data/tracks/erlang/exercises/anagram/test/anagram_tests.erl +2 -3
- data/tracks/erlang/exercises/atbash-cipher/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/atbash-cipher/src/example.erl +4 -1
- data/tracks/erlang/exercises/atbash-cipher/test/atbash_cipher_tests.erl +2 -3
- data/tracks/erlang/exercises/bank-account/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/bank-account/src/example.erl +5 -1
- data/tracks/erlang/exercises/bank-account/test/bank_account_tests.erl +2 -2
- data/tracks/erlang/exercises/beer-song/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/beer-song/src/example.erl +5 -1
- data/tracks/erlang/exercises/beer-song/test/beer_song_tests.erl +2 -2
- data/tracks/erlang/exercises/binary/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/binary/src/example.erl +4 -1
- data/tracks/erlang/exercises/binary/test/binary_string_tests.erl +2 -2
- data/tracks/erlang/exercises/bob/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/bob/src/example.erl +6 -1
- data/tracks/erlang/exercises/bob/test/bob_tests.erl +2 -3
- data/tracks/erlang/exercises/circular-buffer/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/circular-buffer/src/example.erl +4 -1
- data/tracks/erlang/exercises/circular-buffer/test/circular_buffer_tests.erl +2 -2
- data/tracks/erlang/exercises/clock/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/clock/src/example.erl +9 -3
- data/tracks/erlang/exercises/clock/test/clock_tests.erl +2 -2
- data/tracks/erlang/exercises/difference-of-squares/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/difference-of-squares/src/example.erl +4 -1
- data/tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl +2 -2
- data/tracks/erlang/exercises/etl/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/etl/src/example.erl +6 -1
- data/tracks/erlang/exercises/etl/test/etl_tests.erl +2 -2
- data/tracks/erlang/exercises/gigasecond/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/gigasecond/src/example.erl +4 -1
- data/tracks/erlang/exercises/gigasecond/test/gigasecond_tests.erl +2 -2
- data/tracks/erlang/exercises/grade-school/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/grade-school/src/example.erl +4 -1
- data/tracks/erlang/exercises/grade-school/test/grade_school_tests.erl +2 -2
- data/tracks/erlang/exercises/grains/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/grains/src/example.erl +4 -1
- data/tracks/erlang/exercises/grains/test/grains_tests.erl +2 -2
- data/tracks/erlang/exercises/hamming/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/hamming/src/example.erl +4 -1
- data/tracks/erlang/exercises/hamming/test/hamming_tests.erl +2 -2
- data/tracks/erlang/exercises/hello-world/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/hello-world/src/example.erl +4 -1
- data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +2 -2
- data/tracks/erlang/exercises/largest-series-product/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/largest-series-product/src/example.erl +3 -1
- data/tracks/erlang/exercises/largest-series-product/test/largest_series_product_tests.erl +2 -2
- data/tracks/erlang/exercises/leap/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/leap/src/example.erl +6 -1
- data/tracks/erlang/exercises/leap/test/leap_tests.erl +2 -2
- data/tracks/erlang/exercises/luhn/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/luhn/src/example.erl +6 -1
- data/tracks/erlang/exercises/luhn/test/luhn_tests.erl +2 -2
- data/tracks/erlang/exercises/meetup/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/meetup/src/example.erl +6 -1
- data/tracks/erlang/exercises/meetup/test/meetup_tests.erl +2 -2
- data/tracks/erlang/exercises/nucleotide-count/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/nucleotide-count/src/example.erl +4 -1
- data/tracks/erlang/exercises/nucleotide-count/test/dna_tests.erl +2 -2
- data/tracks/erlang/exercises/parallel-letter-frequency/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/src/example.erl +3 -1
- data/tracks/erlang/exercises/parallel-letter-frequency/test/parallel_letter_frequency_tests.erl +2 -2
- data/tracks/erlang/exercises/phone-number/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/phone-number/src/example.erl +4 -1
- data/tracks/erlang/exercises/phone-number/test/phone_tests.erl +2 -2
- data/tracks/erlang/exercises/rna-transcription/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/rna-transcription/src/example.erl +6 -1
- data/tracks/erlang/exercises/rna-transcription/test/rna_transcription_tests.erl +2 -2
- data/tracks/erlang/exercises/robot-simulator/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/robot-simulator/src/example.erl +12 -1
- data/tracks/erlang/exercises/robot-simulator/test/robot_simulator_tests.erl +2 -2
- data/tracks/erlang/exercises/roman-numerals/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/roman-numerals/src/example.erl +6 -1
- data/tracks/erlang/exercises/roman-numerals/test/roman_numerals_tests.erl +2 -2
- data/tracks/erlang/exercises/scrabble-score/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/scrabble-score/src/example.erl +4 -1
- data/tracks/erlang/exercises/scrabble-score/test/scrabble_score_tests.erl +2 -2
- data/tracks/erlang/exercises/series/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/series/src/example.erl +3 -1
- data/tracks/erlang/exercises/series/test/series_tests.erl +2 -2
- data/tracks/erlang/exercises/space-age/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/space-age/src/example.erl +6 -1
- data/tracks/erlang/exercises/space-age/test/space_age_tests.erl +2 -2
- data/tracks/erlang/exercises/strain/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/strain/src/example.erl +4 -1
- data/tracks/erlang/exercises/strain/test/strain_tests.erl +2 -2
- data/tracks/erlang/exercises/sum-of-multiples/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/sum-of-multiples/src/example.erl +6 -1
- data/tracks/erlang/exercises/sum-of-multiples/test/sum_of_multiples_tests.erl +2 -2
- data/tracks/erlang/exercises/triangle/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/triangle/src/example.erl +4 -1
- data/tracks/erlang/exercises/triangle/test/triangle_tests.erl +2 -2
- data/tracks/erlang/exercises/trinary/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/trinary/src/example.erl +4 -1
- data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +2 -2
- data/tracks/erlang/exercises/word-count/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/word-count/src/example.erl +6 -1
- data/tracks/erlang/exercises/word-count/test/word_count_tests.erl +2 -2
- data/tracks/erlang/exercises/zipper/include/exercism.hrl +5 -0
- data/tracks/erlang/exercises/zipper/src/example.erl +4 -5
- data/tracks/erlang/exercises/zipper/test/zipper_tests.erl +2 -2
- data/tracks/go/exercises/pangram/pangram_test.go +9 -1
- data/tracks/java/.travis.yml +8 -0
- data/tracks/java/README.md +1 -1
- data/tracks/julia/config.json +11 -1
- data/tracks/julia/exercises/sieve/example.jl +15 -0
- data/tracks/julia/exercises/sieve/runtests.jl +37 -0
- data/tracks/julia/exercises/sieve/sieve.jl +3 -0
- data/tracks/objective-c/circle.yml +6 -0
- data/tracks/ocaml/SETUP.md +1 -13
- data/tracks/ocaml/exercises/atbash-cipher/test.ml +38 -29
- data/tracks/ocaml/tools/test-generator/src/codegen.ml +4 -3
- data/tracks/ocaml/tools/test-generator/src/controller.ml +1 -1
- data/tracks/ocaml/tools/test-generator/src/model.ml +16 -33
- data/tracks/ocaml/tools/test-generator/src/parser.ml +2 -35
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +36 -23
- data/tracks/ocaml/tools/test-generator/templates/anagram/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/atbash-cipher/template.ml +24 -0
- data/tracks/ocaml/tools/test-generator/templates/bob/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/bracket-push/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/hamming/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/hello-world/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/luhn/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/pangram/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/raindrops/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/word-count/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +5 -3
- data/tracks/ocaml/tools/test-generator/test/model_test.ml +2 -20
- data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -19
- data/tracks/ocaml/tools/test-generator/test/special_cases_test.ml +7 -6
- data/tracks/perl6/config.json +5 -0
- data/tracks/perl6/exercises/hello-world/Example.pm +5 -0
- data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +15 -0
- data/tracks/perl6/exercises/hello-world/hello-world.t +32 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce72cb821d80518789fa621475071a4dbb30197a
|
4
|
+
data.tar.gz: b7b14debc8e89d780f361c1419aea892a3bca8c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe5a09839008c9ec917ea7410db0a82a41afba57c16e986e928817cec9dbff96377c07d1cc9604915519e20c689ae431c54c9b33550bbedc5efed724d738b132
|
7
|
+
data.tar.gz: a5647458958f9a1540c0320b5eb0dce76e98a8010c76a73fddb6f8bc90298490c836b00bbd5f4eed81795d9084a72b1cdc650474921364023956d3202844bbc4
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"verse": {
|
3
|
+
"description": "return 1 verse",
|
4
|
+
"cases": [
|
5
|
+
{
|
6
|
+
"description": "first verse",
|
7
|
+
"number": 99,
|
8
|
+
"expected": "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"description": "middle verse",
|
12
|
+
"number": 44,
|
13
|
+
"expected": "44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"description": "third to last verse",
|
17
|
+
"number": 2,
|
18
|
+
"expected": "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"description": "penultimate verse",
|
22
|
+
"number": 1,
|
23
|
+
"expected": "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"description": "last verse",
|
27
|
+
"number": 0,
|
28
|
+
"expected": "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"lyrics": {
|
33
|
+
"description": "return multiple verses",
|
34
|
+
"cases": [
|
35
|
+
{
|
36
|
+
"description": "last 4 verses",
|
37
|
+
"beginning": 3,
|
38
|
+
"end": 0,
|
39
|
+
"expected": "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"description": "all verses",
|
43
|
+
"beginning": 99,
|
44
|
+
"end": 0,
|
45
|
+
"expected": "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n\n97 bottles of beer on the wall, 97 bottles of beer.\nTake one down and pass it around, 96 bottles of beer on the wall.\n\n96 bottles of beer on the wall, 96 bottles of beer.\nTake one down and pass it around, 95 bottles of beer on the wall.\n\n95 bottles of beer on the wall, 95 bottles of beer.\nTake one down and pass it around, 94 bottles of beer on the wall.\n\n94 bottles of beer on the wall, 94 bottles of beer.\nTake one down and pass it around, 93 bottles of beer on the wall.\n\n93 bottles of beer on the wall, 93 bottles of beer.\nTake one down and pass it around, 92 bottles of beer on the wall.\n\n92 bottles of beer on the wall, 92 bottles of beer.\nTake one down and pass it around, 91 bottles of beer on the wall.\n\n91 bottles of beer on the wall, 91 bottles of beer.\nTake one down and pass it around, 90 bottles of beer on the wall.\n\n90 bottles of beer on the wall, 90 bottles of beer.\nTake one down and pass it around, 89 bottles of beer on the wall.\n\n89 bottles of beer on the wall, 89 bottles of beer.\nTake one down and pass it around, 88 bottles of beer on the wall.\n\n88 bottles of beer on the wall, 88 bottles of beer.\nTake one down and pass it around, 87 bottles of beer on the wall.\n\n87 bottles of beer on the wall, 87 bottles of beer.\nTake one down and pass it around, 86 bottles of beer on the wall.\n\n86 bottles of beer on the wall, 86 bottles of beer.\nTake one down and pass it around, 85 bottles of beer on the wall.\n\n85 bottles of beer on the wall, 85 bottles of beer.\nTake one down and pass it around, 84 bottles of beer on the wall.\n\n84 bottles of beer on the wall, 84 bottles of beer.\nTake one down and pass it around, 83 bottles of beer on the wall.\n\n83 bottles of beer on the wall, 83 bottles of beer.\nTake one down and pass it around, 82 bottles of beer on the wall.\n\n82 bottles of beer on the wall, 82 bottles of beer.\nTake one down and pass it around, 81 bottles of beer on the wall.\n\n81 bottles of beer on the wall, 81 bottles of beer.\nTake one down and pass it around, 80 bottles of beer on the wall.\n\n80 bottles of beer on the wall, 80 bottles of beer.\nTake one down and pass it around, 79 bottles of beer on the wall.\n\n79 bottles of beer on the wall, 79 bottles of beer.\nTake one down and pass it around, 78 bottles of beer on the wall.\n\n78 bottles of beer on the wall, 78 bottles of beer.\nTake one down and pass it around, 77 bottles of beer on the wall.\n\n77 bottles of beer on the wall, 77 bottles of beer.\nTake one down and pass it around, 76 bottles of beer on the wall.\n\n76 bottles of beer on the wall, 76 bottles of beer.\nTake one down and pass it around, 75 bottles of beer on the wall.\n\n75 bottles of beer on the wall, 75 bottles of beer.\nTake one down and pass it around, 74 bottles of beer on the wall.\n\n74 bottles of beer on the wall, 74 bottles of beer.\nTake one down and pass it around, 73 bottles of beer on the wall.\n\n73 bottles of beer on the wall, 73 bottles of beer.\nTake one down and pass it around, 72 bottles of beer on the wall.\n\n72 bottles of beer on the wall, 72 bottles of beer.\nTake one down and pass it around, 71 bottles of beer on the wall.\n\n71 bottles of beer on the wall, 71 bottles of beer.\nTake one down and pass it around, 70 bottles of beer on the wall.\n\n70 bottles of beer on the wall, 70 bottles of beer.\nTake one down and pass it around, 69 bottles of beer on the wall.\n\n69 bottles of beer on the wall, 69 bottles of beer.\nTake one down and pass it around, 68 bottles of beer on the wall.\n\n68 bottles of beer on the wall, 68 bottles of beer.\nTake one down and pass it around, 67 bottles of beer on the wall.\n\n67 bottles of beer on the wall, 67 bottles of beer.\nTake one down and pass it around, 66 bottles of beer on the wall.\n\n66 bottles of beer on the wall, 66 bottles of beer.\nTake one down and pass it around, 65 bottles of beer on the wall.\n\n65 bottles of beer on the wall, 65 bottles of beer.\nTake one down and pass it around, 64 bottles of beer on the wall.\n\n64 bottles of beer on the wall, 64 bottles of beer.\nTake one down and pass it around, 63 bottles of beer on the wall.\n\n63 bottles of beer on the wall, 63 bottles of beer.\nTake one down and pass it around, 62 bottles of beer on the wall.\n\n62 bottles of beer on the wall, 62 bottles of beer.\nTake one down and pass it around, 61 bottles of beer on the wall.\n\n61 bottles of beer on the wall, 61 bottles of beer.\nTake one down and pass it around, 60 bottles of beer on the wall.\n\n60 bottles of beer on the wall, 60 bottles of beer.\nTake one down and pass it around, 59 bottles of beer on the wall.\n\n59 bottles of beer on the wall, 59 bottles of beer.\nTake one down and pass it around, 58 bottles of beer on the wall.\n\n58 bottles of beer on the wall, 58 bottles of beer.\nTake one down and pass it around, 57 bottles of beer on the wall.\n\n57 bottles of beer on the wall, 57 bottles of beer.\nTake one down and pass it around, 56 bottles of beer on the wall.\n\n56 bottles of beer on the wall, 56 bottles of beer.\nTake one down and pass it around, 55 bottles of beer on the wall.\n\n55 bottles of beer on the wall, 55 bottles of beer.\nTake one down and pass it around, 54 bottles of beer on the wall.\n\n54 bottles of beer on the wall, 54 bottles of beer.\nTake one down and pass it around, 53 bottles of beer on the wall.\n\n53 bottles of beer on the wall, 53 bottles of beer.\nTake one down and pass it around, 52 bottles of beer on the wall.\n\n52 bottles of beer on the wall, 52 bottles of beer.\nTake one down and pass it around, 51 bottles of beer on the wall.\n\n51 bottles of beer on the wall, 51 bottles of beer.\nTake one down and pass it around, 50 bottles of beer on the wall.\n\n50 bottles of beer on the wall, 50 bottles of beer.\nTake one down and pass it around, 49 bottles of beer on the wall.\n\n49 bottles of beer on the wall, 49 bottles of beer.\nTake one down and pass it around, 48 bottles of beer on the wall.\n\n48 bottles of beer on the wall, 48 bottles of beer.\nTake one down and pass it around, 47 bottles of beer on the wall.\n\n47 bottles of beer on the wall, 47 bottles of beer.\nTake one down and pass it around, 46 bottles of beer on the wall.\n\n46 bottles of beer on the wall, 46 bottles of beer.\nTake one down and pass it around, 45 bottles of beer on the wall.\n\n45 bottles of beer on the wall, 45 bottles of beer.\nTake one down and pass it around, 44 bottles of beer on the wall.\n\n44 bottles of beer on the wall, 44 bottles of beer.\nTake one down and pass it around, 43 bottles of beer on the wall.\n\n43 bottles of beer on the wall, 43 bottles of beer.\nTake one down and pass it around, 42 bottles of beer on the wall.\n\n42 bottles of beer on the wall, 42 bottles of beer.\nTake one down and pass it around, 41 bottles of beer on the wall.\n\n41 bottles of beer on the wall, 41 bottles of beer.\nTake one down and pass it around, 40 bottles of beer on the wall.\n\n40 bottles of beer on the wall, 40 bottles of beer.\nTake one down and pass it around, 39 bottles of beer on the wall.\n\n39 bottles of beer on the wall, 39 bottles of beer.\nTake one down and pass it around, 38 bottles of beer on the wall.\n\n38 bottles of beer on the wall, 38 bottles of beer.\nTake one down and pass it around, 37 bottles of beer on the wall.\n\n37 bottles of beer on the wall, 37 bottles of beer.\nTake one down and pass it around, 36 bottles of beer on the wall.\n\n36 bottles of beer on the wall, 36 bottles of beer.\nTake one down and pass it around, 35 bottles of beer on the wall.\n\n35 bottles of beer on the wall, 35 bottles of beer.\nTake one down and pass it around, 34 bottles of beer on the wall.\n\n34 bottles of beer on the wall, 34 bottles of beer.\nTake one down and pass it around, 33 bottles of beer on the wall.\n\n33 bottles of beer on the wall, 33 bottles of beer.\nTake one down and pass it around, 32 bottles of beer on the wall.\n\n32 bottles of beer on the wall, 32 bottles of beer.\nTake one down and pass it around, 31 bottles of beer on the wall.\n\n31 bottles of beer on the wall, 31 bottles of beer.\nTake one down and pass it around, 30 bottles of beer on the wall.\n\n30 bottles of beer on the wall, 30 bottles of beer.\nTake one down and pass it around, 29 bottles of beer on the wall.\n\n29 bottles of beer on the wall, 29 bottles of beer.\nTake one down and pass it around, 28 bottles of beer on the wall.\n\n28 bottles of beer on the wall, 28 bottles of beer.\nTake one down and pass it around, 27 bottles of beer on the wall.\n\n27 bottles of beer on the wall, 27 bottles of beer.\nTake one down and pass it around, 26 bottles of beer on the wall.\n\n26 bottles of beer on the wall, 26 bottles of beer.\nTake one down and pass it around, 25 bottles of beer on the wall.\n\n25 bottles of beer on the wall, 25 bottles of beer.\nTake one down and pass it around, 24 bottles of beer on the wall.\n\n24 bottles of beer on the wall, 24 bottles of beer.\nTake one down and pass it around, 23 bottles of beer on the wall.\n\n23 bottles of beer on the wall, 23 bottles of beer.\nTake one down and pass it around, 22 bottles of beer on the wall.\n\n22 bottles of beer on the wall, 22 bottles of beer.\nTake one down and pass it around, 21 bottles of beer on the wall.\n\n21 bottles of beer on the wall, 21 bottles of beer.\nTake one down and pass it around, 20 bottles of beer on the wall.\n\n20 bottles of beer on the wall, 20 bottles of beer.\nTake one down and pass it around, 19 bottles of beer on the wall.\n\n19 bottles of beer on the wall, 19 bottles of beer.\nTake one down and pass it around, 18 bottles of beer on the wall.\n\n18 bottles of beer on the wall, 18 bottles of beer.\nTake one down and pass it around, 17 bottles of beer on the wall.\n\n17 bottles of beer on the wall, 17 bottles of beer.\nTake one down and pass it around, 16 bottles of beer on the wall.\n\n16 bottles of beer on the wall, 16 bottles of beer.\nTake one down and pass it around, 15 bottles of beer on the wall.\n\n15 bottles of beer on the wall, 15 bottles of beer.\nTake one down and pass it around, 14 bottles of beer on the wall.\n\n14 bottles of beer on the wall, 14 bottles of beer.\nTake one down and pass it around, 13 bottles of beer on the wall.\n\n13 bottles of beer on the wall, 13 bottles of beer.\nTake one down and pass it around, 12 bottles of beer on the wall.\n\n12 bottles of beer on the wall, 12 bottles of beer.\nTake one down and pass it around, 11 bottles of beer on the wall.\n\n11 bottles of beer on the wall, 11 bottles of beer.\nTake one down and pass it around, 10 bottles of beer on the wall.\n\n10 bottles of beer on the wall, 10 bottles of beer.\nTake one down and pass it around, 9 bottles of beer on the wall.\n\n9 bottles of beer on the wall, 9 bottles of beer.\nTake one down and pass it around, 8 bottles of beer on the wall.\n\n8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n5 bottles of beer on the wall, 5 bottles of beer.\nTake one down and pass it around, 4 bottles of beer on the wall.\n\n4 bottles of beer on the wall, 4 bottles of beer.\nTake one down and pass it around, 3 bottles of beer on the wall.\n\n3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,147 @@
|
|
1
|
+
{
|
2
|
+
"#": [
|
3
|
+
"Though there are no specifications here for dealing with large lists,",
|
4
|
+
"implementers may add tests for handling large lists to ensure that the",
|
5
|
+
"solutions have thought about performance concerns."
|
6
|
+
],
|
7
|
+
"append": {
|
8
|
+
"description": "append entries to a list and return the new list",
|
9
|
+
"cases": [
|
10
|
+
{
|
11
|
+
"description": "empty lists",
|
12
|
+
"list1": [],
|
13
|
+
"list2": [],
|
14
|
+
"expected": []
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"description": "empty list to list",
|
18
|
+
"list1": [],
|
19
|
+
"list2": [1,2,3,4],
|
20
|
+
"expected": [1,2,3,4]
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"description": "non-empty lists",
|
24
|
+
"list1": [1,2],
|
25
|
+
"list2": [2,3,4,5],
|
26
|
+
"expected": [1,2,2,3,4,5]
|
27
|
+
}
|
28
|
+
]
|
29
|
+
},
|
30
|
+
"concat": {
|
31
|
+
"description": "concat lists and lists of list into a new list",
|
32
|
+
"cases": [
|
33
|
+
{
|
34
|
+
"description": "empty list",
|
35
|
+
"lists": [],
|
36
|
+
"expected": []
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"description": "list of lists",
|
40
|
+
"lists": [[1,2],[3],[],[4,5,6]],
|
41
|
+
"expected": [1,2,3,4,5,6]
|
42
|
+
}
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"filter": {
|
46
|
+
"description": "filter list returning only values that satisfy the filter function",
|
47
|
+
"cases": [
|
48
|
+
{
|
49
|
+
"description": "empty list",
|
50
|
+
"list": [],
|
51
|
+
"function": "value modulo 2 == 1",
|
52
|
+
"expected": []
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"description": "non-empty list",
|
56
|
+
"list": [1,2,3,5],
|
57
|
+
"function": "value modulo 2 == 1",
|
58
|
+
"expected": [1,3,5]
|
59
|
+
}
|
60
|
+
]
|
61
|
+
},
|
62
|
+
"length": {
|
63
|
+
"description": "returns the length of a list",
|
64
|
+
"cases": [
|
65
|
+
{
|
66
|
+
"description": "empty list",
|
67
|
+
"list": [],
|
68
|
+
"expected": 0
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"description": "non-empty list",
|
72
|
+
"list": [1,2,3,4],
|
73
|
+
"expected": 4
|
74
|
+
}
|
75
|
+
]
|
76
|
+
},
|
77
|
+
"map": {
|
78
|
+
"description": "return a list of elements whos values equal the list value transformed by the mapping function",
|
79
|
+
"cases": [
|
80
|
+
{
|
81
|
+
"description": "empty list",
|
82
|
+
"list": [],
|
83
|
+
"function": "value + 1",
|
84
|
+
"expected": []
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"description": "non-empty list",
|
88
|
+
"list": [1,3,5,7],
|
89
|
+
"function": "value + 1",
|
90
|
+
"expected": [2,4,6,8]
|
91
|
+
}
|
92
|
+
]
|
93
|
+
},
|
94
|
+
"foldl": {
|
95
|
+
"description": "folds (reduces) the given list from the left with a function",
|
96
|
+
"cases": [
|
97
|
+
{
|
98
|
+
"description": "empty list",
|
99
|
+
"list": [],
|
100
|
+
"initial": 2,
|
101
|
+
"function": "value / accumulator",
|
102
|
+
"expected": 2
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"description": "division of integers",
|
106
|
+
"list": [1,2,3,4],
|
107
|
+
"initial": 24,
|
108
|
+
"function": "value / accumulator",
|
109
|
+
"expected": 64
|
110
|
+
}
|
111
|
+
]
|
112
|
+
},
|
113
|
+
"foldr": {
|
114
|
+
"description": "folds (reduces) the given list from the right with a function",
|
115
|
+
"cases": [
|
116
|
+
{
|
117
|
+
"description": "empty list",
|
118
|
+
"list": [],
|
119
|
+
"initial": 2,
|
120
|
+
"function": "value / accumulator",
|
121
|
+
"expected": 2
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"description": "division of integers",
|
125
|
+
"list": [1,2,3,4],
|
126
|
+
"initial": 24,
|
127
|
+
"function": "value / accumulator",
|
128
|
+
"expected": 9
|
129
|
+
}
|
130
|
+
]
|
131
|
+
},
|
132
|
+
"reverse": {
|
133
|
+
"description": "reverse the elements of the list",
|
134
|
+
"cases": [
|
135
|
+
{
|
136
|
+
"description": "empty list",
|
137
|
+
"list": [],
|
138
|
+
"expected": []
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"description": "non-empty list",
|
142
|
+
"list": [1,3,5,7],
|
143
|
+
"expected": [7,5,3,1]
|
144
|
+
}
|
145
|
+
]
|
146
|
+
}
|
147
|
+
}
|
data/lib/trackler/version.rb
CHANGED
data/tracks/erlang/README.md
CHANGED
@@ -68,10 +68,9 @@ students if the exercise becomes tricky or might not be obvious.
|
|
68
68
|
```erl
|
69
69
|
-module(<test module name>).
|
70
70
|
|
71
|
-
-include("exercism.hrl").
|
72
|
-
-include_lib("eunit/include/eunit.hrl").
|
73
|
-
|
74
71
|
-define(TESTED_MODULE, (sut(<erlangified_slug_name>))).
|
72
|
+
-define(TEST_VERSION, 1).
|
73
|
+
-include("exercism.hrl").
|
75
74
|
```
|
76
75
|
|
77
76
|
### Before pushing
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,5 +1,5 @@
|
|
1
1
|
-module(example).
|
2
|
-
-export([accumulate/2]).
|
2
|
+
-export([accumulate/2, test_version/0]).
|
3
3
|
|
4
4
|
%%
|
5
5
|
%% given a fun and a list, apply fun to each list item replacing list item with fun's return value.
|
@@ -9,3 +9,6 @@ accumulate(Fn, List) -> accumulate(List, Fn, []).
|
|
9
9
|
|
10
10
|
accumulate([H|T], Fn, Out) -> accumulate(T, Fn, [Fn(H) | Out]);
|
11
11
|
accumulate([], _Fn, Out) -> lists:reverse(Out).
|
12
|
+
|
13
|
+
test_version() ->
|
14
|
+
1.
|
@@ -1,9 +1,8 @@
|
|
1
1
|
-module(accumulate_tests).
|
2
2
|
|
3
|
-
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
|
-
|
6
3
|
-define(TESTED_MODULE, (sut(accumulate))).
|
4
|
+
-define(TEST_VERSION, 1).
|
5
|
+
-include("exercism.hrl").
|
7
6
|
|
8
7
|
accumulate_squares_test() ->
|
9
8
|
Fn = fun(Number) -> Number * Number end,
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export([allergies/1, is_allergic_to/2]).
|
3
|
+
-export([allergies/1, is_allergic_to/2, test_version/0]).
|
4
4
|
|
5
5
|
-define(ALLERGIES, ['eggs', % 2^0
|
6
6
|
'peanuts', % 2^1
|
@@ -32,3 +32,6 @@ index(Index, [_|Allergies], A) ->
|
|
32
32
|
index(Index+1, Allergies, A);
|
33
33
|
index(_, [], _) ->
|
34
34
|
not_found.
|
35
|
+
|
36
|
+
test_version() ->
|
37
|
+
1.
|
@@ -1,9 +1,8 @@
|
|
1
1
|
-module(allergies_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(accumulate))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
|
-
|
6
|
-
-define(TESTED_MODULE, (sut(allergies))).
|
7
6
|
|
8
7
|
no_allergies_at_all_test() ->
|
9
8
|
?assertEqual([], ?TESTED_MODULE:allergies(0)).
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export([find/2]).
|
3
|
+
-export([find/2, test_version/0]).
|
4
4
|
|
5
5
|
-spec find(string(), [string()]) -> [string()].
|
6
6
|
find(Word, Candidates) ->
|
@@ -21,3 +21,6 @@ anagram_check({Lower, Sorted}) ->
|
|
21
21
|
normalize(S) ->
|
22
22
|
Lower = string:to_lower(S),
|
23
23
|
{Lower, lists:sort(Lower)}.
|
24
|
+
|
25
|
+
test_version() ->
|
26
|
+
1.
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export([encode/1, decode/1]).
|
3
|
+
-export([encode/1, decode/1, test_version/0]).
|
4
4
|
|
5
5
|
encode(String) ->
|
6
6
|
join(chunk(convert(String), 5)).
|
@@ -8,6 +8,9 @@ encode(String) ->
|
|
8
8
|
decode(String) ->
|
9
9
|
convert(String).
|
10
10
|
|
11
|
+
test_version() ->
|
12
|
+
1.
|
13
|
+
|
11
14
|
%% Basic conversion routines
|
12
15
|
convert(String) ->
|
13
16
|
lists:filtermap(fun encode_char/1, String).
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,7 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export( [balance/1, charge/2, close/1, create/0, deposit/2, withdraw/2] ).
|
3
|
+
-export( [balance/1, charge/2, close/1, create/0, deposit/2, withdraw/2, test_version/0] ).
|
4
|
+
|
4
5
|
|
5
6
|
balance( Pid ) -> call( erlang:is_process_alive(Pid), Pid, balance, 0 ).
|
6
7
|
|
@@ -17,6 +18,9 @@ deposit( _Pid, _Amount ) -> ok.
|
|
17
18
|
withdraw( Pid, Amount ) when Amount > 0 -> call( erlang:is_process_alive(Pid), Pid, withdraw, Amount );
|
18
19
|
withdraw( _Pid, _Amount ) -> 0.
|
19
20
|
|
21
|
+
test_version() ->
|
22
|
+
1.
|
23
|
+
|
20
24
|
|
21
25
|
|
22
26
|
call( true, Pid, Request, Argument ) ->
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(bank_account_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(bank_account))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(bank_account))).
|
7
7
|
|
8
8
|
create_test() ->
|
9
9
|
BankAccount = ?TESTED_MODULE:create(),
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,5 +1,6 @@
|
|
1
1
|
-module(example).
|
2
|
-
|
2
|
+
|
3
|
+
-export([verse/1, sing/1, sing/2, test_version/0]).
|
3
4
|
|
4
5
|
bottles(0) ->
|
5
6
|
"no more bottles";
|
@@ -28,3 +29,6 @@ sing(N) ->
|
|
28
29
|
-spec sing(non_neg_integer(), non_neg_integer()) -> iolist().
|
29
30
|
sing(From, To) ->
|
30
31
|
lists:map(fun (N) -> [verse(N), "\n"] end, lists:seq(From, To, -1)).
|
32
|
+
|
33
|
+
test_version() ->
|
34
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(beer_song_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(beer_song))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(beer_song))).
|
7
7
|
|
8
8
|
verse_test() ->
|
9
9
|
compare_nested_lists(?TESTED_MODULE:verse(8),
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,5 +1,5 @@
|
|
1
1
|
-module(example). % binary is a "sticky module" so we have to use another name.
|
2
|
-
-export( [to_decimal/1] ).
|
2
|
+
-export( [to_decimal/1, test_version/0] ).
|
3
3
|
|
4
4
|
to_decimal( String ) ->
|
5
5
|
try
|
@@ -11,6 +11,9 @@ to_decimal( String ) ->
|
|
11
11
|
|
12
12
|
end.
|
13
13
|
|
14
|
+
test_version() ->
|
15
|
+
1.
|
16
|
+
|
14
17
|
|
15
18
|
|
16
19
|
to_decimal( $0, {N, Acc} ) -> {N + 1, Acc};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(binary_string_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(binary_string))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(binary_string))).
|
7
7
|
|
8
8
|
one_test() -> check( "1" ).
|
9
9
|
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export([response_for/1]).
|
3
|
+
-export([response_for/1, test_version/0]).
|
4
4
|
|
5
5
|
-spec response_for(string()) -> string().
|
6
6
|
response_for(String) ->
|
@@ -11,6 +11,11 @@ response_for(String) ->
|
|
11
11
|
{fun is_question/1, "Sure."},
|
12
12
|
{fun (_) -> true end, "Whatever."}]).
|
13
13
|
|
14
|
+
test_version() ->
|
15
|
+
1.
|
16
|
+
|
17
|
+
|
18
|
+
|
14
19
|
first_match(S, [{F, Res} | Fs]) ->
|
15
20
|
case F(S) of
|
16
21
|
true -> Res;
|
@@ -1,9 +1,8 @@
|
|
1
1
|
-module(bob_tests).
|
2
2
|
|
3
|
-
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
|
-
|
6
3
|
-define(TESTED_MODULE, (sut(bob))).
|
4
|
+
-define(TEST_VERSION, 1).
|
5
|
+
-include("exercism.hrl").
|
7
6
|
|
8
7
|
responds_to_something_test() ->
|
9
8
|
bob_responds("Tom-ay-to, tom-aaaah-to.", "Whatever.").
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export( [create/1, read/1, size/1, write/2, write_attempt/2] ).
|
3
|
+
-export( [create/1, read/1, size/1, write/2, write_attempt/2, test_version/0] ).
|
4
4
|
|
5
5
|
create( Size ) -> erlang:spawn( fun() -> loop( 0, Size, queue:new() ) end ).
|
6
6
|
|
@@ -51,3 +51,6 @@ write( Max, Max, Item, Queue ) ->
|
|
51
51
|
|
52
52
|
write_attempt( Max, Max, _Item, Queue ) -> {Max, Queue};
|
53
53
|
write_attempt( Current, Max, Item, Queue ) -> write( Current, Max, Item, Queue ).
|
54
|
+
|
55
|
+
test_version() ->
|
56
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module( circular_buffer_tests ).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(circular_buffer))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib( "eunit/include/eunit.hrl" ).
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(circular_buffer))).
|
7
7
|
|
8
8
|
create_test() ->
|
9
9
|
Pid = ?TESTED_MODULE:create( 5 ),
|
@@ -1,6 +1,11 @@
|
|
1
|
+
-include_lib("eunit/include/eunit.hrl").
|
2
|
+
|
1
3
|
sut(Module) ->
|
2
4
|
{ok, Files} = file:list_dir("./src"),
|
3
5
|
case lists:member(atom_to_list(Module) ++ ".erl", Files) of
|
4
6
|
true -> Module;
|
5
7
|
false -> example
|
6
8
|
end.
|
9
|
+
|
10
|
+
version_test() ->
|
11
|
+
?assertMatch(?TEST_VERSION, ?TESTED_MODULE:test_version()).
|