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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/beer-song/canonical-data.json +49 -0
  3. data/common/exercises/food-chain/description.md +1 -2
  4. data/common/exercises/list-ops/canonical-data.json +147 -0
  5. data/lib/trackler/version.rb +1 -1
  6. data/tracks/erlang/README.md +2 -3
  7. data/tracks/erlang/exercises/accumulate/include/exercism.hrl +5 -0
  8. data/tracks/erlang/exercises/accumulate/src/example.erl +4 -1
  9. data/tracks/erlang/exercises/accumulate/test/accumulate_tests.erl +2 -3
  10. data/tracks/erlang/exercises/allergies/include/exercism.hrl +5 -0
  11. data/tracks/erlang/exercises/allergies/src/example.erl +4 -1
  12. data/tracks/erlang/exercises/allergies/test/allergies_tests.erl +2 -3
  13. data/tracks/erlang/exercises/anagram/include/exercism.hrl +5 -0
  14. data/tracks/erlang/exercises/anagram/src/example.erl +4 -1
  15. data/tracks/erlang/exercises/anagram/test/anagram_tests.erl +2 -3
  16. data/tracks/erlang/exercises/atbash-cipher/include/exercism.hrl +5 -0
  17. data/tracks/erlang/exercises/atbash-cipher/src/example.erl +4 -1
  18. data/tracks/erlang/exercises/atbash-cipher/test/atbash_cipher_tests.erl +2 -3
  19. data/tracks/erlang/exercises/bank-account/include/exercism.hrl +5 -0
  20. data/tracks/erlang/exercises/bank-account/src/example.erl +5 -1
  21. data/tracks/erlang/exercises/bank-account/test/bank_account_tests.erl +2 -2
  22. data/tracks/erlang/exercises/beer-song/include/exercism.hrl +5 -0
  23. data/tracks/erlang/exercises/beer-song/src/example.erl +5 -1
  24. data/tracks/erlang/exercises/beer-song/test/beer_song_tests.erl +2 -2
  25. data/tracks/erlang/exercises/binary/include/exercism.hrl +5 -0
  26. data/tracks/erlang/exercises/binary/src/example.erl +4 -1
  27. data/tracks/erlang/exercises/binary/test/binary_string_tests.erl +2 -2
  28. data/tracks/erlang/exercises/bob/include/exercism.hrl +5 -0
  29. data/tracks/erlang/exercises/bob/src/example.erl +6 -1
  30. data/tracks/erlang/exercises/bob/test/bob_tests.erl +2 -3
  31. data/tracks/erlang/exercises/circular-buffer/include/exercism.hrl +5 -0
  32. data/tracks/erlang/exercises/circular-buffer/src/example.erl +4 -1
  33. data/tracks/erlang/exercises/circular-buffer/test/circular_buffer_tests.erl +2 -2
  34. data/tracks/erlang/exercises/clock/include/exercism.hrl +5 -0
  35. data/tracks/erlang/exercises/clock/src/example.erl +9 -3
  36. data/tracks/erlang/exercises/clock/test/clock_tests.erl +2 -2
  37. data/tracks/erlang/exercises/difference-of-squares/include/exercism.hrl +5 -0
  38. data/tracks/erlang/exercises/difference-of-squares/src/example.erl +4 -1
  39. data/tracks/erlang/exercises/difference-of-squares/test/difference_of_squares_tests.erl +2 -2
  40. data/tracks/erlang/exercises/etl/include/exercism.hrl +5 -0
  41. data/tracks/erlang/exercises/etl/src/example.erl +6 -1
  42. data/tracks/erlang/exercises/etl/test/etl_tests.erl +2 -2
  43. data/tracks/erlang/exercises/gigasecond/include/exercism.hrl +5 -0
  44. data/tracks/erlang/exercises/gigasecond/src/example.erl +4 -1
  45. data/tracks/erlang/exercises/gigasecond/test/gigasecond_tests.erl +2 -2
  46. data/tracks/erlang/exercises/grade-school/include/exercism.hrl +5 -0
  47. data/tracks/erlang/exercises/grade-school/src/example.erl +4 -1
  48. data/tracks/erlang/exercises/grade-school/test/grade_school_tests.erl +2 -2
  49. data/tracks/erlang/exercises/grains/include/exercism.hrl +5 -0
  50. data/tracks/erlang/exercises/grains/src/example.erl +4 -1
  51. data/tracks/erlang/exercises/grains/test/grains_tests.erl +2 -2
  52. data/tracks/erlang/exercises/hamming/include/exercism.hrl +5 -0
  53. data/tracks/erlang/exercises/hamming/src/example.erl +4 -1
  54. data/tracks/erlang/exercises/hamming/test/hamming_tests.erl +2 -2
  55. data/tracks/erlang/exercises/hello-world/include/exercism.hrl +5 -0
  56. data/tracks/erlang/exercises/hello-world/src/example.erl +4 -1
  57. data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +2 -2
  58. data/tracks/erlang/exercises/largest-series-product/include/exercism.hrl +5 -0
  59. data/tracks/erlang/exercises/largest-series-product/src/example.erl +3 -1
  60. data/tracks/erlang/exercises/largest-series-product/test/largest_series_product_tests.erl +2 -2
  61. data/tracks/erlang/exercises/leap/include/exercism.hrl +5 -0
  62. data/tracks/erlang/exercises/leap/src/example.erl +6 -1
  63. data/tracks/erlang/exercises/leap/test/leap_tests.erl +2 -2
  64. data/tracks/erlang/exercises/luhn/include/exercism.hrl +5 -0
  65. data/tracks/erlang/exercises/luhn/src/example.erl +6 -1
  66. data/tracks/erlang/exercises/luhn/test/luhn_tests.erl +2 -2
  67. data/tracks/erlang/exercises/meetup/include/exercism.hrl +5 -0
  68. data/tracks/erlang/exercises/meetup/src/example.erl +6 -1
  69. data/tracks/erlang/exercises/meetup/test/meetup_tests.erl +2 -2
  70. data/tracks/erlang/exercises/nucleotide-count/include/exercism.hrl +5 -0
  71. data/tracks/erlang/exercises/nucleotide-count/src/example.erl +4 -1
  72. data/tracks/erlang/exercises/nucleotide-count/test/dna_tests.erl +2 -2
  73. data/tracks/erlang/exercises/parallel-letter-frequency/include/exercism.hrl +5 -0
  74. data/tracks/erlang/exercises/parallel-letter-frequency/src/example.erl +3 -1
  75. data/tracks/erlang/exercises/parallel-letter-frequency/test/parallel_letter_frequency_tests.erl +2 -2
  76. data/tracks/erlang/exercises/phone-number/include/exercism.hrl +5 -0
  77. data/tracks/erlang/exercises/phone-number/src/example.erl +4 -1
  78. data/tracks/erlang/exercises/phone-number/test/phone_tests.erl +2 -2
  79. data/tracks/erlang/exercises/rna-transcription/include/exercism.hrl +5 -0
  80. data/tracks/erlang/exercises/rna-transcription/src/example.erl +6 -1
  81. data/tracks/erlang/exercises/rna-transcription/test/rna_transcription_tests.erl +2 -2
  82. data/tracks/erlang/exercises/robot-simulator/include/exercism.hrl +5 -0
  83. data/tracks/erlang/exercises/robot-simulator/src/example.erl +12 -1
  84. data/tracks/erlang/exercises/robot-simulator/test/robot_simulator_tests.erl +2 -2
  85. data/tracks/erlang/exercises/roman-numerals/include/exercism.hrl +5 -0
  86. data/tracks/erlang/exercises/roman-numerals/src/example.erl +6 -1
  87. data/tracks/erlang/exercises/roman-numerals/test/roman_numerals_tests.erl +2 -2
  88. data/tracks/erlang/exercises/scrabble-score/include/exercism.hrl +5 -0
  89. data/tracks/erlang/exercises/scrabble-score/src/example.erl +4 -1
  90. data/tracks/erlang/exercises/scrabble-score/test/scrabble_score_tests.erl +2 -2
  91. data/tracks/erlang/exercises/series/include/exercism.hrl +5 -0
  92. data/tracks/erlang/exercises/series/src/example.erl +3 -1
  93. data/tracks/erlang/exercises/series/test/series_tests.erl +2 -2
  94. data/tracks/erlang/exercises/space-age/include/exercism.hrl +5 -0
  95. data/tracks/erlang/exercises/space-age/src/example.erl +6 -1
  96. data/tracks/erlang/exercises/space-age/test/space_age_tests.erl +2 -2
  97. data/tracks/erlang/exercises/strain/include/exercism.hrl +5 -0
  98. data/tracks/erlang/exercises/strain/src/example.erl +4 -1
  99. data/tracks/erlang/exercises/strain/test/strain_tests.erl +2 -2
  100. data/tracks/erlang/exercises/sum-of-multiples/include/exercism.hrl +5 -0
  101. data/tracks/erlang/exercises/sum-of-multiples/src/example.erl +6 -1
  102. data/tracks/erlang/exercises/sum-of-multiples/test/sum_of_multiples_tests.erl +2 -2
  103. data/tracks/erlang/exercises/triangle/include/exercism.hrl +5 -0
  104. data/tracks/erlang/exercises/triangle/src/example.erl +4 -1
  105. data/tracks/erlang/exercises/triangle/test/triangle_tests.erl +2 -2
  106. data/tracks/erlang/exercises/trinary/include/exercism.hrl +5 -0
  107. data/tracks/erlang/exercises/trinary/src/example.erl +4 -1
  108. data/tracks/erlang/exercises/trinary/test/trinary_tests.erl +2 -2
  109. data/tracks/erlang/exercises/word-count/include/exercism.hrl +5 -0
  110. data/tracks/erlang/exercises/word-count/src/example.erl +6 -1
  111. data/tracks/erlang/exercises/word-count/test/word_count_tests.erl +2 -2
  112. data/tracks/erlang/exercises/zipper/include/exercism.hrl +5 -0
  113. data/tracks/erlang/exercises/zipper/src/example.erl +4 -5
  114. data/tracks/erlang/exercises/zipper/test/zipper_tests.erl +2 -2
  115. data/tracks/go/exercises/pangram/pangram_test.go +9 -1
  116. data/tracks/java/.travis.yml +8 -0
  117. data/tracks/java/README.md +1 -1
  118. data/tracks/julia/config.json +11 -1
  119. data/tracks/julia/exercises/sieve/example.jl +15 -0
  120. data/tracks/julia/exercises/sieve/runtests.jl +37 -0
  121. data/tracks/julia/exercises/sieve/sieve.jl +3 -0
  122. data/tracks/objective-c/circle.yml +6 -0
  123. data/tracks/ocaml/SETUP.md +1 -13
  124. data/tracks/ocaml/exercises/atbash-cipher/test.ml +38 -29
  125. data/tracks/ocaml/tools/test-generator/src/codegen.ml +4 -3
  126. data/tracks/ocaml/tools/test-generator/src/controller.ml +1 -1
  127. data/tracks/ocaml/tools/test-generator/src/model.ml +16 -33
  128. data/tracks/ocaml/tools/test-generator/src/parser.ml +2 -35
  129. data/tracks/ocaml/tools/test-generator/src/special_cases.ml +36 -23
  130. data/tracks/ocaml/tools/test-generator/templates/anagram/template.ml +1 -1
  131. data/tracks/ocaml/tools/test-generator/templates/atbash-cipher/template.ml +24 -0
  132. data/tracks/ocaml/tools/test-generator/templates/bob/template.ml +1 -1
  133. data/tracks/ocaml/tools/test-generator/templates/bracket-push/template.ml +1 -1
  134. data/tracks/ocaml/tools/test-generator/templates/hamming/template.ml +1 -1
  135. data/tracks/ocaml/tools/test-generator/templates/hello-world/template.ml +1 -1
  136. data/tracks/ocaml/tools/test-generator/templates/luhn/template.ml +1 -1
  137. data/tracks/ocaml/tools/test-generator/templates/pangram/template.ml +1 -1
  138. data/tracks/ocaml/tools/test-generator/templates/raindrops/template.ml +1 -1
  139. data/tracks/ocaml/tools/test-generator/templates/word-count/template.ml +1 -1
  140. data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +5 -3
  141. data/tracks/ocaml/tools/test-generator/test/model_test.ml +2 -20
  142. data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -19
  143. data/tracks/ocaml/tools/test-generator/test/special_cases_test.ml +7 -6
  144. data/tracks/perl6/config.json +5 -0
  145. data/tracks/perl6/exercises/hello-world/Example.pm +5 -0
  146. data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +15 -0
  147. data/tracks/perl6/exercises/hello-world/hello-world.t +32 -0
  148. metadata +12 -2
@@ -1,9 +1,9 @@
1
1
  -module(rna_transcription_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(rna_transcription))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(rna_transcription))).
7
7
 
8
8
  transcribes_cytidine_unchanged_test() ->
9
9
  ?assertEqual("C", ?TESTED_MODULE:to_rna("G")).
@@ -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,14 @@
1
1
  -module( example ).
2
2
 
3
- -export( [advance/1, control/2, create/0, direction/1, left/1, place/3, position/1, right/1] ).
3
+ -export([advance/1,
4
+ control/2,
5
+ create/0,
6
+ direction/1,
7
+ left/1,
8
+ place/3,
9
+ position/1,
10
+ right/1,
11
+ test_version/0]).
4
12
 
5
13
  advance( Robot ) -> Robot ! advance.
6
14
 
@@ -20,6 +28,9 @@ position( Robot ) -> request( Robot, position ).
20
28
 
21
29
  right( Robot ) -> Robot ! {turn, right}.
22
30
 
31
+ test_version() ->
32
+ 1.
33
+
23
34
 
24
35
 
25
36
  control_function( $A ) -> fun advance/1;
@@ -1,9 +1,9 @@
1
1
  -module( robot_simulator_tests ).
2
2
 
3
+ -define(TESTED_MODULE, (sut(robot_simulator))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib( "eunit/include/eunit.hrl" ).
5
6
 
6
- -define(TESTED_MODULE, (sut(robot_simulator))).
7
7
 
8
8
  create_test() ->
9
9
  Robot = ?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,6 +1,6 @@
1
1
  -module(example).
2
2
 
3
- -export([numerals/1]).
3
+ -export([numerals/1, test_version/0]).
4
4
 
5
5
  -define(DIGITS, [{"M", 1000}, {"CM", 900}, {"D", 500}, {"CD", 400},
6
6
  {"C", 100}, {"XC", 90}, {"L", 50}, {"XL", 40},
@@ -10,6 +10,11 @@
10
10
  numerals(Number) ->
11
11
  to_roman(Number, "", ?DIGITS).
12
12
 
13
+ test_version() ->
14
+ 1.
15
+
16
+
17
+
13
18
  to_roman(0, Roman, _) -> Roman;
14
19
  to_roman(N, Roman, Digits) ->
15
20
  {R, D} = hd(Digits),
@@ -1,9 +1,9 @@
1
1
  -module(roman_numerals_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(roman_numerals))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(roman_numerals))).
7
7
 
8
8
  expect_roman(Number, Expected) ->
9
9
  ?assertEqual(?TESTED_MODULE:numerals(Number), Expected).
@@ -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,10 +1,13 @@
1
1
  -module(example).
2
2
 
3
- -export([score/1]).
3
+ -export([score/1, test_version/0]).
4
4
 
5
5
  score( Word ) ->
6
6
  lists:foldl(fun(X, Sum) -> get_char_value(X) + Sum end, 0, Word).
7
7
 
8
+ test_version() ->
9
+ 1.
10
+
8
11
  get_char_value( $q ) -> 10;
9
12
  get_char_value( $z ) -> 10;
10
13
  get_char_value( $j ) -> 8;
@@ -1,9 +1,9 @@
1
1
  -module(scrabble_score_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(scrabble))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(scrabble))).
7
7
 
8
8
  -define(checkScore(N, S), ?assertEqual(N, ?TESTED_MODULE:score(S))).
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,9 +1,11 @@
1
1
  -module( example ).
2
2
 
3
- -export( [from_string/2] ).
3
+ -export( [from_string/2, test_version/0] ).
4
4
 
5
5
  from_string( Width, String ) -> rows( erlang:length(String), Width, String ).
6
6
 
7
+ test_version() ->
8
+ 1.
7
9
 
8
10
 
9
11
  rows( Length, Width, [_H | T]=String ) when Length > Width ->
@@ -1,9 +1,9 @@
1
1
  -module( series_tests ).
2
2
 
3
+ -define(TESTED_MODULE, (sut(series))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib( "eunit/include/eunit.hrl" ).
5
6
 
6
- -define(TESTED_MODULE, (sut(series))).
7
7
 
8
8
  three_test() -> ?assert( ?TESTED_MODULE:from_string(3, "01234") =:= ["012", "123", "234"] ).
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,12 +1,17 @@
1
1
  -module(example).
2
2
 
3
- -export([ageOn/2]).
3
+ -export([ageOn/2, test_version/0]).
4
4
 
5
5
  -type planets() :: mercury | venus | earth | mars | jupiter | saturn | uranus | neptune.
6
6
  -spec ageOn(planets(), integer()) -> float().
7
7
  ageOn(Planet, Seconds) ->
8
8
  Seconds / secondsPerYear(Planet).
9
9
 
10
+ test_version() ->
11
+ 1.
12
+
13
+
14
+
10
15
  secondsPerYear (mercury) ->
11
16
  earthYear() * 0.2408467;
12
17
  secondsPerYear (venus) ->
@@ -1,9 +1,9 @@
1
1
  -module(space_age_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(space_age))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(space_age))).
7
7
 
8
8
  age_in_earth_years_test() ->
9
9
  equalFloat(?TESTED_MODULE:ageOn(earth, 1000000000), 31.69).
@@ -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([keep/2, discard/2]).
3
+ -export([keep/2, discard/2, test_version/0]).
4
4
 
5
5
  -spec keep(fun((any()) -> boolean()), list(any())) -> list(any()).
6
6
  keep(_F, []) ->
@@ -14,3 +14,6 @@ keep(F, [H|T]) ->
14
14
  -spec discard(fun((any()) -> boolean()), list(any())) -> list(any()).
15
15
  discard(F, L) ->
16
16
  keep(fun(X) -> not(F(X)) end, L).
17
+
18
+ test_version() ->
19
+ 1.
@@ -1,9 +1,9 @@
1
1
  -module(strain_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(strain))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(strain))).
7
7
 
8
8
  empty_keep_test() ->
9
9
  ?assertEqual([], ?TESTED_MODULE:keep(fun(X) -> X < 10 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([sumOfMultiples/2]).
3
+ -export([sumOfMultiples/2, test_version/0]).
4
4
 
5
5
  -import(lists, [foldl/3, seq/2, any/2]).
6
6
 
@@ -14,5 +14,10 @@ sumOfMultiples(Multiples, A) ->
14
14
  0,
15
15
  seq(1, A-1)).
16
16
 
17
+ test_version() ->
18
+ 1.
19
+
20
+
21
+
17
22
  multiple(List, X) ->
18
23
  any(fun(E) -> (X rem E) =:= 0 end, List).
@@ -1,9 +1,9 @@
1
1
  -module(sum_of_multiples_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(sum_of_multiples))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(sum_of_multiples))).
7
7
 
8
8
  sum_with_3_5_to_1_test() ->
9
9
  ?assertEqual(0, ?TESTED_MODULE:sumOfMultiples([3, 5], 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([kind/3]).
3
+ -export([kind/3, test_version/0]).
4
4
 
5
5
  kind(A,B,C) when (A =< 0) or (B =< 0) or (C =< 0) ->
6
6
  {error, "all side lengths must be positive"};
@@ -11,3 +11,6 @@ kind(A,_,A) -> isosceles;
11
11
  kind(A,A,_) -> isosceles;
12
12
  kind(_,B,B) -> isosceles;
13
13
  kind(_,_,_) -> scalene.
14
+
15
+ test_version() ->
16
+ 1.
@@ -1,9 +1,9 @@
1
1
  -module(triangle_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(triangle))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(triangle))).
7
7
 
8
8
  equilateral_triangles_have_equal_sides_test() ->
9
9
  ?assertMatch(equilateral, ?TESTED_MODULE:kind(2,2,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,5 +1,5 @@
1
1
  -module(example).
2
- -export([to_decimal/1]).
2
+ -export([to_decimal/1, test_version/0]).
3
3
  -define(BASE, 3).
4
4
 
5
5
  %%
@@ -16,6 +16,9 @@ to_decimal(StringNumeric) ->
16
16
  % integer sum
17
17
  round(lists:sum(Tokens)).
18
18
 
19
+ test_version() ->
20
+ 1.
21
+
19
22
  %%
20
23
  %% if string is all numeric, return it; otherwise, return given default
21
24
  %%
@@ -1,9 +1,9 @@
1
1
  -module(trinary_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(trinary))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(trinary))).
7
7
 
8
8
  trinary_1_is_decimal_1_test() ->
9
9
  ?assertEqual(1, ?TESTED_MODULE:to_decimal("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([count/1]).
2
+ -export([count/1, test_version/0]).
3
3
 
4
4
  -spec count(string()) -> dict:dict(string(), integer()).
5
5
  count(S) ->
@@ -7,6 +7,11 @@ count(S) ->
7
7
  dict:new(),
8
8
  tokenize(string:to_lower(S))).
9
9
 
10
+ test_version() ->
11
+ 1.
12
+
13
+
14
+
10
15
  is_alnum(C) ->
11
16
  (C >= $a andalso C =< $z) orelse (C >= $0 andalso C =< $9).
12
17
 
@@ -1,9 +1,9 @@
1
1
  -module(word_count_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(word_count))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(word_count))).
7
7
 
8
8
  count_one_word_test() ->
9
9
  assert_count(
@@ -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([new_tree/3, empty/0]).
3
+ -export([new_tree/3, empty/0, test_version/0]).
4
4
 
5
5
  -export([from_tree/1, to_tree/1, up/1, left/1, right/1, value/1, set_value/2, set_left/2, set_right/2]).
6
6
 
@@ -28,6 +28,9 @@ new_tree(Value, Left, Right) ->
28
28
 
29
29
  empty() -> nil.
30
30
 
31
+ test_version() ->
32
+ 1.
33
+
31
34
  %% Zipper API
32
35
  %% ==========
33
36
 
@@ -78,7 +81,3 @@ set_left(Z = #zipper{}, L) ->
78
81
 
79
82
  set_right(Z = #zipper{}, R) ->
80
83
  Z#zipper{right = R}.
81
-
82
- %% Local Variables:
83
- %% erlang-check-module-name: nil
84
- %% End:
@@ -1,9 +1,9 @@
1
1
  -module(zipper_tests).
2
2
 
3
+ -define(TESTED_MODULE, (sut(zipper))).
4
+ -define(TEST_VERSION, 1).
3
5
  -include("exercism.hrl").
4
- -include_lib("eunit/include/eunit.hrl").
5
6
 
6
- -define(TESTED_MODULE, (sut(zipper))).
7
7
 
8
8
  %% Fixtures and helpers
9
9
 
@@ -26,7 +26,7 @@ var testCases = []testCase{
26
26
 
27
27
  func TestTestVersion(t *testing.T) {
28
28
  if testVersion != targetTestVersion {
29
- t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
29
+ t.Fatalf("Found testVersion = %v, want %v.", testVersion, targetTestVersion)
30
30
  }
31
31
  }
32
32
 
@@ -41,3 +41,11 @@ func TestPangram(t *testing.T) {
41
41
  }
42
42
  }
43
43
  }
44
+
45
+ func BenchmarkPangram(b *testing.B) {
46
+ for i := 0; i < b.N; i++ {
47
+ for _, test := range testCases {
48
+ IsPangram(test.input)
49
+ }
50
+ }
51
+ }
@@ -3,6 +3,14 @@ language: java
3
3
  jdk:
4
4
  - oraclejdk8
5
5
 
6
+ notifications:
7
+ webhooks:
8
+ urls:
9
+ - https://webhooks.gitter.im/e/5e9ccd41111917b19478
10
+ on_success: change # options: [always|never|change] default: always
11
+ on_failure: always # options: [always|never|change] default: always
12
+ on_start: never # options: [always|never|change] default: always
13
+
6
14
  # http://docs.travis-ci.com/user/migrating-from-legacy
7
15
  sudo: false
8
16
  cache: bundler
@@ -1,4 +1,4 @@
1
- # xJava [![Build Status](https://travis-ci.org/exercism/xjava.svg?branch=master)](https://travis-ci.org/exercism/xjava)
1
+ # xJava [![Build Status](https://travis-ci.org/exercism/xjava.svg?branch=master)](https://travis-ci.org/exercism/xjava) [![Join the chat at https://gitter.im/exercism/xjava](https://badges.gitter.im/exercism/xjava.svg)](https://gitter.im/exercism/xjava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
2
 
3
3
  Source for Exercism Exercises in Java.
4
4
 
@@ -3,7 +3,6 @@
3
3
  "language": "Julia",
4
4
  "repository": "https://github.com/exercism/xjulia",
5
5
  "active": false,
6
- "test_pattern": "TODO",
7
6
  "exercises": [
8
7
  {
9
8
  "slug": "hello-world",
@@ -96,6 +95,17 @@
96
95
  "control-flow (if-else statements)"
97
96
  ]
98
97
  },
98
+ {
99
+ "slug": "sieve",
100
+ "difficulty": 2,
101
+ "topics": [
102
+ "control-flow (loops)",
103
+ "control-flow (conditionals)",
104
+ "mathematics",
105
+ "arrays",
106
+ "filtering"
107
+ ]
108
+ },
99
109
  {
100
110
  "slug": "trinary",
101
111
  "difficulty": 2,
@@ -0,0 +1,15 @@
1
+ function sieve(limit::Integer)
2
+ limit <= 0 && error("Invalid limit")
3
+ nums = fill(true, limit)
4
+ nums[1] = false
5
+ primes = []
6
+ while (i = findfirst(nums)) > 0
7
+ push!(primes, i)
8
+ for j = find(nums)
9
+ if j % i == 0
10
+ nums[j] = false
11
+ end
12
+ end
13
+ end
14
+ primes
15
+ end
@@ -0,0 +1,37 @@
1
+ using Base.Test
2
+
3
+ include("sieve.jl")
4
+
5
+ @testset "no primes under two" begin
6
+ @test sieve(1) == []
7
+ end
8
+
9
+ @testset "find first prime" begin
10
+ @test sieve(2) == [2]
11
+ end
12
+
13
+ @testset "find primes up to 10" begin
14
+ @test sieve(10) == [2, 3, 5, 7]
15
+ end
16
+
17
+ @testset "limit is prime" begin
18
+ @test sieve(13) == [2, 3, 5, 7, 11, 13]
19
+ end
20
+
21
+ @testset "find primes up to 1000" begin
22
+ @test sieve(1000) == [
23
+ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
24
+ 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
25
+ 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
26
+ 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,
27
+ 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
28
+ 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
29
+ 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
30
+ 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,
31
+ 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
32
+ 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
33
+ 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,
34
+ 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
35
+ 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
36
+ ]
37
+ end
@@ -0,0 +1,3 @@
1
+ function sieve(limit::Integer)
2
+
3
+ end
@@ -0,0 +1,6 @@
1
+ machine:
2
+ xcode:
3
+ version: "8.2"
4
+ test:
5
+ override:
6
+ -echo 'i am working'