trackler 2.2.1.48 → 2.2.1.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/grains/canonical-data.json +1 -1
- data/problem-specifications/exercises/isbn-verifier/description.md +1 -1
- data/tracks/dart/exercises/anagram/pubspec.lock +10 -10
- data/tracks/dart/exercises/bob/pubspec.lock +4 -4
- data/tracks/dart/exercises/difference-of-squares/pubspec.lock +4 -4
- data/tracks/dart/exercises/gigasecond/pubspec.lock +4 -4
- data/tracks/dart/exercises/hamming/pubspec.lock +4 -4
- data/tracks/dart/exercises/hello-world/pubspec.lock +4 -4
- data/tracks/dart/exercises/leap/pubspec.lock +4 -4
- data/tracks/dart/exercises/phone-number/pubspec.lock +4 -4
- data/tracks/dart/exercises/raindrops/pubspec.lock +17 -5
- data/tracks/dart/exercises/rna-transcription/pubspec.lock +4 -4
- data/tracks/dart/exercises/word-count/pubspec.lock +4 -4
- data/tracks/dart/pubspec.lock +3 -3
- data/tracks/fsharp/exercises/largest-series-product/Example.fs +18 -4
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProduct.fs +1 -1
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProductTest.fs +80 -36
- data/tracks/fsharp/generators/Exercise.fs +1 -1
- data/tracks/fsharp/generators/Generators.fs +10 -0
- data/tracks/gnu-apl/config.json +14 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/README.md +19 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/difference-of-squares-example.apl +13 -0
- data/tracks/gnu-apl/exercises/difference-of-squares/difference-of-squares.tc +38 -0
- data/tracks/gnu-apl/exercises/pangram/README.md +15 -0
- data/tracks/gnu-apl/exercises/pangram/pangram-example.apl +14 -0
- data/tracks/gnu-apl/exercises/pangram/pangram.tc +40 -0
- data/tracks/gnu-apl/exercises/raindrops/raindrops.tc +1 -1
- data/tracks/java/exercises/bracket-push/.meta/version +1 -0
- data/tracks/java/exercises/complex-numbers/.meta/version +1 -0
- data/tracks/java/exercises/ocr-numbers/.meta/version +1 -0
- data/tracks/java/exercises/queen-attack/.meta/version +1 -0
- data/tracks/java/exercises/rectangles/.meta/version +1 -0
- data/tracks/java/exercises/robot-simulator/.meta/version +1 -0
- data/tracks/java/exercises/secret-handshake/.meta/version +1 -0
- data/tracks/java/exercises/sublist/.meta/version +1 -0
- data/tracks/perl6/exercises/accumulate/accumulate.t +1 -6
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +14 -19
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/Example.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/allergies.t +25 -29
- data/tracks/perl6/exercises/allergies/example.yaml +11 -10
- data/tracks/perl6/exercises/anagram/anagram.t +14 -19
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +14 -19
- data/tracks/perl6/exercises/bob/bob.t +16 -23
- data/tracks/perl6/exercises/bob/example.yaml +1 -3
- data/tracks/perl6/exercises/clock/clock.t +14 -19
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +14 -19
- data/tracks/perl6/exercises/grade-school/grade-school.t +1 -6
- data/tracks/perl6/exercises/grains/grains.t +15 -20
- data/tracks/perl6/exercises/hello-world/example.yaml +1 -3
- data/tracks/perl6/exercises/hello-world/hello-world.t +16 -23
- data/tracks/perl6/exercises/leap/leap.t +14 -19
- data/tracks/perl6/exercises/linked-list/example.yaml +59 -59
- data/tracks/perl6/exercises/linked-list/linked-list.t +59 -64
- data/tracks/perl6/exercises/luhn/luhn.t +14 -19
- data/tracks/perl6/exercises/phone-number/phone-number.t +14 -19
- data/tracks/perl6/exercises/raindrops/raindrops.t +14 -19
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +14 -19
- data/tracks/perl6/exercises/robot-name/robot-name.t +1 -6
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +14 -19
- data/tracks/perl6/exercises/space-age/space-age.t +14 -19
- data/tracks/perl6/exercises/word-count/word-count.t +14 -19
- data/tracks/perl6/exercises/wordy/wordy.t +14 -19
- data/tracks/perl6/templates/test.mustache +19 -25
- data/tracks/purescript/config.json +12 -0
- data/tracks/purescript/exercises/sum-of-multiples/README.md +15 -0
- data/tracks/purescript/exercises/sum-of-multiples/bower.json +26 -0
- data/tracks/purescript/exercises/sum-of-multiples/examples/src/SumOfMultiples.purs +16 -0
- data/tracks/purescript/exercises/sum-of-multiples/src/SumOfMultiples.purs +3 -0
- data/tracks/purescript/exercises/sum-of-multiples/test/Main.purs +63 -0
- data/tracks/python/README.md +5 -1
- data/tracks/python/config.json +52 -9
- data/tracks/python/exercises/allergies/allergies_test.py +7 -7
- data/tracks/python/exercises/allergies/example.py +1 -1
- data/tracks/python/exercises/binary-search/binary_search_test.py +8 -5
- data/tracks/python/exercises/binary/binary_test.py +8 -4
- data/tracks/python/exercises/book-store/example.py +1 -1
- data/tracks/python/exercises/clock/clock.py +3 -0
- data/tracks/python/exercises/clock/clock_test.py +16 -16
- data/tracks/python/exercises/clock/example.py +1 -1
- data/tracks/python/exercises/list-ops/example.py +10 -29
- data/tracks/python/exercises/list-ops/list_ops.py +8 -12
- data/tracks/python/exercises/list-ops/list_ops_test.py +55 -86
- data/tracks/python/exercises/meetup/meetup_test.py +2 -2
- data/tracks/python/exercises/minesweeper/minesweeper_test.py +6 -3
- data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +11 -8
- data/tracks/python/exercises/pangram/pangram_test.py +25 -16
- data/tracks/python/exercises/point-mutations/point_mutations.py +1 -1
- data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +2 -1
- data/tracks/python/exercises/saddle-points/saddle_points_test.py +2 -1
- data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +4 -2
- data/tracks/python/exercises/triangle/triangle_test.py +10 -5
- data/tracks/python/exercises/wordy/wordy_test.py +8 -5
- data/tracks/python/exercises/zipper/README.md +43 -0
- data/tracks/python/exercises/zipper/example.py +41 -0
- data/tracks/python/exercises/zipper/zipper.py +28 -0
- data/tracks/python/exercises/zipper/zipper_test.py +82 -0
- data/tracks/racket/.travis.yml +1 -1
- data/tracks/racket/config.json +14 -0
- data/tracks/racket/exercises/meetup/README.md +54 -0
- data/tracks/racket/exercises/meetup/example.rkt +45 -0
- data/tracks/racket/exercises/meetup/meetup-test.rkt +39 -0
- data/tracks/racket/exercises/meetup/meetup.rkt +3 -0
- metadata +29 -2
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -38,11 +38,6 @@ is-deeply accumulate(['a', 'b', 'c' ], sub ($inp) { [ accumulate( [1, 2, 3], sub
|
|
38
38
|
is-deeply accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
|
39
39
|
['eht', 'kciuq', 'nworb', 'xof'],
|
40
40
|
'reverse strings';
|
41
|
-
|
42
|
-
done-testing;
|
43
|
-
|
44
41
|
INIT {
|
45
|
-
if %*ENV<EXERCISM
|
46
|
-
$module = 'Example';
|
47
|
-
}
|
42
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
48
43
|
}
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'AllYourBase';
|
8
8
|
my Version:D $version = v2;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 23;
|
12
|
-
}
|
10
|
+
plan 23;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -46,7 +44,18 @@ for @($c-data<cases>) -> $case {
|
|
46
44
|
sub call-convert-base { convert-base(|$case<input_base input_digits output_base>) }
|
47
45
|
}
|
48
46
|
|
49
|
-
|
47
|
+
unless %*ENV<EXERCISM> {
|
48
|
+
skip-rest 'exercism tests';
|
49
|
+
exit;
|
50
|
+
}
|
51
|
+
|
52
|
+
subtest 'canonical-data' => {
|
53
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
54
|
+
$dir.IO.resolve.basename
|
55
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
56
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
57
|
+
flunk 'problem-specifications file not found';
|
58
|
+
}
|
50
59
|
|
51
60
|
INIT {
|
52
61
|
$c-data := from-json q:to/END/;
|
@@ -248,19 +257,5 @@ $c-data := from-json q:to/END/;
|
|
248
257
|
|
249
258
|
END
|
250
259
|
|
251
|
-
if %*ENV<EXERCISM
|
252
|
-
$module = 'Example';
|
253
|
-
if (my $c-data-file =
|
254
|
-
"$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
|
255
|
-
.IO.resolve) ~~ :f
|
256
|
-
{
|
257
|
-
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
|
258
|
-
}
|
259
|
-
else {
|
260
|
-
flunk 'canonical-data';
|
261
|
-
}
|
262
|
-
}
|
263
|
-
else {
|
264
|
-
skip;
|
265
|
-
}
|
260
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
266
261
|
}
|
@@ -1 +1 @@
|
|
1
|
-
unit module Allergies:ver<
|
1
|
+
unit module Allergies:ver<2>;
|
@@ -5,11 +5,9 @@ use lib my $dir = $?FILE.IO.dirname;
|
|
5
5
|
use JSON::Fast;
|
6
6
|
|
7
7
|
my Str:D $exercise := 'Allergies';
|
8
|
-
my Version:D $version =
|
8
|
+
my Version:D $version = v2;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 4;
|
12
|
-
}
|
10
|
+
plan 4;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -24,24 +22,36 @@ if ::($exercise).^ver !~~ $version {
|
|
24
22
|
require ::($module) <&allergic-to &list-allergies>;
|
25
23
|
|
26
24
|
my $c-data;
|
27
|
-
for
|
25
|
+
for $c-data<cases>.values -> %case-set {
|
26
|
+
|
28
27
|
subtest 'allergic-to' => {
|
29
28
|
plan 7;
|
30
|
-
|
31
|
-
|
32
|
-
is allergic-to(%case<score>, .<substance>), .<result>, %case<description> for @(%case<expected>);
|
29
|
+
for %case-set<cases>.values -> %case {
|
30
|
+
is allergic-to(%case<score>, .<substance>), .<result>, %case<description> ~ ': ' ~ .<substance> for %case<expected>.values;
|
33
31
|
}
|
34
|
-
}
|
32
|
+
} when %case-set<description> ~~ 'allergicTo';
|
33
|
+
|
35
34
|
subtest 'list-allergies' => {
|
36
35
|
plan 9;
|
37
|
-
|
38
|
-
|
39
|
-
is list-allergies(.<score>), |.<expected description>;
|
36
|
+
for %case-set<cases>.values {
|
37
|
+
cmp-ok list-allergies(.<score>), '~~', .<expected>.Set, .<description>;
|
40
38
|
}
|
41
|
-
}
|
39
|
+
} when %case-set<description> ~~ 'list';
|
40
|
+
|
42
41
|
}
|
43
42
|
|
44
|
-
|
43
|
+
unless %*ENV<EXERCISM> {
|
44
|
+
skip-rest 'exercism tests';
|
45
|
+
exit;
|
46
|
+
}
|
47
|
+
|
48
|
+
subtest 'canonical-data' => {
|
49
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
50
|
+
$dir.IO.resolve.basename
|
51
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
52
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
53
|
+
flunk 'problem-specifications file not found';
|
54
|
+
}
|
45
55
|
|
46
56
|
INIT {
|
47
57
|
$c-data := from-json q:to/END/;
|
@@ -198,19 +208,5 @@ $c-data := from-json q:to/END/;
|
|
198
208
|
|
199
209
|
END
|
200
210
|
|
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
|
-
}
|
211
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
216
212
|
}
|
@@ -1,23 +1,24 @@
|
|
1
1
|
exercise: Allergies
|
2
|
-
version:
|
2
|
+
version: 2
|
3
3
|
plan: 4
|
4
4
|
imports: '&allergic-to &list-allergies'
|
5
5
|
tests: |
|
6
|
-
for
|
6
|
+
for $c-data<cases>.values -> %case-set {
|
7
|
+
|
7
8
|
subtest 'allergic-to' => {
|
8
9
|
plan 7;
|
9
|
-
|
10
|
-
|
11
|
-
is allergic-to(%case<score>, .<substance>), .<result>, %case<description> for @(%case<expected>);
|
10
|
+
for %case-set<cases>.values -> %case {
|
11
|
+
is allergic-to(%case<score>, .<substance>), .<result>, %case<description> ~ ': ' ~ .<substance> for %case<expected>.values;
|
12
12
|
}
|
13
|
-
}
|
13
|
+
} when %case-set<description> ~~ 'allergicTo';
|
14
|
+
|
14
15
|
subtest 'list-allergies' => {
|
15
16
|
plan 9;
|
16
|
-
|
17
|
-
|
18
|
-
is list-allergies(.<score>), |.<expected description>;
|
17
|
+
for %case-set<cases>.values {
|
18
|
+
cmp-ok list-allergies(.<score>), '~~', .<expected>.Set, .<description>;
|
19
19
|
}
|
20
|
-
}
|
20
|
+
} when %case-set<description> ~~ 'list';
|
21
|
+
|
21
22
|
}
|
22
23
|
|
23
24
|
unit: module
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'Anagram';
|
8
8
|
my Version:D $version = v1;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 18;
|
12
|
-
}
|
10
|
+
plan 18;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -26,7 +24,18 @@ require ::($module) <&match-anagrams>;
|
|
26
24
|
my $c-data;
|
27
25
|
is match-anagrams(|.<subject candidates>), |.<expected description> for @($c-data<cases>);
|
28
26
|
|
29
|
-
|
27
|
+
unless %*ENV<EXERCISM> {
|
28
|
+
skip-rest 'exercism tests';
|
29
|
+
exit;
|
30
|
+
}
|
31
|
+
|
32
|
+
subtest 'canonical-data' => {
|
33
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
34
|
+
$dir.IO.resolve.basename
|
35
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
36
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
37
|
+
flunk 'problem-specifications file not found';
|
38
|
+
}
|
30
39
|
|
31
40
|
INIT {
|
32
41
|
$c-data := from-json q:to/END/;
|
@@ -164,19 +173,5 @@ $c-data := from-json q:to/END/;
|
|
164
173
|
|
165
174
|
END
|
166
175
|
|
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
|
-
}
|
176
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
182
177
|
}
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'AtbashCipher';
|
8
8
|
my Version:D $version = v1;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 4;
|
12
|
-
}
|
10
|
+
plan 4;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -33,7 +31,18 @@ for @($c-data<cases>) {
|
|
33
31
|
}
|
34
32
|
}
|
35
33
|
|
36
|
-
|
34
|
+
unless %*ENV<EXERCISM> {
|
35
|
+
skip-rest 'exercism tests';
|
36
|
+
exit;
|
37
|
+
}
|
38
|
+
|
39
|
+
subtest 'canonical-data' => {
|
40
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
41
|
+
$dir.IO.resolve.basename
|
42
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
43
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
44
|
+
flunk 'problem-specifications file not found';
|
45
|
+
}
|
37
46
|
|
38
47
|
INIT {
|
39
48
|
$c-data := from-json q:to/END/;
|
@@ -136,19 +145,5 @@ $c-data := from-json q:to/END/;
|
|
136
145
|
|
137
146
|
END
|
138
147
|
|
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
|
-
}
|
148
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
154
149
|
}
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'Bob'; #`[The name of this exercise.]
|
8
8
|
my Version:D $version = v1; #`[The version we will be matching against the exercise.]
|
9
9
|
my Str $module //= $exercise; #`[The name of the module file to be loaded.]
|
10
|
-
|
11
|
-
plan 28; #`[This is how many tests we expect to run.]
|
12
|
-
}
|
10
|
+
plan 28; #`[This is how many tests we expect to run.]
|
13
11
|
|
14
12
|
#`[Check that the module can be use-d.]
|
15
13
|
use-ok $module or bail-out;
|
@@ -35,10 +33,21 @@ my $c-data;
|
|
35
33
|
and check that Bob gives us the correct response for each one.]
|
36
34
|
is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
|
37
35
|
|
38
|
-
|
36
|
+
#`[Don't worry about the stuff below here for your exercise.
|
37
|
+
This is for Exercism folks to check that everything is in order.]
|
38
|
+
unless %*ENV<EXERCISM> {
|
39
|
+
skip-rest 'exercism tests';
|
40
|
+
exit;
|
41
|
+
}
|
42
|
+
|
43
|
+
subtest 'canonical-data' => {
|
44
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
45
|
+
$dir.IO.resolve.basename
|
46
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
47
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
48
|
+
flunk 'problem-specifications file not found';
|
49
|
+
}
|
39
50
|
|
40
|
-
#`['INIT' is a phaser, it makes sure that the test data is available before everything else
|
41
|
-
starts running (otherwise we'd have to shove the test data into the middle of the file!)]
|
42
51
|
INIT {
|
43
52
|
$c-data := from-json q:to/END/;
|
44
53
|
|
@@ -201,21 +210,5 @@ $c-data := from-json q:to/END/;
|
|
201
210
|
|
202
211
|
END
|
203
212
|
|
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
|
-
}
|
213
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
221
214
|
}
|
@@ -15,9 +15,7 @@ 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
|
-
exercism_comment: "Don't worry about the stuff
|
19
|
-
done_testing_comment: There are no more tests after this :)
|
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!)"
|
18
|
+
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."
|
21
19
|
|
22
20
|
unit: class
|
23
21
|
unit_comment: |
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'Clock';
|
8
8
|
my Version:D $version = v1;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 54;
|
12
|
-
}
|
10
|
+
plan 54;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -50,7 +48,18 @@ for @($c-data<cases>) {
|
|
50
48
|
todo 'optional test' unless %*ENV<EXERCISM>;
|
51
49
|
is ::($exercise).new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained';
|
52
50
|
|
53
|
-
|
51
|
+
unless %*ENV<EXERCISM> {
|
52
|
+
skip-rest 'exercism tests';
|
53
|
+
exit;
|
54
|
+
}
|
55
|
+
|
56
|
+
subtest 'canonical-data' => {
|
57
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
58
|
+
$dir.IO.resolve.basename
|
59
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
60
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
61
|
+
flunk 'problem-specifications file not found';
|
62
|
+
}
|
54
63
|
|
55
64
|
INIT {
|
56
65
|
$c-data := from-json q:to/END/;
|
@@ -547,19 +556,5 @@ $c-data := from-json q:to/END/;
|
|
547
556
|
|
548
557
|
END
|
549
558
|
|
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
|
-
}
|
559
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
565
560
|
}
|
@@ -7,9 +7,7 @@ use JSON::Fast;
|
|
7
7
|
my Str:D $exercise := 'FlattenArray';
|
8
8
|
my Version:D $version = v1;
|
9
9
|
my Str $module //= $exercise;
|
10
|
-
|
11
|
-
plan 8;
|
12
|
-
}
|
10
|
+
plan 8;
|
13
11
|
|
14
12
|
use-ok $module or bail-out;
|
15
13
|
require ::($module);
|
@@ -26,7 +24,18 @@ require ::($module) <&flatten-array>;
|
|
26
24
|
my $c-data;
|
27
25
|
is-deeply flatten-array(.<input>), |.<expected description> for @($c-data<cases>);
|
28
26
|
|
29
|
-
|
27
|
+
unless %*ENV<EXERCISM> {
|
28
|
+
skip-rest 'exercism tests';
|
29
|
+
exit;
|
30
|
+
}
|
31
|
+
|
32
|
+
subtest 'canonical-data' => {
|
33
|
+
(my $c-data-file = "$dir/../../problem-specifications/exercises/{
|
34
|
+
$dir.IO.resolve.basename
|
35
|
+
}/canonical-data.json".IO.resolve) ~~ :f ??
|
36
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'match problem-specifications' !!
|
37
|
+
flunk 'problem-specifications file not found';
|
38
|
+
}
|
30
39
|
|
31
40
|
INIT {
|
32
41
|
$c-data := from-json q:to/END/;
|
@@ -76,19 +85,5 @@ $c-data := from-json q:to/END/;
|
|
76
85
|
|
77
86
|
END
|
78
87
|
|
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
|
-
}
|
88
|
+
$module = 'Example' if %*ENV<EXERCISM>;
|
94
89
|
}
|