trackler 2.2.1.131 → 2.2.1.132
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/react/canonical-data.json +95 -74
- data/tracks/ceylon/exercises/react/source/react/ReactorTest.ceylon +19 -1
- data/tracks/perl5/.travis.yml +1 -0
- data/tracks/perl5/exercises/bob/.meta/exercise-data.yaml +3 -3
- data/tracks/perl5/exercises/bob/.meta/solutions/Bob.pm +3 -1
- data/tracks/perl5/exercises/bob/Bob.pm +3 -1
- data/tracks/perl5/exercises/bob/bob.t +6 -11
- data/tracks/perl5/exercises/clock/.meta/exercise-data.yaml +8 -8
- data/tracks/perl5/exercises/clock/.meta/solutions/Clock.pm +1 -1
- data/tracks/perl5/exercises/clock/Clock.pm +1 -1
- data/tracks/perl5/exercises/clock/clock.t +10 -15
- data/tracks/perl5/exercises/hello-world/.meta/exercise-data.yaml +3 -3
- data/tracks/perl5/exercises/hello-world/.meta/solutions/HelloWorld.pm +3 -1
- data/tracks/perl5/exercises/hello-world/HelloWorld.pm +3 -1
- data/tracks/perl5/exercises/hello-world/hello-world.t +6 -11
- data/tracks/perl5/exercises/leap/.meta/exercise-data.yaml +3 -3
- data/tracks/perl5/exercises/leap/.meta/solutions/Leap.pm +3 -1
- data/tracks/perl5/exercises/leap/Leap.pm +3 -1
- data/tracks/perl5/exercises/leap/leap.t +6 -11
- data/tracks/perl5/exercises/luhn/.meta/exercise-data.yaml +3 -3
- data/tracks/perl5/exercises/luhn/.meta/solutions/Luhn.pm +3 -1
- data/tracks/perl5/exercises/luhn/Luhn.pm +3 -1
- data/tracks/perl5/exercises/luhn/luhn.t +6 -11
- data/tracks/perl5/exercises/phone-number/.meta/exercise-data.yaml +3 -3
- data/tracks/perl5/exercises/phone-number/.meta/solutions/PhoneNumber.pm +3 -1
- data/tracks/perl5/exercises/phone-number/PhoneNumber.pm +3 -1
- data/tracks/perl5/exercises/phone-number/phone-number.t +6 -11
- data/tracks/perl5/templates/module.mustache +3 -1
- data/tracks/perl5/templates/test.mustache +7 -11
- data/tracks/typescript/config.json +17 -0
- data/tracks/typescript/exercises/custom-set/README.md +36 -0
- data/tracks/typescript/exercises/custom-set/custom-set.example.ts +79 -0
- data/tracks/typescript/exercises/custom-set/custom-set.test.ts +222 -0
- data/tracks/typescript/exercises/custom-set/custom-set.ts +0 -0
- data/tracks/typescript/exercises/custom-set/package.json +36 -0
- data/tracks/typescript/exercises/custom-set/tsconfig.json +22 -0
- data/tracks/typescript/exercises/custom-set/tslint.json +127 -0
- data/tracks/typescript/exercises/custom-set/yarn.lock +2624 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e478de20af389be52d781a2d47847e675fcb3445
|
4
|
+
data.tar.gz: 1b158116931fb875e127102199db876edf2cfc56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba89ba4b7f07e6c582a4950ffdac818fa16e2831613d22b06de2ef46bfc0bf8c9369b591afeb1ffea22438bcd123df033d87f68f9559fe084049c20849ac470b
|
7
|
+
data.tar.gz: d00499a417f38ad4e78668e656faf9e262173f951a3ee7addd50906a4f5c707fb609a6ab43e2b781e05375d64bdbf36d9e710d7d801e99a54b6a27d9e296bdf3
|
data/lib/trackler/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"exercise": "react",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0",
|
4
4
|
"comments": [
|
5
5
|
"Note that, due to the nature of this exercise,",
|
6
6
|
"the tests are specified using their cells and a series of operations to perform on the cells.",
|
@@ -13,11 +13,12 @@
|
|
13
13
|
"The possible types and semantics of their fields are as follows:",
|
14
14
|
"",
|
15
15
|
"* expect_cell_value (`cell`, `value`): Expect that cell `cell` has value `value`.",
|
16
|
-
"* set_value (`cell`, `value`): Sets input cell `cell` to value `value`.",
|
16
|
+
"* set_value (`cell`, `value`, optionally `expect_callbacks`, `expect_callbacks_not_to_be_called`): Sets input cell `cell` to value `value`.",
|
17
|
+
" Expect that, as a result, all callbacks in `expect_callbacks` (if present) were called exactly once with the designated value",
|
18
|
+
" Expect that no callbacks in `expect_callbacks_not_to_be_called` (if present) were called as a result.",
|
17
19
|
"* add_callback (`cell`, `name`): Adds a callback to cell `cell`. Store the callback ID in a variable named `name`.",
|
18
20
|
" all callbacks are assumed to simply store the values they're called with in some array.",
|
19
21
|
"* remove_callback (`cell`, `name`): Removes the callback `name` from cell `cell`.",
|
20
|
-
"* expect_callback_values (`callback`, `values`): Expects callback `callback` to have been called with values `values` since the last `expect_callback_values` operation.",
|
21
22
|
"",
|
22
23
|
"Additional notes:",
|
23
24
|
"",
|
@@ -256,12 +257,10 @@
|
|
256
257
|
{
|
257
258
|
"type": "set_value",
|
258
259
|
"cell": "input",
|
259
|
-
"value": 3
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
"callback": "callback1",
|
264
|
-
"values": [4]
|
260
|
+
"value": 3,
|
261
|
+
"expect_callbacks": {
|
262
|
+
"callback1": 4
|
263
|
+
}
|
265
264
|
}
|
266
265
|
]
|
267
266
|
},
|
@@ -293,22 +292,16 @@
|
|
293
292
|
{
|
294
293
|
"type": "set_value",
|
295
294
|
"cell": "input",
|
296
|
-
"value": 2
|
297
|
-
|
298
|
-
{
|
299
|
-
"type": "expect_callback_values",
|
300
|
-
"callback": "callback1",
|
301
|
-
"values": []
|
295
|
+
"value": 2,
|
296
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
302
297
|
},
|
303
298
|
{
|
304
299
|
"type": "set_value",
|
305
300
|
"cell": "input",
|
306
|
-
"value": 4
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
"callback": "callback1",
|
311
|
-
"values": [222]
|
301
|
+
"value": 4,
|
302
|
+
"expect_callbacks": {
|
303
|
+
"callback1": 222
|
304
|
+
}
|
312
305
|
}
|
313
306
|
]
|
314
307
|
},
|
@@ -340,22 +333,65 @@
|
|
340
333
|
{
|
341
334
|
"type": "set_value",
|
342
335
|
"cell": "input",
|
343
|
-
"value": 2
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
"callback": "callback1",
|
348
|
-
"values": [3]
|
336
|
+
"value": 2,
|
337
|
+
"expect_callbacks": {
|
338
|
+
"callback1": 3
|
339
|
+
}
|
349
340
|
},
|
350
341
|
{
|
351
342
|
"type": "set_value",
|
352
343
|
"cell": "input",
|
353
|
-
"value": 3
|
344
|
+
"value": 3,
|
345
|
+
"expect_callbacks": {
|
346
|
+
"callback1": 4
|
347
|
+
}
|
348
|
+
}
|
349
|
+
]
|
350
|
+
},
|
351
|
+
"expected": {}
|
352
|
+
},
|
353
|
+
{
|
354
|
+
"description": "callbacks can fire from multiple cells",
|
355
|
+
"property": "react",
|
356
|
+
"input": {
|
357
|
+
"cells": [
|
358
|
+
{
|
359
|
+
"name": "input",
|
360
|
+
"type": "input",
|
361
|
+
"initial_value": 1
|
354
362
|
},
|
355
363
|
{
|
356
|
-
"
|
357
|
-
"
|
358
|
-
"
|
364
|
+
"name": "plus_one",
|
365
|
+
"type": "compute",
|
366
|
+
"inputs": ["input"],
|
367
|
+
"compute_function": "inputs[0] + 1"
|
368
|
+
},
|
369
|
+
{
|
370
|
+
"name": "minus_one",
|
371
|
+
"type": "compute",
|
372
|
+
"inputs": ["input"],
|
373
|
+
"compute_function": "inputs[0] - 1"
|
374
|
+
}
|
375
|
+
],
|
376
|
+
"operations": [
|
377
|
+
{
|
378
|
+
"type": "add_callback",
|
379
|
+
"cell": "plus_one",
|
380
|
+
"name": "callback1"
|
381
|
+
},
|
382
|
+
{
|
383
|
+
"type": "add_callback",
|
384
|
+
"cell": "minus_one",
|
385
|
+
"name": "callback2"
|
386
|
+
},
|
387
|
+
{
|
388
|
+
"type": "set_value",
|
389
|
+
"cell": "input",
|
390
|
+
"value": 10,
|
391
|
+
"expect_callbacks": {
|
392
|
+
"callback1": 11,
|
393
|
+
"callback2": 9
|
394
|
+
}
|
359
395
|
}
|
360
396
|
]
|
361
397
|
},
|
@@ -392,7 +428,11 @@
|
|
392
428
|
{
|
393
429
|
"type": "set_value",
|
394
430
|
"cell": "input",
|
395
|
-
"value": 31
|
431
|
+
"value": 31,
|
432
|
+
"expect_callbacks": {
|
433
|
+
"callback1": 32,
|
434
|
+
"callback2": 32
|
435
|
+
}
|
396
436
|
},
|
397
437
|
{
|
398
438
|
"type": "remove_callback",
|
@@ -407,22 +447,12 @@
|
|
407
447
|
{
|
408
448
|
"type": "set_value",
|
409
449
|
"cell": "input",
|
410
|
-
"value": 41
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
"
|
416
|
-
},
|
417
|
-
{
|
418
|
-
"type": "expect_callback_values",
|
419
|
-
"callback": "callback2",
|
420
|
-
"values": [32, 42]
|
421
|
-
},
|
422
|
-
{
|
423
|
-
"type": "expect_callback_values",
|
424
|
-
"callback": "callback3",
|
425
|
-
"values": [42]
|
450
|
+
"value": 41,
|
451
|
+
"expect_callbacks": {
|
452
|
+
"callback2": 42,
|
453
|
+
"callback3": 42
|
454
|
+
},
|
455
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
426
456
|
}
|
427
457
|
]
|
428
458
|
},
|
@@ -479,17 +509,11 @@
|
|
479
509
|
{
|
480
510
|
"type": "set_value",
|
481
511
|
"cell": "input",
|
482
|
-
"value": 2
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
"
|
487
|
-
"values": []
|
488
|
-
},
|
489
|
-
{
|
490
|
-
"type": "expect_callback_values",
|
491
|
-
"callback": "callback2",
|
492
|
-
"values": [3]
|
512
|
+
"value": 2,
|
513
|
+
"expect_callbacks": {
|
514
|
+
"callback2": 3
|
515
|
+
},
|
516
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
493
517
|
}
|
494
518
|
]
|
495
519
|
},
|
@@ -543,12 +567,10 @@
|
|
543
567
|
{
|
544
568
|
"type": "set_value",
|
545
569
|
"cell": "input",
|
546
|
-
"value": 4
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
"callback": "callback1",
|
551
|
-
"values": [10]
|
570
|
+
"value": 4,
|
571
|
+
"expect_callbacks": {
|
572
|
+
"callback1": 10
|
573
|
+
}
|
552
574
|
}
|
553
575
|
]
|
554
576
|
},
|
@@ -597,27 +619,26 @@
|
|
597
619
|
{
|
598
620
|
"type": "set_value",
|
599
621
|
"cell": "input",
|
600
|
-
"value": 2
|
622
|
+
"value": 2,
|
623
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
601
624
|
},
|
602
625
|
{
|
603
626
|
"type": "set_value",
|
604
627
|
"cell": "input",
|
605
|
-
"value": 3
|
628
|
+
"value": 3,
|
629
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
606
630
|
},
|
607
631
|
{
|
608
632
|
"type": "set_value",
|
609
633
|
"cell": "input",
|
610
|
-
"value": 4
|
634
|
+
"value": 4,
|
635
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
611
636
|
},
|
612
637
|
{
|
613
638
|
"type": "set_value",
|
614
639
|
"cell": "input",
|
615
|
-
"value": 5
|
616
|
-
|
617
|
-
{
|
618
|
-
"type": "expect_callback_values",
|
619
|
-
"callback": "callback1",
|
620
|
-
"values": []
|
640
|
+
"value": 5,
|
641
|
+
"expect_callbacks_not_to_be_called": ["callback1"]
|
621
642
|
}
|
622
643
|
]
|
623
644
|
},
|
@@ -2,7 +2,7 @@ import ceylon.test {
|
|
2
2
|
...
|
3
3
|
}
|
4
4
|
|
5
|
-
// Tests adapted from problem-specifications version
|
5
|
+
// Tests adapted from problem-specifications version 2.0.0
|
6
6
|
|
7
7
|
test
|
8
8
|
void inputCellsHaveValue() {
|
@@ -103,6 +103,24 @@ void callbacksCanBeCalledMultipleTimes() {
|
|
103
103
|
assertEquals(vals, [3, 4]);
|
104
104
|
}
|
105
105
|
|
106
|
+
test
|
107
|
+
void callbacksCanFireFromMultipleCells() {
|
108
|
+
value r = Reactor<Integer>();
|
109
|
+
value input = r.InputCell(1);
|
110
|
+
value plusOne = r.ComputeCell.single(input, (Integer x) => x + 1);
|
111
|
+
value minusOne = r.ComputeCell.single(input, (Integer x) => x - 1);
|
112
|
+
|
113
|
+
variable Integer[] plusVals = [];
|
114
|
+
plusOne.addCallback((x) => plusVals = plusVals.withTrailing(x));
|
115
|
+
|
116
|
+
variable Integer[] minusVals = [];
|
117
|
+
minusOne.addCallback((x) => minusVals = minusVals.withTrailing(x));
|
118
|
+
|
119
|
+
input.currentValue = 10;
|
120
|
+
assertEquals(plusVals, [11]);
|
121
|
+
assertEquals(minusVals, [9]);
|
122
|
+
}
|
123
|
+
|
106
124
|
test
|
107
125
|
void callbacksCanBeAddedAndRemoved() {
|
108
126
|
value r = Reactor<Integer>();
|
data/tracks/perl5/.travis.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
exercise: Bob
|
2
|
-
version:
|
3
|
-
plan:
|
2
|
+
version: 4
|
3
|
+
plan: 26
|
4
4
|
subs: hey
|
5
5
|
tests: |-
|
6
|
-
is
|
6
|
+
is hey($_->{input}{heyBob}), $_->{expected}, $_->{description} foreach @{$C_DATA->{cases}};
|
7
7
|
|
8
8
|
exercise_comment: '# The name of this exercise.'
|
9
9
|
version_comment: '# The version we will be matching against the exercise.'
|
@@ -1,15 +1,14 @@
|
|
1
1
|
#!/usr/bin/env perl
|
2
2
|
use strict;
|
3
3
|
use warnings;
|
4
|
+
use JSON::PP;
|
4
5
|
use FindBin;
|
5
6
|
use lib $FindBin::Bin; # Look for the module inside the same directory as this test file.
|
6
|
-
use
|
7
|
+
use Bob qw(hey);
|
7
8
|
|
8
9
|
my $exercise = 'Bob'; # The name of this exercise.
|
9
|
-
my $test_version =
|
10
|
-
use Test::More tests =>
|
11
|
-
|
12
|
-
use_ok $exercise or BAIL_OUT; # Check that the module can be use-d.
|
10
|
+
my $test_version = 4; # The version we will be matching against the exercise.
|
11
|
+
use Test::More tests => 26; # This is how many tests we expect to run.
|
13
12
|
|
14
13
|
# If the exercise is updated, we want to make sure other people testing
|
15
14
|
# your code don't think you've made a mistake if things have changed!
|
@@ -21,14 +20,10 @@ if ($exercise_version != $test_version) {
|
|
21
20
|
BAIL_OUT if $ENV{EXERCISM};
|
22
21
|
}
|
23
22
|
|
24
|
-
|
25
|
-
foreach ( qw(hey) ) {
|
26
|
-
can_ok $exercise, $_;
|
27
|
-
$subs{$_} = $exercise->can($_);
|
28
|
-
}
|
23
|
+
can_ok $exercise, 'import' or BAIL_OUT 'Cannot import subroutines from module';
|
29
24
|
|
30
25
|
my $C_DATA = do { local $/; decode_json(<DATA>); };
|
31
|
-
is
|
26
|
+
is hey($_->{input}{heyBob}), $_->{expected}, $_->{description} foreach @{$C_DATA->{cases}};
|
32
27
|
|
33
28
|
__DATA__
|
34
29
|
{
|
@@ -1,16 +1,16 @@
|
|
1
1
|
exercise: Clock
|
2
|
-
version:
|
3
|
-
plan:
|
4
|
-
|
2
|
+
version: 2
|
3
|
+
plan: 53
|
4
|
+
methods: new time add_minutes subtract_minutes
|
5
5
|
tests: |-
|
6
6
|
foreach (@{$C_DATA->{cases}}) {
|
7
7
|
foreach (@{$_->{cases}}) {
|
8
8
|
if ($_->{property} eq 'create') {
|
9
|
-
is
|
9
|
+
is($exercise->new($_->{input})->time, $_->{expected}, $_->{description});
|
10
10
|
}
|
11
11
|
|
12
12
|
elsif ($_->{property} eq 'add' || $_->{property} eq 'subtract') {
|
13
|
-
my $clock =
|
13
|
+
my $clock = $exercise->new({
|
14
14
|
hour => $_->{input}{hour},
|
15
15
|
minute => $_->{input}{minute},
|
16
16
|
});
|
@@ -21,13 +21,13 @@ tests: |-
|
|
21
21
|
|
22
22
|
elsif ($_->{property} eq 'equal') {
|
23
23
|
ok $_->{expected} ==
|
24
|
-
(
|
24
|
+
($exercise->new($_->{input}{clock1})->time eq $exercise->new($_->{input}{clock2})->time), $_->{description};
|
25
25
|
}
|
26
26
|
}
|
27
27
|
}
|
28
28
|
|
29
|
-
is
|
30
|
-
is
|
29
|
+
is($exercise->new({hour => 0, minute => 0})->add_minutes(65)->time, '01:05', 'add_minutes method can be chained');
|
30
|
+
is($exercise->new({hour => 0, minute => 0})->subtract_minutes(65)->time, '22:55', 'subtract_minutes method can be chained');
|
31
31
|
|
32
32
|
stub: |-
|
33
33
|
sub new {
|
@@ -1,15 +1,14 @@
|
|
1
1
|
#!/usr/bin/env perl
|
2
2
|
use strict;
|
3
3
|
use warnings;
|
4
|
+
use JSON::PP;
|
4
5
|
use FindBin;
|
5
6
|
use lib $FindBin::Bin;
|
6
|
-
use
|
7
|
+
use Clock ();
|
7
8
|
|
8
9
|
my $exercise = 'Clock';
|
9
|
-
my $test_version =
|
10
|
-
use Test::More tests =>
|
11
|
-
|
12
|
-
use_ok $exercise or BAIL_OUT;
|
10
|
+
my $test_version = 2;
|
11
|
+
use Test::More tests => 53;
|
13
12
|
|
14
13
|
my $exercise_version = $exercise->VERSION // 0;
|
15
14
|
if ($exercise_version != $test_version) {
|
@@ -19,21 +18,17 @@ if ($exercise_version != $test_version) {
|
|
19
18
|
BAIL_OUT if $ENV{EXERCISM};
|
20
19
|
}
|
21
20
|
|
22
|
-
|
23
|
-
foreach ( qw(new time add_minutes subtract_minutes) ) {
|
24
|
-
can_ok $exercise, $_;
|
25
|
-
$subs{$_} = $exercise->can($_);
|
26
|
-
}
|
21
|
+
can_ok $exercise, qw(new time add_minutes subtract_minutes);
|
27
22
|
|
28
23
|
my $C_DATA = do { local $/; decode_json(<DATA>); };
|
29
24
|
foreach (@{$C_DATA->{cases}}) {
|
30
25
|
foreach (@{$_->{cases}}) {
|
31
26
|
if ($_->{property} eq 'create') {
|
32
|
-
is
|
27
|
+
is($exercise->new($_->{input})->time, $_->{expected}, $_->{description});
|
33
28
|
}
|
34
29
|
|
35
30
|
elsif ($_->{property} eq 'add' || $_->{property} eq 'subtract') {
|
36
|
-
my $clock =
|
31
|
+
my $clock = $exercise->new({
|
37
32
|
hour => $_->{input}{hour},
|
38
33
|
minute => $_->{input}{minute},
|
39
34
|
});
|
@@ -44,13 +39,13 @@ foreach (@{$C_DATA->{cases}}) {
|
|
44
39
|
|
45
40
|
elsif ($_->{property} eq 'equal') {
|
46
41
|
ok $_->{expected} ==
|
47
|
-
(
|
42
|
+
($exercise->new($_->{input}{clock1})->time eq $exercise->new($_->{input}{clock2})->time), $_->{description};
|
48
43
|
}
|
49
44
|
}
|
50
45
|
}
|
51
46
|
|
52
|
-
is
|
53
|
-
is
|
47
|
+
is($exercise->new({hour => 0, minute => 0})->add_minutes(65)->time, '01:05', 'add_minutes method can be chained');
|
48
|
+
is($exercise->new({hour => 0, minute => 0})->subtract_minutes(65)->time, '22:55', 'subtract_minutes method can be chained');
|
54
49
|
|
55
50
|
__DATA__
|
56
51
|
{
|