trackler 2.2.1.43 → 2.2.1.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/lens-person/description.md +1 -1
  4. data/problem-specifications/exercises/palindrome-products/description.md +5 -12
  5. data/problem-specifications/exercises/pascals-triangle/canonical-data.json +1 -7
  6. data/tracks/c/exercises/meetup/src/example.c +64 -60
  7. data/tracks/c/exercises/meetup/src/example.h +2 -2
  8. data/tracks/c/exercises/meetup/test/test_meetup.c +4 -4
  9. data/tracks/cfml/config.json +179 -169
  10. data/tracks/cfml/exercises/markdown/.meta/HINTS.md +0 -0
  11. data/tracks/cfml/exercises/markdown/Markdown.cfc +121 -0
  12. data/tracks/cfml/exercises/markdown/MarkdownTest.cfc +51 -0
  13. data/tracks/cfml/exercises/markdown/Solution.cfc +204 -0
  14. data/tracks/cfml/exercises/markdown/SolutionTest.cfc +7 -0
  15. data/tracks/cfml/exercises/markdown/TestRunner.cfc +103 -0
  16. data/tracks/cfml/exercises/markdown/box.json +8 -0
  17. data/tracks/cfml/exercises/markdown/index.cfm +37 -0
  18. data/tracks/csharp/exercises/dominoes/DominoesTest.cs +40 -45
  19. data/tracks/csharp/exercises/meetup/MeetupTest.cs +761 -83
  20. data/tracks/csharp/generators/Exercises/Dominoes.cs +33 -0
  21. data/tracks/csharp/generators/Exercises/Meetup.cs +46 -0
  22. data/tracks/csharp/generators/Output/FormattingExtensions.cs +11 -1
  23. data/tracks/csharp/generators/Output/TypesExtensions.cs +23 -0
  24. data/tracks/csharp/generators/Output/ValueFormatter.cs +70 -69
  25. data/tracks/dart/config.json +15 -3
  26. data/tracks/dart/exercises/word-count/README.md +18 -0
  27. data/tracks/dart/exercises/word-count/lib/example.dart +26 -0
  28. data/tracks/dart/exercises/word-count/lib/word_count.dart +3 -0
  29. data/tracks/dart/exercises/word-count/pubspec.lock +293 -0
  30. data/tracks/dart/exercises/word-count/pubspec.yaml +3 -0
  31. data/tracks/dart/exercises/word-count/test/word_count_test.dart +64 -0
  32. data/tracks/ecmascript/docs/INSTALLATION.md +4 -7
  33. data/tracks/elixir/exercises/hello-world/README.md +1 -26
  34. data/tracks/elixir/exercises/hello-world/example.exs +3 -7
  35. data/tracks/elixir/exercises/hello-world/hello_world.exs +3 -25
  36. data/tracks/elixir/exercises/hello-world/hello_world_test.exs +2 -13
  37. data/tracks/elixir/mix.lock +1 -1
  38. data/tracks/elm/config.json +11 -0
  39. data/tracks/elm/exercises/pascals-triangle/README.md +51 -0
  40. data/tracks/elm/exercises/pascals-triangle/Triangle.elm +1 -0
  41. data/tracks/elm/exercises/pascals-triangle/Triangle.example.elm +23 -0
  42. data/tracks/elm/exercises/pascals-triangle/elm-package.json +14 -0
  43. data/tracks/elm/exercises/pascals-triangle/package.json +14 -0
  44. data/tracks/elm/exercises/pascals-triangle/tests/Tests.elm +34 -0
  45. data/tracks/elm/exercises/pascals-triangle/tests/elm-package.json +16 -0
  46. data/tracks/fsharp/exercises/grade-school/GradeSchool.fs +2 -2
  47. data/tracks/fsharp/exercises/grade-school/GradeSchoolTest.fs +3 -2
  48. data/tracks/java/CONTRIBUTING.md +34 -0
  49. data/tracks/java/config.json +42 -6
  50. data/tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java +7 -3
  51. data/tracks/java/exercises/matrix/src/main/java/Matrix.java +23 -0
  52. data/tracks/julia/config.json +11 -2
  53. data/tracks/julia/exercises/grains/README.md +33 -0
  54. data/tracks/julia/exercises/grains/example.jl +23 -0
  55. data/tracks/julia/exercises/grains/grains.jl +9 -0
  56. data/tracks/julia/exercises/grains/runtests.jl +27 -0
  57. data/tracks/lua/README.md +1 -1
  58. data/tracks/mips/exercises/octal/README.md +3 -8
  59. data/tracks/ocaml/exercises/palindrome-products/README.md +8 -14
  60. data/tracks/perl6/.travis.yml +7 -3
  61. data/tracks/perl6/bin/exercise-gen.pl6 +5 -1
  62. data/tracks/perl6/exercises/accumulate/README.md +0 -3
  63. data/tracks/perl6/exercises/accumulate/accumulate.t +9 -3
  64. data/tracks/perl6/exercises/all-your-base/README.md +1 -1
  65. data/tracks/perl6/exercises/all-your-base/all-your-base.t +23 -11
  66. data/tracks/perl6/exercises/all-your-base/example.yaml +1 -1
  67. data/tracks/perl6/exercises/allergies/README.md +0 -1
  68. data/tracks/perl6/exercises/allergies/allergies.t +22 -10
  69. data/tracks/perl6/exercises/anagram/anagram.t +22 -10
  70. data/tracks/perl6/exercises/atbash-cipher/README.md +2 -1
  71. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +22 -10
  72. data/tracks/perl6/exercises/binary/README.md +2 -0
  73. data/tracks/perl6/exercises/bob/bob.t +24 -11
  74. data/tracks/perl6/exercises/bob/example.yaml +2 -2
  75. data/tracks/perl6/exercises/clock/clock.t +22 -10
  76. data/tracks/perl6/exercises/flatten-array/README.md +1 -2
  77. data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
  78. data/tracks/perl6/exercises/flatten-array/flatten-array.t +23 -11
  79. data/tracks/perl6/exercises/grade-school/README.md +0 -1
  80. data/tracks/perl6/exercises/grade-school/grade-school.t +9 -3
  81. data/tracks/perl6/exercises/grains/README.md +0 -1
  82. data/tracks/perl6/exercises/grains/grains.t +22 -10
  83. data/tracks/perl6/exercises/hello-world/example.yaml +3 -3
  84. data/tracks/perl6/exercises/hello-world/hello-world.t +25 -12
  85. data/tracks/perl6/exercises/leap/README.md +1 -1
  86. data/tracks/perl6/exercises/leap/example.yaml +1 -1
  87. data/tracks/perl6/exercises/leap/leap.t +23 -11
  88. data/tracks/perl6/exercises/linked-list/README.md +10 -10
  89. data/tracks/perl6/exercises/linked-list/linked-list.t +9 -3
  90. data/tracks/perl6/exercises/luhn/README.md +7 -7
  91. data/tracks/perl6/exercises/luhn/luhn.t +22 -10
  92. data/tracks/perl6/exercises/phone-number/README.md +3 -2
  93. data/tracks/perl6/exercises/phone-number/phone-number.t +22 -10
  94. data/tracks/perl6/exercises/raindrops/raindrops.t +22 -10
  95. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +22 -10
  96. data/tracks/perl6/exercises/robot-name/robot-name.t +9 -3
  97. data/tracks/perl6/exercises/scrabble-score/README.md +3 -1
  98. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +22 -10
  99. data/tracks/perl6/exercises/space-age/README.md +2 -1
  100. data/tracks/perl6/exercises/space-age/space-age.t +22 -10
  101. data/tracks/perl6/exercises/trinary/README.md +1 -1
  102. data/tracks/perl6/exercises/word-count/README.md +1 -2
  103. data/tracks/perl6/exercises/word-count/word-count.t +22 -10
  104. data/tracks/perl6/exercises/wordy/README.md +0 -5
  105. data/tracks/perl6/exercises/wordy/wordy.t +22 -10
  106. data/tracks/perl6/templates/test.mustache +26 -15
  107. data/tracks/python/config.json +10 -0
  108. data/tracks/python/exercises/book-store/book_store.py +1 -1
  109. data/tracks/python/exercises/flatten-array/flatten_array.py +1 -1
  110. data/tracks/python/exercises/matrix/matrix.py +1 -1
  111. data/tracks/python/exercises/palindrome-products/palindrome_products.py +2 -2
  112. data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +2 -2
  113. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet.py +3 -3
  114. data/tracks/python/exercises/raindrops/raindrops.py +1 -1
  115. data/tracks/python/exercises/scale-generator/scale_generator.py +1 -1
  116. data/tracks/python/exercises/sieve/sieve.py +1 -1
  117. data/tracks/python/exercises/sublist/sublist.py +1 -1
  118. data/tracks/python/exercises/transpose/transpose.py +1 -1
  119. data/tracks/python/exercises/triangle/triangle.py +4 -1
  120. data/tracks/python/exercises/two-bucket/example.py +59 -0
  121. data/tracks/python/exercises/two-bucket/two_bucket.py +2 -0
  122. data/tracks/python/exercises/two-bucket/two_bucket_test.py +32 -0
  123. data/tracks/scheme/config.json +59 -89
  124. data/tracks/scheme/config/maintainers.json +11 -11
  125. data/tracks/sml/exercises/allergies/README.md +20 -5
  126. data/tracks/sml/exercises/allergies/allergies.sml +11 -14
  127. data/tracks/sml/exercises/allergies/example.sml +9 -9
  128. data/tracks/sml/exercises/allergies/test.sml +65 -129
  129. data/tracks/sml/exercises/allergies/testlib.sml +159 -0
  130. data/tracks/sml/exercises/hamming/README.md +21 -5
  131. data/tracks/sml/exercises/hamming/example.sml +14 -10
  132. data/tracks/sml/exercises/hamming/hamming.sml +4 -3
  133. data/tracks/sml/exercises/hamming/test.sml +55 -64
  134. data/tracks/sml/exercises/hamming/testlib.sml +159 -0
  135. data/tracks/typescript/config.json +15 -0
  136. data/tracks/typescript/exercises/linked-list/linked-list.test.ts +11 -11
  137. data/tracks/typescript/exercises/nth-prime/README.md +36 -0
  138. data/tracks/typescript/exercises/nth-prime/nth-prime.example.ts +28 -0
  139. data/tracks/typescript/exercises/nth-prime/nth-prime.test.ts +25 -0
  140. data/tracks/typescript/exercises/nth-prime/nth-prime.ts +0 -0
  141. data/tracks/typescript/exercises/nth-prime/package.json +36 -0
  142. data/tracks/typescript/exercises/nth-prime/tsconfig.json +22 -0
  143. data/tracks/typescript/exercises/nth-prime/tslint.json +127 -0
  144. data/tracks/typescript/exercises/nth-prime/yarn.lock +2305 -0
  145. data/tracks/typescript/exercises/prime-factors/README.md +1 -1
  146. data/tracks/typescript/exercises/prime-factors/prime-factors.test.ts +11 -11
  147. data/tracks/typescript/exercises/series/README.md +1 -1
  148. data/tracks/typescript/exercises/series/series.test.ts +11 -11
  149. data/tracks/typescript/img/icon.png +0 -0
  150. data/tracks/typescript/img/icon.svg +3 -8
  151. metadata +44 -2
@@ -22,7 +22,7 @@ tests: |
22
22
  is-deeply call-convert-base, $expected, $case<description>
23
23
  }
24
24
 
25
- sub call-convert-base { &::('convert-base')(|$case<input_base input_digits output_base>) }
25
+ sub call-convert-base { convert-base(|$case<input_base input_digits output_base>) }
26
26
  }
27
27
 
28
28
  unit: module
@@ -29,7 +29,6 @@ allergens that score 256, 512, 1024, etc.). Your program should
29
29
  ignore those components of the score. For example, if the allergy
30
30
  score is 257, your program should only report the eggs (1) allergy.
31
31
 
32
-
33
32
  ## Resources
34
33
 
35
34
  Remember to check out the Perl 6 [documentation](https://docs.perl6.org/) and
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'Allergies';
8
- my $version = v1;
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
10
- plan 4;
7
+ my Str:D $exercise := 'Allergies';
8
+ my Version:D $version = v1;
9
+ my Str $module //= $exercise;
10
+ INIT {
11
+ plan 4;
12
+ }
11
13
 
12
14
  use-ok $module or bail-out;
13
15
  require ::($module);
@@ -39,12 +41,6 @@ for @($c-data<cases>) -> %cases {
39
41
  } if %cases<description> ~~ 'list';
40
42
  }
41
43
 
42
- if %*ENV<EXERCISM> {
43
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
44
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
45
- } else { flunk 'canonical-data' }
46
- } else { skip }
47
-
48
44
  done-testing;
49
45
 
50
46
  INIT {
@@ -201,4 +197,20 @@ $c-data := from-json q:to/END/;
201
197
  }
202
198
 
203
199
  END
200
+
201
+ if %*ENV<EXERCISM> {
202
+ $module = 'Example';
203
+ if (my $c-data-file =
204
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
205
+ .IO.resolve) ~~ :f
206
+ {
207
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
208
+ }
209
+ else {
210
+ flunk 'canonical-data';
211
+ }
212
+ }
213
+ else {
214
+ skip;
215
+ }
204
216
  }
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'Anagram';
8
- my $version = v1;
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
10
- plan 18;
7
+ my Str:D $exercise := 'Anagram';
8
+ my Version:D $version = v1;
9
+ my Str $module //= $exercise;
10
+ INIT {
11
+ plan 18;
12
+ }
11
13
 
12
14
  use-ok $module or bail-out;
13
15
  require ::($module);
@@ -24,12 +26,6 @@ require ::($module) <&match-anagrams>;
24
26
  my $c-data;
25
27
  is match-anagrams(|.<subject candidates>), |.<expected description> for @($c-data<cases>);
26
28
 
27
- if %*ENV<EXERCISM> {
28
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
29
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
30
- } else { flunk 'canonical-data' }
31
- } else { skip }
32
-
33
29
  done-testing;
34
30
 
35
31
  INIT {
@@ -167,4 +163,20 @@ $c-data := from-json q:to/END/;
167
163
  }
168
164
 
169
165
  END
166
+
167
+ if %*ENV<EXERCISM> {
168
+ $module = 'Example';
169
+ if (my $c-data-file =
170
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
171
+ .IO.resolve) ~~ :f
172
+ {
173
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
174
+ }
175
+ else {
176
+ flunk 'canonical-data';
177
+ }
178
+ }
179
+ else {
180
+ skip;
181
+ }
170
182
  }
@@ -9,7 +9,7 @@ letter, the second with the second-last, and so on.
9
9
 
10
10
  An Atbash cipher for the Latin alphabet would be as follows:
11
11
 
12
- ```plain
12
+ ```text
13
13
  Plain: abcdefghijklmnopqrstuvwxyz
14
14
  Cipher: zyxwvutsrqponmlkjihgfedcba
15
15
  ```
@@ -23,6 +23,7 @@ being 5 letters, and punctuation is excluded. This is to make it harder to guess
23
23
  things based on word boundaries.
24
24
 
25
25
  ## Examples
26
+
26
27
  - Encoding `test` gives `gvhg`
27
28
  - Decoding `gvhg` gives `test`
28
29
  - Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'AtbashCipher';
8
- my $version = v1;
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
10
- plan 4;
7
+ my Str:D $exercise := 'AtbashCipher';
8
+ my Version:D $version = v1;
9
+ my Str $module //= $exercise;
10
+ INIT {
11
+ plan 4;
12
+ }
11
13
 
12
14
  use-ok $module or bail-out;
13
15
  require ::($module);
@@ -31,12 +33,6 @@ for @($c-data<cases>) {
31
33
  }
32
34
  }
33
35
 
34
- if %*ENV<EXERCISM> {
35
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
36
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
37
- } else { flunk 'canonical-data' }
38
- } else { skip }
39
-
40
36
  done-testing;
41
37
 
42
38
  INIT {
@@ -139,4 +135,20 @@ $c-data := from-json q:to/END/;
139
135
  }
140
136
 
141
137
  END
138
+
139
+ if %*ENV<EXERCISM> {
140
+ $module = 'Example';
141
+ if (my $c-data-file =
142
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
143
+ .IO.resolve) ~~ :f
144
+ {
145
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
146
+ }
147
+ else {
148
+ flunk 'canonical-data';
149
+ }
150
+ }
151
+ else {
152
+ skip;
153
+ }
142
154
  }
@@ -7,10 +7,12 @@ string, your program should produce a decimal output. The
7
7
  program should handle invalid inputs.
8
8
 
9
9
  ## Note
10
+
10
11
  - Implement the conversion yourself.
11
12
  Do not use something else to perform the conversion for you.
12
13
 
13
14
  ## About Binary (Base-2)
15
+
14
16
  Decimal is a base-10 system.
15
17
 
16
18
  A number 23 in base 10 notation can be understood
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname; #`[Look for the module inside the same directory as this test file.]
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'Bob'; #`[The name of this exercise.]
8
- my $version = v1; #`[The version we will be matching against the exercise.]
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise; #`[%*ENV<EXERCISM> is for tests not directly for the exercise, don't worry about these :)]
10
- plan 28; #`[This is how many tests we expect to run.]
7
+ my Str:D $exercise := 'Bob'; #`[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
+ INIT {
11
+ plan 28; #`[This is how many tests we expect to run.]
12
+ }
11
13
 
12
14
  #`[Check that the module can be use-d.]
13
15
  use-ok $module or bail-out;
@@ -33,13 +35,6 @@ my $c-data;
33
35
  and check that Bob gives us the correct response for each one.]
34
36
  is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
35
37
 
36
- #`[Ignore this for your exercise! Tells Exercism folks when exercise cases become out of date.]
37
- if %*ENV<EXERCISM> {
38
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
39
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
40
- } else { flunk 'canonical-data' }
41
- } else { skip }
42
-
43
38
  done-testing; #`[There are no more tests after this :)]
44
39
 
45
40
  #`['INIT' is a phaser, it makes sure that the test data is available before everything else
@@ -205,4 +200,22 @@ $c-data := from-json q:to/END/;
205
200
  }
206
201
 
207
202
  END
203
+
204
+ if %*ENV<EXERCISM> {
205
+ #`[Don't worry about the stuff in here for your exercise.
206
+ This is for Exercism folks to check that everything is in order.]
207
+ $module = 'Example';
208
+ if (my $c-data-file =
209
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
210
+ .IO.resolve) ~~ :f
211
+ {
212
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
213
+ }
214
+ else {
215
+ flunk 'canonical-data';
216
+ }
217
+ }
218
+ else {
219
+ skip;
220
+ }
208
221
  }
@@ -8,14 +8,14 @@ tests: |
8
8
  is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
9
9
 
10
10
  exercise_comment: The name of this exercise.
11
- module_comment: "%*ENV<EXERCISM> is for tests not directly for the exercise, don't worry about these :)"
11
+ module_comment: The name of the module file to be loaded.
12
12
  version_comment: The version we will be matching against the exercise.
13
13
  lib_comment: Look for the module inside the same directory as this test file.
14
14
  plan_comment: This is how many tests we expect to run.
15
15
  use_test_comment: Check that the module can be use-d.
16
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!"
17
17
  methods_comment: "Check that the class 'Bob' can use all of the methods\nneeded in the tests (only 'hey' for this one)."
18
- cdata_test_comment: Ignore this for your exercise! Tells Exercism folks when exercise cases become out of date.
18
+ exercism_comment: "Don't worry about the stuff in here for your exercise.\nThis is for Exercism folks to check that everything is in order."
19
19
  done_testing_comment: There are no more tests after this :)
20
20
  INIT_comment: "'INIT' is a phaser, it makes sure that the test data is available before everything else\nstarts running (otherwise we'd have to shove the test data into the middle of the file!)"
21
21
 
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'Clock';
8
- my $version = v1;
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
10
- plan 54;
7
+ my Str:D $exercise := 'Clock';
8
+ my Version:D $version = v1;
9
+ my Str $module //= $exercise;
10
+ INIT {
11
+ plan 54;
12
+ }
11
13
 
12
14
  use-ok $module or bail-out;
13
15
  require ::($module);
@@ -48,12 +50,6 @@ for @($c-data<cases>) {
48
50
  todo 'optional test' unless %*ENV<EXERCISM>;
49
51
  is ::($exercise).new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained';
50
52
 
51
- if %*ENV<EXERCISM> {
52
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
53
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
54
- } else { flunk 'canonical-data' }
55
- } else { skip }
56
-
57
53
  done-testing;
58
54
 
59
55
  INIT {
@@ -550,4 +546,20 @@ $c-data := from-json q:to/END/;
550
546
  }
551
547
 
552
548
  END
549
+
550
+ if %*ENV<EXERCISM> {
551
+ $module = 'Example';
552
+ if (my $c-data-file =
553
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
554
+ .IO.resolve) ~~ :f
555
+ {
556
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
557
+ }
558
+ else {
559
+ flunk 'canonical-data';
560
+ }
561
+ }
562
+ else {
563
+ skip;
564
+ }
553
565
  }
@@ -3,14 +3,13 @@
3
3
  Take a nested list and return a single flattened list with all values except nil/null.
4
4
 
5
5
  The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
6
-
6
+
7
7
  For Example
8
8
 
9
9
  input: [1,[2,3,null,4],[null],5]
10
10
 
11
11
  output: [1,2,3,4,5]
12
12
 
13
-
14
13
  ## Resources
15
14
 
16
15
  Remember to check out the Perl 6 [documentation](https://docs.perl6.org/) and
@@ -3,7 +3,7 @@ version: 1
3
3
  plan: 8
4
4
  imports: '&flatten-array'
5
5
  tests: |
6
- is-deeply &::('flatten-array')(.<input>), |.<expected description> for @($c-data<cases>);
6
+ is-deeply flatten-array(.<input>), |.<expected description> for @($c-data<cases>);
7
7
 
8
8
  unit: module
9
9
  example: |
@@ -4,10 +4,12 @@ use Test;
4
4
  use lib my $dir = $?FILE.IO.dirname;
5
5
  use JSON::Fast;
6
6
 
7
- my $exercise = 'FlattenArray';
8
- my $version = v1;
9
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
10
- plan 8;
7
+ my Str:D $exercise := 'FlattenArray';
8
+ my Version:D $version = v1;
9
+ my Str $module //= $exercise;
10
+ INIT {
11
+ plan 8;
12
+ }
11
13
 
12
14
  use-ok $module or bail-out;
13
15
  require ::($module);
@@ -22,13 +24,7 @@ if ::($exercise).^ver !~~ $version {
22
24
  require ::($module) <&flatten-array>;
23
25
 
24
26
  my $c-data;
25
- is-deeply &::('flatten-array')(.<input>), |.<expected description> for @($c-data<cases>);
26
-
27
- if %*ENV<EXERCISM> {
28
- if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
29
- is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
30
- } else { flunk 'canonical-data' }
31
- } else { skip }
27
+ is-deeply flatten-array(.<input>), |.<expected description> for @($c-data<cases>);
32
28
 
33
29
  done-testing;
34
30
 
@@ -79,4 +75,20 @@ $c-data := from-json q:to/END/;
79
75
  }
80
76
 
81
77
  END
78
+
79
+ if %*ENV<EXERCISM> {
80
+ $module = 'Example';
81
+ if (my $c-data-file =
82
+ "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
83
+ .IO.resolve) ~~ :f
84
+ {
85
+ is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
86
+ }
87
+ else {
88
+ flunk 'canonical-data';
89
+ }
90
+ }
91
+ else {
92
+ skip;
93
+ }
82
94
  }
@@ -21,7 +21,6 @@ In the end, you should be able to:
21
21
  Note that all our students only have one name. (It's a small town, what
22
22
  do you want?)
23
23
 
24
-
25
24
  ## For bonus points
26
25
 
27
26
  Did you get the tests passing and the code clean? If you want to, these
@@ -3,9 +3,9 @@ use v6;
3
3
  use Test;
4
4
  use lib $?FILE.IO.dirname;
5
5
 
6
- my $exercise = 'GradeSchool';
7
- my $version = v1;
8
- my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
6
+ my Str:D $exercise := 'GradeSchool';
7
+ my Version:D $version = v1;
8
+ my Str $module //= $exercise;
9
9
  plan 10;
10
10
 
11
11
  use-ok $module or bail-out;
@@ -40,3 +40,9 @@ subtest 'Additional students', {
40
40
  is $roster.?list-all, ('Grade 1', <Anna Barb Charlie>, 'Grade 2', <Alex Jim Zoe>, 'Grade 3', <Dick Harry Tom>), 'List all';
41
41
 
42
42
  done-testing;
43
+
44
+ INIT {
45
+ if %*ENV<EXERCISM> {
46
+ $module = 'Example';
47
+ }
48
+ }
@@ -15,7 +15,6 @@ Write code that shows:
15
15
  - how many grains were on each square, and
16
16
  - the total number of grains
17
17
 
18
-
19
18
  ## For bonus points
20
19
 
21
20
  Did you get the tests passing and the code clean? If you want to, these