trackler 2.2.1.95 → 2.2.1.96

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/two-bucket/canonical-data.json +31 -31
  4. data/tracks/csharp/docs/ABOUT.md +21 -3
  5. data/tracks/dart/.travis.yml +1 -2
  6. data/tracks/dart/README.md +2 -2
  7. data/tracks/dart/{tool/create-exercise → bin/create_exercise.dart} +14 -10
  8. data/tracks/dart/test/create_exercise_test.dart +132 -0
  9. data/tracks/dart/test/exercises_test.dart +1 -1
  10. data/tracks/fsharp/exercises/list-ops/Example.fs +5 -5
  11. data/tracks/fsharp/exercises/list-ops/ListOps.fs +1 -1
  12. data/tracks/fsharp/exercises/list-ops/ListOpsTest.fs +41 -62
  13. data/tracks/fsharp/generators/Common.fs +3 -0
  14. data/tracks/fsharp/generators/Formatting.fs +3 -1
  15. data/tracks/fsharp/generators/Generators.fs +21 -0
  16. data/tracks/go/config.json +14 -0
  17. data/tracks/go/exercises/grep/.meta/gen.go +76 -0
  18. data/tracks/go/exercises/grep/.meta/hints.md +13 -0
  19. data/tracks/go/exercises/grep/README.md +104 -0
  20. data/tracks/go/exercises/grep/cases_test.go +202 -0
  21. data/tracks/go/exercises/grep/example.go +102 -0
  22. data/tracks/go/exercises/grep/grep_test.go +84 -0
  23. data/tracks/java/exercises/anagram/.meta/version +1 -1
  24. data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +0 -32
  25. data/tracks/java/exercises/space-age/.meta/src/reference/java/SpaceAge.java +0 -4
  26. data/tracks/java/exercises/space-age/.meta/version +1 -0
  27. data/tracks/java/exercises/space-age/src/test/java/SpaceAgeTest.java +0 -16
  28. data/tracks/julia/.gitignore +1 -0
  29. data/tracks/julia/exercises/complex-numbers/{HINTS.md → .meta/hints.md} +0 -0
  30. data/tracks/julia/exercises/custom-set/{HINTS.md → .meta/hints.md} +0 -0
  31. data/tracks/julia/exercises/robot-name/{HINTS.md → .meta/hints.md} +0 -0
  32. data/tracks/julia/exercises/rotational-cipher/{HINTS.md → .meta/hints.md} +0 -0
  33. data/tracks/julia/runtests.jl +24 -25
  34. data/tracks/perl6/.travis.yml +7 -3
  35. data/tracks/perl6/Dockerfile +4 -0
  36. data/tracks/perl6/exercises/accumulate/Accumulate.pm6 +1 -1
  37. data/tracks/perl6/exercises/accumulate/Example.pm6 +1 -1
  38. data/tracks/perl6/exercises/accumulate/accumulate.t +6 -15
  39. data/tracks/perl6/exercises/accumulate/example.yaml +2 -3
  40. data/tracks/perl6/exercises/acronym/Acronym.pm6 +1 -1
  41. data/tracks/perl6/exercises/acronym/Example.pm6 +1 -1
  42. data/tracks/perl6/exercises/acronym/acronym.t +7 -29
  43. data/tracks/perl6/exercises/acronym/example.yaml +2 -3
  44. data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +1 -1
  45. data/tracks/perl6/exercises/all-your-base/Example.pm6 +1 -1
  46. data/tracks/perl6/exercises/all-your-base/all-your-base.t +7 -29
  47. data/tracks/perl6/exercises/all-your-base/example.yaml +2 -3
  48. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
  49. data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
  50. data/tracks/perl6/exercises/allergies/allergies.t +7 -29
  51. data/tracks/perl6/exercises/allergies/example.yaml +2 -3
  52. data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -1
  53. data/tracks/perl6/exercises/anagram/Example.pm6 +1 -1
  54. data/tracks/perl6/exercises/anagram/anagram.t +7 -29
  55. data/tracks/perl6/exercises/anagram/example.yaml +2 -3
  56. data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -1
  57. data/tracks/perl6/exercises/atbash-cipher/Example.pm6 +1 -1
  58. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +7 -29
  59. data/tracks/perl6/exercises/atbash-cipher/example.yaml +2 -3
  60. data/tracks/{julia/exercises/.keep → perl6/exercises/binary/Binary.pm6} +0 -0
  61. data/tracks/perl6/exercises/binary/binary.t +3 -5
  62. data/tracks/perl6/exercises/bob/Bob.pm6 +1 -1
  63. data/tracks/perl6/exercises/bob/Example.pm6 +1 -1
  64. data/tracks/perl6/exercises/bob/bob.t +9 -32
  65. data/tracks/perl6/exercises/bob/example.yaml +3 -7
  66. data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
  67. data/tracks/perl6/exercises/clock/Example.pm6 +1 -1
  68. data/tracks/perl6/exercises/clock/clock.t +12 -32
  69. data/tracks/perl6/exercises/clock/example.yaml +6 -6
  70. data/tracks/perl6/exercises/etl/ETL.pm6 +1 -1
  71. data/tracks/perl6/exercises/etl/Example.pm6 +1 -1
  72. data/tracks/perl6/exercises/etl/etl.t +7 -29
  73. data/tracks/perl6/exercises/etl/example.yaml +2 -3
  74. data/tracks/perl6/exercises/flatten-array/Example.pm6 +1 -1
  75. data/tracks/perl6/exercises/flatten-array/FlattenArray.pm6 +1 -1
  76. data/tracks/perl6/exercises/flatten-array/example.yaml +2 -3
  77. data/tracks/perl6/exercises/flatten-array/flatten-array.t +7 -29
  78. data/tracks/perl6/exercises/grade-school/Example.pm6 +1 -1
  79. data/tracks/perl6/exercises/grade-school/GradeSchool.pm6 +1 -1
  80. data/tracks/perl6/exercises/grade-school/example.yaml +2 -3
  81. data/tracks/perl6/exercises/grade-school/grade-school.t +6 -15
  82. data/tracks/perl6/exercises/grains/Example.pm6 +1 -1
  83. data/tracks/perl6/exercises/grains/Grains.pm6 +1 -1
  84. data/tracks/perl6/exercises/grains/example.yaml +2 -3
  85. data/tracks/perl6/exercises/grains/grains.t +7 -29
  86. data/tracks/perl6/exercises/hamming/Example.pm6 +1 -1
  87. data/tracks/perl6/exercises/hamming/Hamming.pm6 +1 -1
  88. data/tracks/perl6/exercises/hamming/example.yaml +2 -3
  89. data/tracks/perl6/exercises/hamming/hamming.t +7 -29
  90. data/tracks/perl6/exercises/hello-world/Example.pm6 +1 -1
  91. data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +1 -1
  92. data/tracks/perl6/exercises/hello-world/example.yaml +2 -8
  93. data/tracks/perl6/exercises/hello-world/hello-world.t +7 -33
  94. data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
  95. data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
  96. data/tracks/perl6/exercises/leap/example.yaml +2 -3
  97. data/tracks/perl6/exercises/leap/leap.t +7 -29
  98. data/tracks/perl6/exercises/linked-list/Example.pm6 +1 -1
  99. data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -1
  100. data/tracks/perl6/exercises/linked-list/example.yaml +3 -3
  101. data/tracks/perl6/exercises/linked-list/linked-list.t +9 -16
  102. data/tracks/perl6/exercises/luhn/Example.pm6 +1 -1
  103. data/tracks/perl6/exercises/luhn/Luhn.pm6 +1 -1
  104. data/tracks/perl6/exercises/luhn/example.yaml +2 -3
  105. data/tracks/perl6/exercises/luhn/luhn.t +7 -29
  106. data/tracks/perl6/exercises/meetup/Example.pm6 +1 -1
  107. data/tracks/perl6/exercises/meetup/Meetup.pm6 +1 -1
  108. data/tracks/perl6/exercises/meetup/example.yaml +2 -3
  109. data/tracks/perl6/exercises/meetup/meetup.t +7 -29
  110. data/tracks/perl6/exercises/nucleotide-count/Example.pm6 +1 -1
  111. data/tracks/perl6/exercises/nucleotide-count/NucleotideCount.pm6 +1 -1
  112. data/tracks/perl6/exercises/nucleotide-count/example.yaml +2 -3
  113. data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +7 -29
  114. data/tracks/perl6/exercises/pangram/Example.pm6 +1 -1
  115. data/tracks/perl6/exercises/pangram/Pangram.pm6 +1 -1
  116. data/tracks/perl6/exercises/pangram/example.yaml +2 -3
  117. data/tracks/perl6/exercises/pangram/pangram.t +7 -29
  118. data/tracks/perl6/exercises/phone-number/Example.pm6 +1 -1
  119. data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
  120. data/tracks/perl6/exercises/phone-number/example.yaml +2 -3
  121. data/tracks/perl6/exercises/phone-number/phone-number.t +7 -29
  122. data/tracks/perl6/exercises/raindrops/Example.pm6 +1 -1
  123. data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +1 -1
  124. data/tracks/perl6/exercises/raindrops/example.yaml +2 -3
  125. data/tracks/perl6/exercises/raindrops/raindrops.t +7 -29
  126. data/tracks/perl6/exercises/rna-transcription/Example.pm6 +1 -1
  127. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +1 -1
  128. data/tracks/perl6/exercises/rna-transcription/example.yaml +2 -3
  129. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +7 -29
  130. data/tracks/perl6/exercises/robot-name/Example.pm6 +1 -1
  131. data/tracks/perl6/exercises/robot-name/Robot.pm6 +1 -1
  132. data/tracks/perl6/exercises/robot-name/example.yaml +5 -5
  133. data/tracks/perl6/exercises/robot-name/robot-name.t +10 -17
  134. data/tracks/perl6/exercises/roman-numerals/Example.pm6 +1 -1
  135. data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
  136. data/tracks/perl6/exercises/roman-numerals/example.yaml +2 -3
  137. data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +7 -29
  138. data/tracks/perl6/exercises/scrabble-score/Example.pm6 +1 -1
  139. data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +1 -1
  140. data/tracks/perl6/exercises/scrabble-score/example.yaml +2 -3
  141. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +7 -29
  142. data/tracks/perl6/exercises/space-age/Example.pm6 +1 -1
  143. data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +1 -1
  144. data/tracks/perl6/exercises/space-age/example.yaml +2 -3
  145. data/tracks/perl6/exercises/space-age/space-age.t +7 -29
  146. data/tracks/perl6/exercises/trinary/Trinary.pm6 +0 -0
  147. data/tracks/perl6/exercises/trinary/trinary.t +2 -5
  148. data/tracks/perl6/exercises/two-fer/Example.pm6 +1 -1
  149. data/tracks/perl6/exercises/two-fer/TwoFer.pm6 +1 -1
  150. data/tracks/perl6/exercises/two-fer/example.yaml +2 -8
  151. data/tracks/perl6/exercises/two-fer/two-fer.t +7 -33
  152. data/tracks/perl6/exercises/word-count/Example.pm6 +1 -1
  153. data/tracks/perl6/exercises/word-count/WordCount.pm6 +1 -1
  154. data/tracks/perl6/exercises/word-count/example.yaml +2 -3
  155. data/tracks/perl6/exercises/word-count/word-count.t +7 -29
  156. data/tracks/perl6/exercises/wordy/Example.pm6 +1 -1
  157. data/tracks/perl6/exercises/wordy/Wordy.pm6 +1 -1
  158. data/tracks/perl6/exercises/wordy/example.yaml +2 -3
  159. data/tracks/perl6/exercises/wordy/wordy.t +7 -29
  160. data/tracks/perl6/templates/test.mustache +10 -39
  161. data/tracks/python/config.json +10 -0
  162. data/tracks/python/exercises/all-your-base/all_your_base_test.py +2 -2
  163. data/tracks/python/exercises/binary-search/binary_search_test.py +2 -2
  164. data/tracks/python/exercises/binary/binary_test.py +2 -2
  165. data/tracks/python/exercises/bob/bob_test.py +4 -2
  166. data/tracks/python/exercises/bob/example.py +5 -2
  167. data/tracks/python/exercises/circular-buffer/circular_buffer_test.py +2 -2
  168. data/tracks/python/exercises/custom-set/README.md +20 -0
  169. data/tracks/python/exercises/custom-set/custom_set.py +30 -0
  170. data/tracks/python/exercises/custom-set/custom_set_test.py +212 -0
  171. data/tracks/python/exercises/custom-set/example.py +45 -0
  172. data/tracks/python/exercises/dot-dsl/dot_dsl_test.py +20 -10
  173. data/tracks/python/exercises/error-handling/error_handling_test.py +2 -2
  174. data/tracks/python/exercises/forth/forth_test.py +18 -18
  175. data/tracks/python/exercises/grains/grains_test.py +2 -2
  176. data/tracks/python/exercises/hamming/hamming_test.py +2 -2
  177. data/tracks/python/exercises/hexadecimal/hexadecimal_test.py +2 -2
  178. data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +2 -2
  179. data/tracks/python/exercises/meetup/meetup_test.py +2 -2
  180. data/tracks/python/exercises/minesweeper/minesweeper_test.py +2 -2
  181. data/tracks/python/exercises/nth-prime/nth_prime_test.py +2 -2
  182. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +2 -2
  183. data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +2 -2
  184. data/tracks/python/exercises/octal/octal_test.py +2 -2
  185. data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +2 -2
  186. data/tracks/python/exercises/phone-number/phone_number_test.py +2 -2
  187. data/tracks/python/exercises/pov/pov_test.py +2 -2
  188. data/tracks/python/exercises/protein-translation/protein_translation_test.py +2 -2
  189. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +2 -2
  190. data/tracks/python/exercises/queen-attack/queen_attack_test.py +2 -2
  191. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +2 -2
  192. data/tracks/python/exercises/saddle-points/saddle_points_test.py +2 -2
  193. data/tracks/python/exercises/say/say_test.py +2 -2
  194. data/tracks/python/exercises/scale-generator/scale_generator_test.py +2 -2
  195. data/tracks/python/exercises/series/series_test.py +2 -2
  196. data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +2 -2
  197. data/tracks/python/exercises/simple-linked-list/simple_linked_list_test.py +2 -2
  198. data/tracks/python/exercises/tree-building/tree_building_test.py +2 -2
  199. data/tracks/python/exercises/triangle/example.py +14 -24
  200. data/tracks/python/exercises/triangle/triangle.py +6 -6
  201. data/tracks/python/exercises/triangle/triangle_test.py +42 -44
  202. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity_test.py +2 -2
  203. data/tracks/python/exercises/wordy/wordy_test.py +2 -2
  204. data/tracks/python/test/check-exercises.py +2 -1
  205. metadata +22 -8
@@ -1,4 +1,4 @@
1
- unit module RomanNumerals:ver<1>;
1
+ unit module RomanNumerals:ver<2>;
2
2
 
3
3
 
4
4
  my %table{Int} = <1000 900 500 400 100 90 50 40 10 9 5 4 1>
@@ -1,4 +1,4 @@
1
- unit module RomanNumerals:ver<1>;
1
+ unit module RomanNumerals:ver<2>;
2
2
 
3
3
  sub to-roman ($number) is export {
4
4
  }
@@ -1,7 +1,6 @@
1
1
  exercise: RomanNumerals
2
- version: 1
3
- plan: 20
4
- imports: '&to-roman'
2
+ version: 2
3
+ plan: 18
5
4
  tests: |-
6
5
  for $c-data<cases>.values {
7
6
  is to-roman(.<number>), |.<expected description>;
@@ -1,26 +1,19 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib my $dir = $?FILE.IO.dirname;
5
4
  use JSON::Fast;
5
+ use lib $?FILE.IO.dirname;
6
+ use RomanNumerals;
7
+ plan 18;
6
8
 
7
- my Str:D $exercise := 'RomanNumerals';
8
- my Version:D $version = v1;
9
- my Str $module //= $exercise;
10
- plan 20;
9
+ my Version:D $version = v2;
11
10
 
12
- use-ok $module or bail-out;
13
- require ::($module);
14
-
15
- if ::($exercise).^ver !~~ $version {
11
+ if RomanNumerals.^ver !~~ $version {
16
12
  warn "\nExercise version mismatch. Further tests may fail!"
17
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
18
- ~ "Test is $($version.gist).\n";
19
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
13
+ ~ "\nRomanNumerals is {RomanNumerals.^ver.gist}. "
14
+ ~ "Test is {$version.gist}.\n";
20
15
  }
21
16
 
22
- require ::($module) <&to-roman>;
23
-
24
17
  my $c-data = from-json $=pod.pop.contents;
25
18
  for $c-data<cases>.values {
26
19
  is to-roman(.<number>), |.<expected description>;
@@ -145,18 +138,3 @@ for $c-data<cases>.values {
145
138
  }
146
139
 
147
140
  =end code
148
-
149
- unless %*ENV<EXERCISM> {
150
- skip-rest 'exercism tests';
151
- exit;
152
- }
153
-
154
- subtest 'canonical-data' => {
155
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
156
- $dir.IO.resolve.basename
157
- }/canonical-data.json".IO.resolve) ~~ :f ??
158
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
159
- flunk 'problem-specifications file not found';
160
- }
161
-
162
- INIT { $module = 'Example' if %*ENV<EXERCISM> }
@@ -1,4 +1,4 @@
1
- unit module Scrabble:ver<1>;
1
+ unit module Scrabble:ver<2>;
2
2
 
3
3
  sub score (Str:D $word --> Int:D) is export {
4
4
  my $score = 0;
@@ -1,4 +1,4 @@
1
- unit module Scrabble:ver<1>;
1
+ unit module Scrabble:ver<2>;
2
2
 
3
3
  sub score ($word) is export {
4
4
  }
@@ -1,7 +1,6 @@
1
1
  exercise: Scrabble
2
- version: 1
3
- plan: 13
4
- imports: '&score'
2
+ version: 2
3
+ plan: 11
5
4
  tests: |-
6
5
  is .<input>.&score, |.<expected description> for @($c-data<cases>);
7
6
 
@@ -1,26 +1,19 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib my $dir = $?FILE.IO.dirname;
5
4
  use JSON::Fast;
5
+ use lib $?FILE.IO.dirname;
6
+ use Scrabble;
7
+ plan 11;
6
8
 
7
- my Str:D $exercise := 'Scrabble';
8
- my Version:D $version = v1;
9
- my Str $module //= $exercise;
10
- plan 13;
9
+ my Version:D $version = v2;
11
10
 
12
- use-ok $module or bail-out;
13
- require ::($module);
14
-
15
- if ::($exercise).^ver !~~ $version {
11
+ if Scrabble.^ver !~~ $version {
16
12
  warn "\nExercise version mismatch. Further tests may fail!"
17
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
18
- ~ "Test is $($version.gist).\n";
19
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
13
+ ~ "\nScrabble is {Scrabble.^ver.gist}. "
14
+ ~ "Test is {$version.gist}.\n";
20
15
  }
21
16
 
22
- require ::($module) <&score>;
23
-
24
17
  my $c-data = from-json $=pod.pop.contents;
25
18
  is .<input>.&score, |.<expected description> for @($c-data<cases>);
26
19
 
@@ -101,18 +94,3 @@ is .<input>.&score, |.<expected description> for @($c-data<cases>);
101
94
  }
102
95
 
103
96
  =end code
104
-
105
- unless %*ENV<EXERCISM> {
106
- skip-rest 'exercism tests';
107
- exit;
108
- }
109
-
110
- subtest 'canonical-data' => {
111
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
112
- $dir.IO.resolve.basename
113
- }/canonical-data.json".IO.resolve) ~~ :f ??
114
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
115
- flunk 'problem-specifications file not found';
116
- }
117
-
118
- INIT { $module = 'Example' if %*ENV<EXERCISM> }
@@ -1,4 +1,4 @@
1
- unit module SpaceAge:ver<1>;
1
+ unit module SpaceAge:ver<2>;
2
2
 
3
3
  role Planet {
4
4
  method age-on ($seconds) {
@@ -1,4 +1,4 @@
1
- unit module SpaceAge:ver<1>;
1
+ unit module SpaceAge:ver<2>;
2
2
 
3
3
  role Planet {
4
4
  method age-on ($seconds) {
@@ -1,7 +1,6 @@
1
1
  exercise: SpaceAge
2
- version: 1
3
- plan: 10
4
- imports: Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune
2
+ version: 2
3
+ plan: 8
5
4
  tests: |-
6
5
  is (age-on ::(.<planet>): .<seconds>), |.<expected description> for @($c-data<cases>);
7
6
 
@@ -1,26 +1,19 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib my $dir = $?FILE.IO.dirname;
5
4
  use JSON::Fast;
5
+ use lib $?FILE.IO.dirname;
6
+ use SpaceAge;
7
+ plan 8;
6
8
 
7
- my Str:D $exercise := 'SpaceAge';
8
- my Version:D $version = v1;
9
- my Str $module //= $exercise;
10
- plan 10;
9
+ my Version:D $version = v2;
11
10
 
12
- use-ok $module or bail-out;
13
- require ::($module);
14
-
15
- if ::($exercise).^ver !~~ $version {
11
+ if SpaceAge.^ver !~~ $version {
16
12
  warn "\nExercise version mismatch. Further tests may fail!"
17
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
18
- ~ "Test is $($version.gist).\n";
19
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
13
+ ~ "\nSpaceAge is {SpaceAge.^ver.gist}. "
14
+ ~ "Test is {$version.gist}.\n";
20
15
  }
21
16
 
22
- require ::($module) <Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune>;
23
-
24
17
  my $c-data = from-json $=pod.pop.contents;
25
18
  is (age-on ::(.<planet>): .<seconds>), |.<expected description> for @($c-data<cases>);
26
19
 
@@ -91,18 +84,3 @@ is (age-on ::(.<planet>): .<seconds>), |.<expected description> for @($c-data<ca
91
84
  }
92
85
 
93
86
  =end code
94
-
95
- unless %*ENV<EXERCISM> {
96
- skip-rest 'exercism tests';
97
- exit;
98
- }
99
-
100
- subtest 'canonical-data' => {
101
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
102
- $dir.IO.resolve.basename
103
- }/canonical-data.json".IO.resolve) ~~ :f ??
104
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
105
- flunk 'problem-specifications file not found';
106
- }
107
-
108
- INIT { $module = 'Example' if %*ENV<EXERCISM> }
@@ -1,11 +1,8 @@
1
1
  #!/usr/bin/env perl6
2
2
 
3
3
  use Test;
4
-
5
- use lib ( my $dir = IO::Path.new($?FILE).parent ).path;
6
-
7
- my $module = %*ENV<EXERCISM> ?? 'Example' !! 'Trinary';
8
- require ::($module) <&to-decimal>;
4
+ use lib $?FILE.IO.dirname;
5
+ use Trinary;
9
6
 
10
7
  my @cases = (
11
8
  {
@@ -7,7 +7,7 @@
7
7
  and test suite line up. If the test is updated, it will indicate
8
8
  to others who test your code that some tests may no longer pass.
9
9
  )
10
- unit module TwoFer:ver<1>;
10
+ unit module TwoFer:ver<2>;
11
11
 
12
12
  sub two-fer ($name = ‘you’) is export {
13
13
  “One for $name, one for me.”
@@ -7,7 +7,7 @@
7
7
  and test suite line up. If the test is updated, it will indicate
8
8
  to others who test your code that some tests may no longer pass.
9
9
  )
10
- unit module TwoFer:ver<1>;
10
+ unit module TwoFer:ver<2>;
11
11
 
12
12
  sub two-fer ($name?) is export {
13
13
  # Write your solution to pass the test suite here.
@@ -1,7 +1,6 @@
1
1
  exercise: TwoFer
2
- version: 1
3
- plan: 5
4
- imports: '&two-fer'
2
+ version: 2
3
+ plan: 3
5
4
  tests: |-
6
5
  # Go through the cases and check that &two-fer gives us the correct response.
7
6
  for $c-data<cases>.values {
@@ -11,15 +10,10 @@ tests: |-
11
10
  |.<expected description>;
12
11
  }
13
12
 
14
- exercise_comment: The name of this exercise.
15
- module_comment: The name of the module file to be loaded.
16
13
  version_comment: The version we will be matching against the exercise.
17
14
  lib_comment: Look for the module inside the same directory as this test file.
18
15
  plan_comment: This is how many tests we expect to run.
19
- use_test_comment: Check that the module can be use-d.
20
16
  version_test_comment: "If the exercise is updated, we want to make sure other people testing\nyour code don't think you've made a mistake if things have changed!"
21
- imports_comment: Import '&two-fer' from 'TwoFer'
22
- exercism_comment: "Don't worry about the stuff below here for your exercise.\nThis is for Exercism folks to check that everything is in order."
23
17
 
24
18
  unit: module
25
19
  unit_comment: |-
@@ -1,30 +1,21 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib my $dir = $?FILE.IO.dirname; #`[Look for the module inside the same directory as this test file.]
5
4
  use JSON::Fast;
5
+ use lib $?FILE.IO.dirname; #`[Look for the module inside the same directory as this test file.]
6
+ use TwoFer;
7
+ plan 3; #`[This is how many tests we expect to run.]
6
8
 
7
- my Str:D $exercise := 'TwoFer'; #`[The name of this exercise.]
8
- my Version:D $version = v1; #`[The version we will be matching against the exercise.]
9
- my Str $module //= $exercise; #`[The name of the module file to be loaded.]
10
- plan 5; #`[This is how many tests we expect to run.]
11
-
12
- #`[Check that the module can be use-d.]
13
- use-ok $module or bail-out;
14
- require ::($module);
9
+ my Version:D $version = v2; #`[The version we will be matching against the exercise.]
15
10
 
16
11
  #`[If the exercise is updated, we want to make sure other people testing
17
12
  your code don't think you've made a mistake if things have changed!]
18
- if ::($exercise).^ver !~~ $version {
13
+ if TwoFer.^ver !~~ $version {
19
14
  warn "\nExercise version mismatch. Further tests may fail!"
20
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
21
- ~ "Test is $($version.gist).\n";
22
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
15
+ ~ "\nTwoFer is {TwoFer.^ver.gist}. "
16
+ ~ "Test is {$version.gist}.\n";
23
17
  }
24
18
 
25
- #`[Import '&two-fer' from 'TwoFer']
26
- require ::($module) <&two-fer>;
27
-
28
19
  my $c-data = from-json $=pod.pop.contents;
29
20
  # Go through the cases and check that &two-fer gives us the correct response.
30
21
  for $c-data<cases>.values {
@@ -63,20 +54,3 @@ for $c-data<cases>.values {
63
54
  }
64
55
 
65
56
  =end code
66
-
67
- #`[Don't worry about the stuff below here for your exercise.
68
- This is for Exercism folks to check that everything is in order.]
69
- unless %*ENV<EXERCISM> {
70
- skip-rest 'exercism tests';
71
- exit;
72
- }
73
-
74
- subtest 'canonical-data' => {
75
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
76
- $dir.IO.resolve.basename
77
- }/canonical-data.json".IO.resolve) ~~ :f ??
78
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
79
- flunk 'problem-specifications file not found';
80
- }
81
-
82
- INIT { $module = 'Example' if %*ENV<EXERCISM> }
@@ -1,4 +1,4 @@
1
- unit module WordCount:ver<2>;
1
+ unit module WordCount:ver<3>;
2
2
 
3
3
  sub count-words (Str:D $str --> Hash:D) is export {
4
4
  $str.lc.comb(/ <alnum>+ (\'<alnum>+)? /).Bag.hash
@@ -1,4 +1,4 @@
1
- unit module WordCount:ver<2>;
1
+ unit module WordCount:ver<3>;
2
2
 
3
3
  sub count-words ($str) is export {
4
4
  }
@@ -1,7 +1,6 @@
1
1
  exercise: WordCount
2
- version: 2
3
- plan: 13
4
- imports: '&count-words'
2
+ version: 3
3
+ plan: 11
5
4
  tests: |-
6
5
  is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<cases>);
7
6
 
@@ -1,26 +1,19 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib my $dir = $?FILE.IO.dirname;
5
4
  use JSON::Fast;
5
+ use lib $?FILE.IO.dirname;
6
+ use WordCount;
7
+ plan 11;
6
8
 
7
- my Str:D $exercise := 'WordCount';
8
- my Version:D $version = v2;
9
- my Str $module //= $exercise;
10
- plan 13;
9
+ my Version:D $version = v3;
11
10
 
12
- use-ok $module or bail-out;
13
- require ::($module);
14
-
15
- if ::($exercise).^ver !~~ $version {
11
+ if WordCount.^ver !~~ $version {
16
12
  warn "\nExercise version mismatch. Further tests may fail!"
17
- ~ "\n$exercise is $(::($exercise).^ver.gist). "
18
- ~ "Test is $($version.gist).\n";
19
- bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
13
+ ~ "\nWordCount is {WordCount.^ver.gist}. "
14
+ ~ "Test is {$version.gist}.\n";
20
15
  }
21
16
 
22
- require ::($module) <&count-words>;
23
-
24
17
  my $c-data = from-json $=pod.pop.contents;
25
18
  is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<cases>);
26
19
 
@@ -154,18 +147,3 @@ is-deeply (% = .<input>.&count-words), |.<expected description> for @($c-data<ca
154
147
  }
155
148
 
156
149
  =end code
157
-
158
- unless %*ENV<EXERCISM> {
159
- skip-rest 'exercism tests';
160
- exit;
161
- }
162
-
163
- subtest 'canonical-data' => {
164
- (my $c-data-file = "$dir/../../problem-specifications/exercises/{
165
- $dir.IO.resolve.basename
166
- }/canonical-data.json".IO.resolve) ~~ :f ??
167
- is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
168
- flunk 'problem-specifications file not found';
169
- }
170
-
171
- INIT { $module = 'Example' if %*ENV<EXERCISM> }
@@ -1,4 +1,4 @@
1
- unit module Wordy:ver<1>;
1
+ unit module Wordy:ver<2>;
2
2
 
3
3
  sub answer ($q is copy) is export {
4
4
  given $q {
@@ -1,4 +1,4 @@
1
- unit module Wordy:ver<1>;
1
+ unit module Wordy:ver<2>;
2
2
 
3
3
  sub answer ($question) is export {
4
4
  }
@@ -1,7 +1,6 @@
1
1
  exercise: Wordy
2
- version: 1
3
- plan: 18
4
- imports: '&answer'
2
+ version: 2
3
+ plan: 16
5
4
  tests: |-
6
5
  for @($c-data<cases>) {
7
6
  if .<expected> === False {