trackler 2.0.8.20 → 2.0.8.21
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/tracks/csharp/.travis.yml +1 -4
- data/tracks/csharp/exercises/accumulate/HINTS.md +3 -0
- data/tracks/csharp/exercises/allergies/HINTS.md +3 -0
- data/tracks/csharp/exercises/alphametics/HINTS.md +5 -0
- data/tracks/csharp/exercises/bank-account/HINTS.md +3 -0
- data/tracks/csharp/exercises/beer-song/HINTS.md +2 -0
- data/tracks/csharp/exercises/clock/HINTS.md +4 -0
- data/tracks/csharp/exercises/custom-set/HINTS.md +4 -0
- data/tracks/csharp/exercises/difference-of-squares/HINTS.md +4 -0
- data/tracks/csharp/exercises/diffie-hellman/HINTS.md +3 -0
- data/tracks/csharp/exercises/food-chain/HINTS.md +2 -0
- data/tracks/csharp/exercises/forth/HINTS.md +2 -0
- data/tracks/csharp/exercises/hangman/HINTS.md +3 -0
- data/tracks/csharp/exercises/leap/Example.cs +2 -2
- data/tracks/csharp/exercises/leap/Leap.cs +2 -2
- data/tracks/csharp/exercises/leap/LeapTest.cs +4 -4
- data/tracks/csharp/exercises/sgf-parsing/HINTS.md +2 -0
- data/tracks/csharp/exercises/simple-linked-list/HINTS.md +3 -0
- data/tracks/csharp/exercises/sublist/HINTS.md +3 -0
- data/tracks/csharp/exercises/twelve-days/HINTS.md +2 -0
- data/tracks/csharp/exercises/variable-length-quantity/HINTS.md +3 -0
- data/tracks/csharp/exercises/wordy/HINTS.md +2 -0
- data/tracks/csharp/generators/BooleanTestMethod.cs +36 -0
- data/tracks/csharp/generators/Exercises/Exercise.cs +13 -2
- data/tracks/csharp/generators/Exercises/LeapExercise.cs +3 -26
- data/tracks/csharp/generators/Program.cs +7 -8
- data/tracks/csharp/generators/TestClassNameTransformer.cs +9 -0
- data/tracks/csharp/generators/TestClassRenderer.cs +1 -1
- data/tracks/csharp/generators/TestedClassNameTransformer.cs +11 -0
- data/tracks/csharp/generators/TestedMethodNameTransformer.cs +9 -0
- data/tracks/csharp/generators/To.cs +3 -0
- data/tracks/elixir/config.json +8 -0
- data/tracks/elixir/exercises/ocr-numbers/example.exs +47 -0
- data/tracks/elixir/exercises/ocr-numbers/ocr_numbers.exs +10 -0
- data/tracks/elixir/exercises/ocr-numbers/ocr_numbers_test.exs +254 -0
- data/tracks/go/exercises/say/example.go +2 -0
- data/tracks/go/exercises/say/say_test.go +8 -0
- data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +6 -4
- data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +4 -1
- data/tracks/go/exercises/sieve/example.go +2 -0
- data/tracks/go/exercises/sieve/sieve_test.go +8 -0
- data/tracks/go/exercises/simple-cipher/example.go +3 -1
- data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +8 -0
- data/tracks/go/exercises/sum-of-multiples/example.go +2 -0
- data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +8 -0
- data/tracks/go/exercises/tournament/tournament_test.go +3 -1
- data/tracks/go/exercises/transpose/example.go +2 -0
- data/tracks/go/exercises/transpose/transpose_test.go +8 -0
- data/tracks/go/exercises/tree-building/tree_test.go +6 -6
- data/tracks/go/exercises/triangle/triangle_test.go +6 -6
- data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
- data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
- data/tracks/haskell/exercises/linked-list/src/Deque.hs +4 -4
- data/tracks/haskell/exercises/list-ops/src/ListOps.hs +7 -7
- data/tracks/haskell/exercises/luhn/src/Luhn.hs +10 -5
- data/tracks/haskell/exercises/matrix/src/Matrix.hs +10 -10
- data/tracks/haskell/exercises/minesweeper/src/Minesweeper.hs +1 -1
- data/tracks/haskell/exercises/nth-prime/src/Prime.hs +2 -1
- data/tracks/haskell/exercises/nucleotide-count/src/DNA.hs +1 -1
- data/tracks/haskell/exercises/ocr-numbers/src/OCR.hs +1 -1
- data/tracks/haskell/exercises/pascals-triangle/src/Triangle.hs +1 -1
- data/tracks/haskell/exercises/phone-number/src/Phone.hs +1 -1
- data/tracks/haskell/exercises/pig-latin/src/PigLatin.hs +1 -1
- data/tracks/haskell/exercises/prime-factors/src/PrimeFactors.hs +1 -1
- data/tracks/kotlin/exercises/_template/build.gradle +1 -1
- data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
- data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
- data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
- data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
- data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
- data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
- data/tracks/kotlin/exercises/binary/build.gradle +1 -1
- data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
- data/tracks/kotlin/exercises/bob/build.gradle +1 -1
- data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
- data/tracks/kotlin/exercises/change/build.gradle +1 -1
- data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
- data/tracks/kotlin/exercises/etl/build.gradle +1 -1
- data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
- data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
- data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
- data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
- data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
- data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
- data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
- data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
- data/tracks/kotlin/exercises/leap/build.gradle +1 -1
- data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
- data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
- data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
- data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
- data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
- data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
- data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
- data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
- data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
- data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
- data/tracks/kotlin/exercises/react/build.gradle +1 -1
- data/tracks/kotlin/exercises/react/src/test/kotlin/ReactTest.kt +9 -9
- data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
- data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
- data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
- data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
- data/tracks/kotlin/exercises/series/build.gradle +1 -1
- data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
- data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
- data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
- data/tracks/kotlin/exercises/strain/build.gradle +1 -1
- data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
- data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
- data/tracks/perl6/.gitmodules +3 -0
- data/tracks/perl6/.travis.yml +1 -0
- data/tracks/perl6/config.json +8 -11
- data/tracks/perl6/exercises/accumulate/Accumulate.pm6 +1 -0
- data/tracks/perl6/exercises/accumulate/Example.pm +8 -8
- data/tracks/perl6/exercises/accumulate/accumulate.t +27 -12
- data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +1 -0
- data/tracks/perl6/exercises/all-your-base/Example.pm +46 -0
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +163 -0
- data/tracks/perl6/exercises/bob/Bob.pm6 +13 -0
- data/tracks/perl6/exercises/bob/Example.pm +9 -9
- data/tracks/perl6/exercises/bob/bob.t +201 -34
- data/tracks/perl6/exercises/grade-school/Example.pm +13 -12
- data/tracks/perl6/exercises/grade-school/GradeSchool.pm6 +4 -0
- data/tracks/perl6/exercises/grade-school/grade-school.t +38 -19
- data/tracks/perl6/exercises/hello-world/Example.pm +3 -3
- data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +2 -2
- data/tracks/perl6/exercises/hello-world/hello-world.t +41 -10
- data/tracks/perl6/exercises/linked-list/Example.pm6 +33 -34
- data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -0
- data/tracks/perl6/exercises/linked-list/linked-list.t +32 -22
- data/tracks/perl6/exercises/robot-name/Example.pm +8 -15
- data/tracks/perl6/exercises/robot-name/Robot.pm6 +1 -0
- data/tracks/perl6/exercises/robot-name/robot-name.t +39 -14
- data/tracks/php/config.json +5 -0
- data/tracks/php/exercises/luhn/example.php +26 -0
- data/tracks/php/exercises/luhn/luhn_test.php +95 -0
- data/tracks/purescript/README.md +67 -4
- data/tracks/python/docs/LEARNING.md +1 -0
- data/tracks/python/exercises/acronym/acronym_test.py +5 -1
- data/tracks/python/exercises/atbash-cipher/atbash_cipher_test.py +8 -0
- data/tracks/python/exercises/hello-world/hello_world_test.py +4 -38
- data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +30 -15
- metadata +38 -2
@@ -36,7 +36,7 @@ class ReactTest {
|
|
36
36
|
val reactor = Reactor<Int>()
|
37
37
|
val one = reactor.InputCell(1)
|
38
38
|
val two = reactor.InputCell(2)
|
39
|
-
val output = reactor.ComputeCell(one, two) {
|
39
|
+
val output = reactor.ComputeCell(one, two) { (x, y) -> x + y * 10 }
|
40
40
|
assertEquals(21, output.value)
|
41
41
|
}
|
42
42
|
|
@@ -57,7 +57,7 @@ class ReactTest {
|
|
57
57
|
val input = reactor.InputCell(1)
|
58
58
|
val timesTwo = reactor.ComputeCell(input) { it[0] * 2 }
|
59
59
|
val timesThirty = reactor.ComputeCell(input) { it[0] * 30 }
|
60
|
-
val output = reactor.ComputeCell(timesTwo, timesThirty) {
|
60
|
+
val output = reactor.ComputeCell(timesTwo, timesThirty) { (x, y) -> x + y }
|
61
61
|
|
62
62
|
assertEquals(32, output.value)
|
63
63
|
input.value = 3
|
@@ -149,7 +149,7 @@ class ReactTest {
|
|
149
149
|
val plusOne = reactor.ComputeCell(input) { it[0] + 1 }
|
150
150
|
val minusOne1 = reactor.ComputeCell(input) { it[0] - 1 }
|
151
151
|
val minusOne2 = reactor.ComputeCell(minusOne1) { it[0] - 1 }
|
152
|
-
val output = reactor.ComputeCell(plusOne, minusOne2) {
|
152
|
+
val output = reactor.ComputeCell(plusOne, minusOne2) { (x, y) -> x * y }
|
153
153
|
|
154
154
|
val vals = mutableListOf<Int>()
|
155
155
|
output.addCallback { vals.add(it) }
|
@@ -165,7 +165,7 @@ class ReactTest {
|
|
165
165
|
val input = reactor.InputCell(1)
|
166
166
|
val plusOne = reactor.ComputeCell(input) { it[0] + 1 }
|
167
167
|
val minusOne = reactor.ComputeCell(input) { it[0] - 1 }
|
168
|
-
val alwaysTwo = reactor.ComputeCell(plusOne, minusOne) {
|
168
|
+
val alwaysTwo = reactor.ComputeCell(plusOne, minusOne) { (x, y) -> x - y }
|
169
169
|
|
170
170
|
val vals = mutableListOf<Int>()
|
171
171
|
alwaysTwo.addCallback { vals.add(it) }
|
@@ -209,12 +209,12 @@ class ReactAdderTest(val input: Input, val expected: Expected) {
|
|
209
209
|
val b = reactor.InputCell(input.b)
|
210
210
|
val carryIn = reactor.InputCell(input.carryIn)
|
211
211
|
|
212
|
-
val aXorB = reactor.ComputeCell(a, b) {
|
213
|
-
val sum = reactor.ComputeCell(aXorB, carryIn) {
|
212
|
+
val aXorB = reactor.ComputeCell(a, b) { (x, y) -> x.xor(y) }
|
213
|
+
val sum = reactor.ComputeCell(aXorB, carryIn) { (x, y) -> x.xor(y) }
|
214
214
|
|
215
|
-
val aXorBAndCin = reactor.ComputeCell(aXorB, carryIn) {
|
216
|
-
val aAndB = reactor.ComputeCell(a, b) {
|
217
|
-
val carryOut = reactor.ComputeCell(aXorBAndCin, aAndB) {
|
215
|
+
val aXorBAndCin = reactor.ComputeCell(aXorB, carryIn) { (x, y) -> x && y }
|
216
|
+
val aAndB = reactor.ComputeCell(a, b) { (x, y) -> x && y }
|
217
|
+
val carryOut = reactor.ComputeCell(aXorBAndCin, aAndB) { (x, y) -> x || y }
|
218
218
|
|
219
219
|
assertEquals(expected, Expected(sum=sum.value, carryOut=carryOut.value))
|
220
220
|
}
|
data/tracks/perl6/.travis.yml
CHANGED
data/tracks/perl6/config.json
CHANGED
@@ -6,10 +6,12 @@
|
|
6
6
|
"active": false,
|
7
7
|
"test_pattern": ".*\\.t$",
|
8
8
|
"deprecated": [
|
9
|
-
|
9
|
+
"binary",
|
10
|
+
"trinary"
|
10
11
|
],
|
11
12
|
"ignored": [
|
12
13
|
"docs",
|
14
|
+
"x-common",
|
13
15
|
"img"
|
14
16
|
],
|
15
17
|
"foregone": [
|
@@ -51,6 +53,11 @@
|
|
51
53
|
"slug": "scrabble-score",
|
52
54
|
"topics": []
|
53
55
|
},
|
56
|
+
{
|
57
|
+
"difficulty": 1,
|
58
|
+
"slug": "all-your-base",
|
59
|
+
"topics": []
|
60
|
+
},
|
54
61
|
{
|
55
62
|
"difficulty": 1,
|
56
63
|
"slug": "word-count",
|
@@ -86,21 +93,11 @@
|
|
86
93
|
"slug": "rna-transcription",
|
87
94
|
"topics": []
|
88
95
|
},
|
89
|
-
{
|
90
|
-
"difficulty": 1,
|
91
|
-
"slug": "binary",
|
92
|
-
"topics": []
|
93
|
-
},
|
94
96
|
{
|
95
97
|
"difficulty": 1,
|
96
98
|
"slug": "wordy",
|
97
99
|
"topics": []
|
98
100
|
},
|
99
|
-
{
|
100
|
-
"difficulty": 1,
|
101
|
-
"slug": "trinary",
|
102
|
-
"topics": []
|
103
|
-
},
|
104
101
|
{
|
105
102
|
"difficulty" : 1,
|
106
103
|
"slug" : "allergies",
|
@@ -0,0 +1 @@
|
|
1
|
+
unit module Accumulate:ver<1>;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
unit module Accumulate:ver<1>;
|
2
|
+
|
3
|
+
sub accumulate (@list, $function) is export {
|
4
|
+
my @accumulated;
|
5
|
+
for @list -> $element {
|
6
|
+
@accumulated.push: $function($element);
|
7
|
+
}
|
8
|
+
return @accumulated;
|
9
9
|
}
|
@@ -1,35 +1,50 @@
|
|
1
1
|
#!/usr/bin/env perl6
|
2
2
|
use v6;
|
3
3
|
use Test;
|
4
|
-
use lib
|
4
|
+
use lib $?FILE.IO.dirname;
|
5
5
|
|
6
|
+
my $exercise = 'Accumulate';
|
7
|
+
my $version = v1;
|
8
|
+
my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
|
6
9
|
plan 8;
|
7
|
-
my $module = %*ENV<EXERCISM> ?? 'Example' !! 'Accumulate';
|
8
|
-
use-ok $module;
|
9
|
-
require ::($module) <Accumulate>;
|
10
10
|
|
11
|
-
ok
|
12
|
-
|
13
|
-
|
11
|
+
use-ok $module or bail-out;
|
12
|
+
require ::($module);
|
13
|
+
if ::($exercise).^ver !~~ $version {
|
14
|
+
warn "\nExercise version mismatch. Further tests may fail!"
|
15
|
+
~ "\n$exercise is $(::($exercise).^ver.gist). "
|
16
|
+
~ "Test is $($version.gist).\n";
|
17
|
+
bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
|
18
|
+
}
|
19
|
+
|
20
|
+
my @subs;
|
21
|
+
BEGIN { @subs = <&accumulate> };
|
22
|
+
subtest 'Subroutine(s)', {
|
23
|
+
plan 1;
|
24
|
+
eval-lives-ok "use $module; ::('$_').defined or die '$_ is not defined.'", $_ for @subs;
|
25
|
+
} or bail-out 'All subroutines must be defined and exported.';
|
26
|
+
require ::($module) @subs.eager;
|
27
|
+
|
28
|
+
is-deeply accumulate([ ], sub {}),
|
14
29
|
[ ],
|
15
30
|
'test empty';
|
16
31
|
|
17
|
-
is-deeply
|
32
|
+
is-deeply accumulate([1, 2, 3, 4, 5], sub { @_[0] * @_[0] }),
|
18
33
|
[1, 4, 9, 16, 25],
|
19
34
|
'raise to 2';
|
20
35
|
|
21
|
-
is-deeply
|
36
|
+
is-deeply accumulate([10, 17, 23], sub { [ (@_[0] / 7).truncate, (@_[0] % 7).truncate ] }),
|
22
37
|
[[1, 3], [2, 3], [3, 2] ],
|
23
38
|
'divmod';
|
24
39
|
|
25
|
-
is-deeply
|
40
|
+
is-deeply accumulate(['hello', 'exercism'], sub { @_[0].uc }),
|
26
41
|
['HELLO', 'EXERCISM'],
|
27
42
|
'capitalize';
|
28
43
|
|
29
|
-
is-deeply
|
44
|
+
is-deeply accumulate(['a', 'b', 'c' ], sub ($inp) { [ accumulate( [1, 2, 3], sub ($inp2) { $inp ~ $inp2 } )]}),
|
30
45
|
[['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']],
|
31
46
|
'recursive';
|
32
47
|
|
33
|
-
is-deeply
|
48
|
+
is-deeply accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
|
34
49
|
['eht', 'kciuq', 'nworb', 'xof'],
|
35
50
|
'reverse strings';
|
@@ -0,0 +1 @@
|
|
1
|
+
unit module AllYourBase:ver<1>;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
unit module AllYourBase:ver<1>;
|
2
|
+
|
3
|
+
class X::AllYourBase::InvalidBase is Exception {
|
4
|
+
has $.payload;
|
5
|
+
method message {"$!payload is not a valid base."}
|
6
|
+
}
|
7
|
+
|
8
|
+
class X::AllYourBase::InvalidDigit is Exception {
|
9
|
+
has %.payload;
|
10
|
+
method message {"%!payload<digit> is not a valid digit for base %!payload<base>."}
|
11
|
+
}
|
12
|
+
|
13
|
+
sub convert-base (Int:D $input-base, @input-digits, Int:D $output-base --> Array:D) is export {
|
14
|
+
for $input-base, $output-base {
|
15
|
+
X::AllYourBase::InvalidBase.new(payload => $_).throw if $_ < 2;
|
16
|
+
}
|
17
|
+
from-decimal($output-base, (to-decimal $input-base, @input-digits));
|
18
|
+
}
|
19
|
+
|
20
|
+
sub to-decimal ($input-base, @input-digits) {
|
21
|
+
return [] if !@input-digits;
|
22
|
+
my $elems = @input-digits.elems;
|
23
|
+
for @input-digits {
|
24
|
+
if $_ == 0 { $elems-- }
|
25
|
+
else { last }
|
26
|
+
}
|
27
|
+
my $dec = 0;
|
28
|
+
loop (my $i = 0; $i < $elems; $i++) {
|
29
|
+
if @input-digits.reverse[$i] < 0 || @input-digits.reverse[$i] >= $input-base {
|
30
|
+
X::AllYourBase::InvalidDigit.new( :payload(base => $input-base, digit => @input-digits.reverse[$i]) ).throw;
|
31
|
+
}
|
32
|
+
$dec += @input-digits.reverse[$i] * $input-base ** $i;
|
33
|
+
}
|
34
|
+
return $dec;
|
35
|
+
}
|
36
|
+
|
37
|
+
sub from-decimal ($output-base, $dec) {
|
38
|
+
my @output-digits;
|
39
|
+
my $num = $dec;
|
40
|
+
while $num >= $output-base {
|
41
|
+
unshift @output-digits, $num % $output-base;
|
42
|
+
$num div= $output-base;
|
43
|
+
}
|
44
|
+
unshift @output-digits, $num;
|
45
|
+
return @output-digits;
|
46
|
+
}
|