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
@@ -1,9 +1,10 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
3
|
-export([create/2,
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
is_equal/2,
|
5
|
+
minutes_add/2,
|
6
|
+
to_string/1,
|
7
|
+
test_version/0]).
|
7
8
|
|
8
9
|
-record(?MODULE, {normalized}).
|
9
10
|
|
@@ -29,6 +30,11 @@ to_string(#?MODULE{normalized = Mins}) ->
|
|
29
30
|
Minutes = Mins rem ?MINUTES_PER_HOUR,
|
30
31
|
lists:flatten(io_lib:format("~2.10.0b:~2.10.0b", [Hour, Minutes])).
|
31
32
|
|
33
|
+
test_version() ->
|
34
|
+
1.
|
35
|
+
|
36
|
+
|
37
|
+
|
32
38
|
mod(X, Y) when X > 0 -> X rem Y;
|
33
39
|
mod(X, Y) when X < 0 -> Y + X rem Y;
|
34
40
|
mod(0, _Y) -> 0.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module('clock_tests').
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(clock))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(clock))).
|
7
7
|
|
8
8
|
-define(assertClockString(String, Hour, Minute), ?assertEqual(String, ?TESTED_MODULE:to_string(?TESTED_MODULE:create( Hour, Minute)))).
|
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( [sum_of_squares/1, square_of_sums/1, difference_of_squares/1] ).
|
3
|
+
-export( [sum_of_squares/1, square_of_sums/1, difference_of_squares/1, test_version/0] ).
|
4
4
|
|
5
5
|
sum_of_squares( N ) -> lists:sum( [square(X) || X <- lists:seq(1, N)] ).
|
6
6
|
|
@@ -8,5 +8,8 @@ square_of_sums( N ) -> square( lists:sum(lists:seq(1, N)) ).
|
|
8
8
|
|
9
9
|
difference_of_squares( N ) -> square_of_sums( N ) - sum_of_squares( N ).
|
10
10
|
|
11
|
+
test_version() ->
|
12
|
+
1.
|
13
|
+
|
11
14
|
|
12
15
|
square( N ) -> erlang:trunc( math:pow(N, 2) ).
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(difference_of_squares_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(difference_of_squares))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(difference_of_squares))).
|
7
7
|
|
8
8
|
-define(assertSumOfSquares(Expected, Number), ?assertEqual(Expected, ?TESTED_MODULE:sum_of_squares(Number))).
|
9
9
|
-define(assertSquareOfSums(Expected, Number), ?assertEqual(Expected, ?TESTED_MODULE:square_of_sums(Number))).
|
@@ -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([transform/1]).
|
3
|
+
-export([transform/1, test_version/0]).
|
4
4
|
|
5
5
|
transform(OldValue) ->
|
6
6
|
orddict:to_list(
|
@@ -11,6 +11,11 @@ transform(OldValue) ->
|
|
11
11
|
)
|
12
12
|
).
|
13
13
|
|
14
|
+
test_version() ->
|
15
|
+
1.
|
16
|
+
|
17
|
+
|
18
|
+
|
14
19
|
invert(Pairs) ->
|
15
20
|
lists:foldl(
|
16
21
|
fun({Key, Values}, A) ->
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(etl_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(etl))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(etl))).
|
7
7
|
|
8
8
|
transform_one_value_test() ->
|
9
9
|
erl_transform([{1, ["a"]}], [{"a", 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,5 +1,5 @@
|
|
1
1
|
-module(example).
|
2
|
-
-export([from/1]).
|
2
|
+
-export([from/1, test_version/0]).
|
3
3
|
|
4
4
|
-define(GIGASECOND, 1000000000).
|
5
5
|
|
@@ -8,3 +8,6 @@ from({Year, Month, Day}) ->
|
|
8
8
|
from(DateTime) ->
|
9
9
|
Seconds = calendar:datetime_to_gregorian_seconds(DateTime),
|
10
10
|
calendar:gregorian_seconds_to_datetime(Seconds + ?GIGASECOND).
|
11
|
+
|
12
|
+
test_version() ->
|
13
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(gigasecond_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(gigasecond))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(gigasecond))).
|
7
7
|
|
8
8
|
one_test() ->
|
9
9
|
Gs = ?TESTED_MODULE:from({2011, 4, 25}),
|
@@ -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([add/3, get/2, sort/1, new/0]).
|
3
|
+
-export([add/3, get/2, sort/1, new/0, test_version/0]).
|
4
4
|
|
5
5
|
%% Define the grade school type
|
6
6
|
-type school() :: [{integer(),[string(),...]}].
|
@@ -28,3 +28,6 @@ sort(S) ->
|
|
28
28
|
-spec new() -> school().
|
29
29
|
new() ->
|
30
30
|
[].
|
31
|
+
|
32
|
+
test_version() ->
|
33
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(grade_school_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(grade_school))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(grade_school))).
|
7
7
|
|
8
8
|
add_student_test() ->
|
9
9
|
S1 = ?TESTED_MODULE:add("Aimee", 2, ?TESTED_MODULE:new()),
|
@@ -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([square/1, total/0]).
|
2
|
+
-export([square/1, total/0, test_version/0]).
|
3
3
|
|
4
4
|
square(N) ->
|
5
5
|
square(N, 1).
|
@@ -14,3 +14,6 @@ total() ->
|
|
14
14
|
lists:foldl(fun(Elem, Acc) -> square(Elem) + Acc end,
|
15
15
|
0,
|
16
16
|
lists:seq(1, 64)).
|
17
|
+
|
18
|
+
test_version() ->
|
19
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(grains_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(grains))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(grains))).
|
7
7
|
|
8
8
|
-define(assertGrains(Grains, Square), ?assertMatch(Grains, ?TESTED_MODULE:square(Square))).
|
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([hamming_distance/2]).
|
3
|
+
-export([hamming_distance/2, test_version/0]).
|
4
4
|
|
5
5
|
hamming_distance(From, To) ->
|
6
6
|
Comparisons = lists:zipwith(fun(X,Y) -> case X =:= Y of
|
@@ -10,3 +10,6 @@ hamming_distance(From, To) ->
|
|
10
10
|
end,
|
11
11
|
From, To),
|
12
12
|
lists:sum(Comparisons).
|
13
|
+
|
14
|
+
test_version() ->
|
15
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(hamming_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(hamming))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(hamming))).
|
7
7
|
|
8
8
|
empty_test()->
|
9
9
|
?assertEqual(0, ?TESTED_MODULE:hamming_distance("", "")).
|
@@ -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,9 +1,9 @@
|
|
1
1
|
-module(hello_world_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(hello_world))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(hello_world))).
|
7
7
|
|
8
8
|
no_name_test() ->
|
9
9
|
?assertEqual("Hello, World!", ?TESTED_MODULE:greet()).
|
@@ -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,12 +1,14 @@
|
|
1
1
|
-module(example).
|
2
2
|
|
3
|
-
-export([lsp/2]).
|
3
|
+
-export([lsp/2, test_version/0]).
|
4
4
|
|
5
5
|
-define(is_digit(C), ((C >= $0) and (C =< $9))).
|
6
6
|
|
7
7
|
lsp(_String, N) when N < 0 -> error;
|
8
8
|
lsp(String, N) -> lsp(erlang:length(String), String, N).
|
9
9
|
|
10
|
+
test_version() ->
|
11
|
+
1.
|
10
12
|
|
11
13
|
|
12
14
|
lsp(Length, _String, N) when Length < N -> error;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module('largest_series_product_tests').
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(largest_series_product))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(largest_series_product))).
|
7
7
|
|
8
8
|
can_find_the_largest_product_of_2_with_numbers_in_order_test() ->
|
9
9
|
?assertEqual(72, ?TESTED_MODULE:lsp("0123456789", 2)).
|
@@ -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([leap_year/1]).
|
3
|
+
-export([leap_year/1, test_version/0]).
|
4
4
|
|
5
5
|
-spec leap_year(non_neg_integer()) -> boolean().
|
6
6
|
leap_year(Year) ->
|
@@ -8,5 +8,10 @@ leap_year(Year) ->
|
|
8
8
|
orelse (divisible_by(Year, 4) andalso
|
9
9
|
not divisible_by(Year, 100)).
|
10
10
|
|
11
|
+
test_version() ->
|
12
|
+
1.
|
13
|
+
|
14
|
+
|
15
|
+
|
11
16
|
divisible_by(Year, Number) ->
|
12
17
|
Year rem Number =:= 0.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(leap_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(leap))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(leap))).
|
7
7
|
|
8
8
|
leap_year_test() ->
|
9
9
|
?assert(?TESTED_MODULE:leap_year(1996)).
|
@@ -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([valid/1, create/1, checksum/1]).
|
2
|
+
-export([valid/1, create/1, checksum/1, test_version/0]).
|
3
3
|
|
4
4
|
|
5
5
|
|
@@ -40,3 +40,8 @@ valid(Number) ->
|
|
40
40
|
|
41
41
|
create(Number) ->
|
42
42
|
lists:flatten([Number, ($: - (checksum(Number ++ [$0]) rem 10))]).
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
test_version() ->
|
47
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(luhn_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(luhn))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(luhn))).
|
7
7
|
|
8
8
|
invalid_test() ->
|
9
9
|
?assertNot(?TESTED_MODULE:valid("1111")),
|
@@ -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([schedule/4]).
|
2
|
+
-export([schedule/4, test_version/0]).
|
3
3
|
|
4
4
|
-type year() :: non_neg_integer().
|
5
5
|
-type month() :: 1..12.
|
@@ -18,6 +18,11 @@ schedule(Year, Month, DayOfWeek, Period) ->
|
|
18
18
|
calendar:day_of_the_week({Year, Month, Day}) =:= DoW],
|
19
19
|
{Year, Month, Day}.
|
20
20
|
|
21
|
+
test_version() ->
|
22
|
+
1.
|
23
|
+
|
24
|
+
|
25
|
+
|
21
26
|
day_range(first, _Year, _Month) ->
|
22
27
|
lists:seq(1, 7);
|
23
28
|
day_range(second, _Year, _Month) ->
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(meetup_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(meetup))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(meetup))).
|
7
7
|
|
8
8
|
monteenth_of_may_2013_test() ->
|
9
9
|
?assertEqual({2013, 5, 13},
|
@@ -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([count/2, nucleotide_counts/1, validate/1]).
|
3
|
+
-export([count/2, nucleotide_counts/1, validate/1, test_version/0]).
|
4
4
|
|
5
5
|
count(Dna, N) ->
|
6
6
|
validate(N),
|
@@ -26,3 +26,6 @@ nucleotide_counts(Dna) ->
|
|
26
26
|
{"T", count(Dna, "T")},
|
27
27
|
{"C", count(Dna, "C")},
|
28
28
|
{"G", count(Dna, "G")}].
|
29
|
+
|
30
|
+
test_version() ->
|
31
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(dna_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(dna))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(dna))).
|
7
7
|
|
8
8
|
empty_dna_string_has_no_adenine_test() ->
|
9
9
|
?assertEqual(0, ?TESTED_MODULE:count("", "A")).
|
@@ -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,12 +1,14 @@
|
|
1
1
|
-module( example ).
|
2
2
|
|
3
|
-
-export( [dict/1] ).
|
3
|
+
-export( [dict/1, test_version/0] ).
|
4
4
|
|
5
5
|
dict( Texts ) ->
|
6
6
|
Pids = [letter_frequency(X) || X <- Texts],
|
7
7
|
Dicts = [receive_dict(X) || X <- Pids],
|
8
8
|
merge_dicts( Dicts ).
|
9
9
|
|
10
|
+
test_version() ->
|
11
|
+
1.
|
10
12
|
|
11
13
|
|
12
14
|
letter_frequency( String ) ->
|
data/tracks/erlang/exercises/parallel-letter-frequency/test/parallel_letter_frequency_tests.erl
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
-module( parallel_letter_frequency_tests ).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(parallel_letter_frequency))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib( "eunit/include/eunit.hrl" ).
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(parallel_letter_frequency))).
|
7
7
|
|
8
8
|
single_test() ->
|
9
9
|
Frequencies = dict:to_list( ?TESTED_MODULE:dict(["asd"]) ),
|
@@ -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([number/1, areacode/1, pretty_print/1]).
|
3
|
+
-export([number/1, areacode/1, pretty_print/1, test_version/0]).
|
4
4
|
|
5
5
|
-define(ZEROS, "0000000000").
|
6
6
|
|
@@ -33,3 +33,6 @@ areacode(String) ->
|
|
33
33
|
pretty_print(String) ->
|
34
34
|
{AreaCode, Exchange, Subscriber} = parts(String),
|
35
35
|
lists:flatten(io_lib:format("\(~s\) ~s-~s", [AreaCode, Exchange, Subscriber])).
|
36
|
+
|
37
|
+
test_version() ->
|
38
|
+
1.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
-module(phone_tests).
|
2
2
|
|
3
|
+
-define(TESTED_MODULE, (sut(phone))).
|
4
|
+
-define(TEST_VERSION, 1).
|
3
5
|
-include("exercism.hrl").
|
4
|
-
-include_lib("eunit/include/eunit.hrl").
|
5
6
|
|
6
|
-
-define(TESTED_MODULE, (sut(phone))).
|
7
7
|
|
8
8
|
cleans_number_test() ->
|
9
9
|
?assertEqual("1234567890", ?TESTED_MODULE:number("(123) 456-7890")).
|
@@ -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()).
|