trackler 2.0.8.18 → 2.0.8.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/.gitignore +1 -0
- data/common/.travis.yml +5 -8
- data/common/README.md +18 -5
- data/common/exercises/grep/canonical-data.json +290 -269
- data/common/exercises/phone-number/canonical-data.json +2 -2
- data/common/exercises/pov/canonical-data.json +2 -5
- data/common/exercises/roman-numerals/canonical-data.json +112 -74
- data/common/exercises/tournament/canonical-data.json +86 -85
- data/common/exercises/two-bucket/canonical-data.json +55 -47
- data/common/package.json +16 -0
- data/common/yarn.lock +195 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/docs/LEARNING.md +1 -1
- data/tracks/c/exercises/space-age/src/example.c +15 -47
- data/tracks/c/exercises/space-age/src/example.h +12 -8
- data/tracks/c/exercises/space-age/test/test_space_age.c +8 -8
- data/tracks/ceylon/docs/TESTS.md +5 -2
- data/tracks/ceylon/exercises/TRACK_HINTS.md +5 -2
- data/tracks/csharp/.gitignore +0 -4
- data/tracks/csharp/.travis.yml +9 -20
- data/tracks/csharp/appveyor.yml +2 -4
- data/tracks/csharp/build.cake +95 -0
- data/tracks/csharp/build.ps1 +189 -0
- data/tracks/csharp/build.sh +99 -31
- data/tracks/csharp/circle.yml +3 -12
- data/tracks/delphi/config.json +8 -0
- data/tracks/delphi/exercises/minesweeper/MineSweeper.dpr +60 -0
- data/tracks/delphi/exercises/minesweeper/uMineSweeperExample.pas +70 -0
- data/tracks/delphi/exercises/minesweeper/uMineSweeperTest.pas +270 -0
- data/tracks/dlang/config.json +86 -31
- data/tracks/elixir/config.json +7 -0
- data/tracks/elixir/exercises/rotational-cipher/example.exs +35 -0
- data/tracks/elixir/exercises/rotational-cipher/rotational_cipher.exs +13 -0
- data/tracks/elixir/exercises/rotational-cipher/rotational_cipher_test.exs +80 -0
- data/tracks/go/exercises/raindrops/raindrops_test.go +4 -1
- data/tracks/go/exercises/react/react_test.go +6 -8
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +4 -1
- data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +5 -2
- data/tracks/haskell/exercises/allergies/src/Allergies.hs +2 -2
- data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
- data/tracks/haskell/exercises/bank-account/src/BankAccount.hs +3 -3
- data/tracks/haskell/exercises/binary-search-tree/src/BST.hs +7 -7
- data/tracks/haskell/exercises/bowling/src/Bowling.hs +1 -1
- data/tracks/haskell/exercises/clock/src/Clock.hs +4 -4
- data/tracks/haskell/exercises/connect/src/Connect.hs +1 -1
- data/tracks/haskell/exercises/crypto-square/src/CryptoSquare.hs +1 -1
- data/tracks/haskell/exercises/custom-set/src/CustomSet.hs +12 -12
- data/tracks/haskell/exercises/difference-of-squares/src/Squares.hs +3 -3
- data/tracks/haskell/exercises/etl/src/ETL.hs +1 -1
- data/tracks/haskell/exercises/forth/src/Forth.hs +2 -2
- data/tracks/haskell/exercises/go-counting/src/Counting.hs +2 -2
- data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -3
- data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
- data/tracks/haskell/exercises/lens-person/src/Person.hs +4 -4
- data/tracks/julia/.travis.yml +3 -2
- data/tracks/ocaml/exercises/all-your-base/test.ml +2 -2
- data/tracks/ocaml/exercises/beer-song/test.ml +25 -24
- data/tracks/ocaml/exercises/phone-number/test.ml +22 -22
- data/tracks/ocaml/exercises/run-length-encoding/test.ml +5 -5
- data/tracks/ocaml/exercises/word-count/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +20 -1
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/word-count/bower.json +17 -0
- data/tracks/purescript/exercises/word-count/examples/src/WordCount.purs +31 -0
- data/tracks/purescript/exercises/word-count/src/WordCount.purs +3 -0
- data/tracks/purescript/exercises/word-count/test/Main.purs +89 -0
- data/tracks/python/exercises/accumulate/accumulate.py +2 -0
- data/tracks/python/exercises/acronym/acronym.py +2 -0
- data/tracks/python/exercises/allergies/allergies.py +3 -0
- data/tracks/python/exercises/allergies/example.py +1 -1
- data/tracks/python/exercises/anagram/anagram.py +2 -0
- data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +6 -0
- data/tracks/python/exercises/beer-song/beer_song.py +6 -0
- data/tracks/python/exercises/binary-search/binary_search.py +2 -0
- data/tracks/python/exercises/binary/binary.py +2 -0
- data/tracks/python/exercises/bob/bob.py +2 -8
- data/tracks/python/exercises/bracket-push/bracket_push.py +2 -0
- data/tracks/python/exercises/circular-buffer/circular_buffer.py +11 -0
- data/tracks/python/exercises/clock/clock.py +3 -0
- data/tracks/python/exercises/clock/example.py +1 -1
- data/tracks/python/exercises/crypto-square/crypto_square.py +2 -0
- data/tracks/python/exercises/diamond/diamond.py +2 -0
- data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +10 -0
- data/tracks/python/exercises/etl/etl.py +2 -0
- data/tracks/python/exercises/flatten-array/flatten_array.py +2 -0
- data/tracks/python/exercises/gigasecond/gigasecond.py +2 -0
- data/tracks/python/exercises/grade-school/grade_school.py +3 -0
- data/tracks/python/exercises/grains/grains.py +6 -0
- data/tracks/python/exercises/hamming/hamming.py +2 -0
- data/tracks/python/exercises/hello-world/hello_world.py +2 -7
- data/tracks/python/exercises/hexadecimal/hexadecimal.py +2 -0
- data/tracks/python/exercises/house/house.py +6 -0
- data/tracks/python/exercises/kindergarten-garden/kindergarten_garden.py +3 -0
- data/tracks/python/exercises/largest-series-product/largest_series_product.py +2 -0
- data/tracks/python/exercises/leap/leap.py +2 -0
- data/tracks/python/exercises/linked-list/linked_list.py +2 -8
- data/tracks/python/exercises/list-ops/list_ops.py +18 -22
- data/tracks/python/exercises/luhn/luhn.py +3 -0
- data/tracks/python/exercises/matrix/matrix.py +3 -0
- data/tracks/python/exercises/meetup/meetup.py +2 -0
- data/tracks/python/exercises/minesweeper/minesweeper.py +2 -0
- data/tracks/python/exercises/nth-prime/nth_prime.py +2 -0
- data/tracks/python/exercises/nucleotide-count/nucleotide_count.py +6 -0
- data/tracks/python/exercises/ocr-numbers/ocr_numbers.py +6 -0
- data/tracks/python/exercises/ocr-numbers/{ocr_test.py → ocr_numbers_test.py} +0 -0
- data/tracks/python/exercises/octal/octal.py +2 -0
- data/tracks/python/exercises/palindrome-products/palindrome_products.py +6 -0
- data/tracks/python/exercises/pangram/pangram.py +2 -0
- data/tracks/python/exercises/pascals-triangle/pascals_triangle.py +10 -0
- data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +6 -0
- data/tracks/python/exercises/phone-number/phone_number.py +3 -0
- data/tracks/python/exercises/pig-latin/pig_latin.py +2 -0
- data/tracks/python/exercises/point-mutations/point_mutations.py +2 -0
- data/tracks/python/exercises/poker/poker.py +2 -0
- data/tracks/python/exercises/prime-factors/prime_factors.py +2 -0
- data/tracks/python/exercises/proverb/proverb.py +2 -0
- data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet.py +10 -0
- data/tracks/python/exercises/queen-attack/queen_attack.py +6 -0
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher.py +10 -0
- data/tracks/python/exercises/raindrops/raindrops.py +2 -0
- data/tracks/python/exercises/rectangles/example.py +1 -1
- data/tracks/python/exercises/rectangles/rectangles.py +2 -0
- data/tracks/python/exercises/rectangles/{rectangles_count_test.py → rectangles_test.py} +0 -0
- data/tracks/python/exercises/rna-transcription/rna_transcription.py +2 -0
- data/tracks/python/exercises/robot-name/robot_name.py +3 -0
- data/tracks/python/exercises/robot-simulator/robot_simulator.py +3 -0
- data/tracks/python/exercises/roman-numerals/roman_numerals.py +2 -0
- data/tracks/python/exercises/run-length-encoding/run_length_encoding.py +6 -0
- data/tracks/python/exercises/run-length-encoding/{run_length_test.py → run_length_encoding_test.py} +1 -1
- data/tracks/python/exercises/saddle-points/saddle_points.py +2 -0
- data/tracks/python/exercises/say/example.py +1 -1
- data/tracks/python/exercises/say/say.py +2 -0
- data/tracks/python/exercises/say/say_test.py +3 -0
- data/tracks/python/exercises/scrabble-score/scrabble_score.py +2 -0
- data/tracks/python/exercises/secret-handshake/secret_handshake.py +6 -0
- data/tracks/python/exercises/secret-handshake/{handshake_test.py → secret_handshake_test.py} +0 -0
- data/tracks/python/exercises/series/series.py +2 -0
- data/tracks/python/exercises/sieve/sieve.py +2 -0
- data/tracks/python/exercises/simple-cipher/example.py +1 -1
- data/tracks/python/exercises/simple-cipher/simple_cipher.py +8 -0
- data/tracks/python/exercises/space-age/space_age.py +3 -0
- data/tracks/python/exercises/strain/strain.py +6 -0
- data/tracks/python/exercises/sublist/sublist.py +2 -0
- data/tracks/python/exercises/sum-of-multiples/sum_of_multiples.py +2 -0
- data/tracks/python/exercises/triangle/triangle.py +7 -0
- data/tracks/python/exercises/trinary/trinary.py +2 -0
- data/tracks/python/exercises/twelve-days/twelve_days.py +10 -0
- data/tracks/python/exercises/word-count/word_count.py +2 -0
- data/tracks/python/exercises/wordy/wordy.py +2 -0
- data/tracks/python/exercises/zebra-puzzle/zebra_puzzle.py +2 -0
- data/tracks/ruby/exercises/beer-song/.meta/.version +1 -0
- data/tracks/ruby/exercises/beer-song/beer_song_test.rb +62 -36
- data/tracks/ruby/exercises/beer-song/example.rb +1 -5
- data/tracks/ruby/exercises/beer-song/example.tt +22 -0
- data/tracks/ruby/lib/beer_song_cases.rb +43 -0
- data/tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift +1 -1
- metadata +94 -13
- data/common/bin/jsonlint +0 -27
- data/tracks/csharp/.paket/paket.bootstrapper.exe +0 -0
- data/tracks/csharp/Zipper.cs +0 -137
- data/tracks/csharp/build.cmd +0 -14
- data/tracks/csharp/build.fsx +0 -78
- data/tracks/csharp/paket.dependencies +0 -2
- data/tracks/csharp/paket.lock +0 -3
data/common/bin/jsonlint
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
LINTER=jq
|
4
|
-
INSTRUCTIONS_URL="https://stedolan.github.io/jq/download/"
|
5
|
-
|
6
|
-
function command_exists() {
|
7
|
-
type "$1" &> /dev/null
|
8
|
-
}
|
9
|
-
|
10
|
-
function error_exit {
|
11
|
-
printf "$1" >&2
|
12
|
-
exit "${2:-1}"
|
13
|
-
}
|
14
|
-
|
15
|
-
if ! command_exists $LINTER; then
|
16
|
-
error_exit "'$LINTER' is not installed.\nSee $INSTRUCTIONS_URL for installation instructions.\n"
|
17
|
-
fi
|
18
|
-
|
19
|
-
STATUS=0
|
20
|
-
for f in $(ls exercises/**/*.json); do
|
21
|
-
cat $f | $LINTER . > /dev/null 2>&1
|
22
|
-
if [ $? != 0 ]; then
|
23
|
-
echo "Invalid json: $f"
|
24
|
-
STATUS=1
|
25
|
-
fi
|
26
|
-
done
|
27
|
-
exit $STATUS
|
Binary file
|
data/tracks/csharp/Zipper.cs
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
using System;
|
2
|
-
using System.Collections.Generic;
|
3
|
-
using System.Linq;
|
4
|
-
|
5
|
-
public class BinTree<T> : IEquatable<BinTree<T>>
|
6
|
-
{
|
7
|
-
public BinTree(T value, BinTree<T> left, BinTree<T> right)
|
8
|
-
{
|
9
|
-
Value = value;
|
10
|
-
Left = left;
|
11
|
-
Right = right;
|
12
|
-
}
|
13
|
-
|
14
|
-
public BinTree(BinTree<T> tree) : this(tree.Value, tree.Left, tree.Right)
|
15
|
-
{
|
16
|
-
}
|
17
|
-
|
18
|
-
public T Value { get; }
|
19
|
-
public BinTree<T> Left { get; }
|
20
|
-
public BinTree<T> Right { get; }
|
21
|
-
|
22
|
-
public bool Equals(BinTree<T> other)
|
23
|
-
{
|
24
|
-
if (other == null || !Equals(Value, other.Value))
|
25
|
-
return false;
|
26
|
-
|
27
|
-
if (!ReferenceEquals(Left, other.Left) && (!Left?.Equals(other.Left) ?? false))
|
28
|
-
return false;
|
29
|
-
|
30
|
-
if (!ReferenceEquals(Right, other.Right) && (!Right?.Equals(other.Right) ?? false))
|
31
|
-
return false;
|
32
|
-
|
33
|
-
return true;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
public abstract class BinTreeCrumb<T>
|
38
|
-
{
|
39
|
-
public BinTreeCrumb(T value, BinTree<T> tree)
|
40
|
-
{
|
41
|
-
Value = value;
|
42
|
-
Tree = tree;
|
43
|
-
}
|
44
|
-
|
45
|
-
public T Value { get; }
|
46
|
-
public BinTree<T> Tree { get; }
|
47
|
-
}
|
48
|
-
|
49
|
-
public class BinTreeLeftCrumb<T> : BinTreeCrumb<T>
|
50
|
-
{
|
51
|
-
public BinTreeLeftCrumb(T value, BinTree<T> tree) : base(value, tree)
|
52
|
-
{
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
public class BinTreeRightCrumb<T> : BinTreeCrumb<T>
|
57
|
-
{
|
58
|
-
public BinTreeRightCrumb(T value, BinTree<T> tree) : base(value, tree)
|
59
|
-
{
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
public class Zipper<T>
|
64
|
-
{
|
65
|
-
private readonly T value;
|
66
|
-
private readonly BinTree<T> left;
|
67
|
-
private readonly BinTree<T> right;
|
68
|
-
private readonly List<BinTreeCrumb<T>> crumbs;
|
69
|
-
|
70
|
-
public Zipper(T value, BinTree<T> left, BinTree<T> right, List<BinTreeCrumb<T>> crumbs)
|
71
|
-
{
|
72
|
-
this.value = value;
|
73
|
-
this.left = left;
|
74
|
-
this.right = right;
|
75
|
-
this.crumbs = crumbs;
|
76
|
-
}
|
77
|
-
|
78
|
-
public T Value => value;
|
79
|
-
|
80
|
-
public Zipper<T> SetValue(T newValue) => new Zipper<T>(newValue, left, right, crumbs);
|
81
|
-
|
82
|
-
public Zipper<T> SetLeft(BinTree<T> binTree) => new Zipper<T>(value, binTree, right, crumbs);
|
83
|
-
|
84
|
-
public Zipper<T> SetRight(BinTree<T> binTree) => new Zipper<T>(value, left, binTree, crumbs);
|
85
|
-
|
86
|
-
public Zipper<T> Left()
|
87
|
-
{
|
88
|
-
if (left == null)
|
89
|
-
return null;
|
90
|
-
|
91
|
-
var newCrumbs = new[] { new BinTreeLeftCrumb<T>(value, right) }.Concat(crumbs).ToList();
|
92
|
-
return new Zipper<T>(left.Value, left.Left, left.Right, newCrumbs);
|
93
|
-
}
|
94
|
-
|
95
|
-
public Zipper<T> Right()
|
96
|
-
{
|
97
|
-
if (right == null)
|
98
|
-
return null;
|
99
|
-
|
100
|
-
var newCrumbs = new[] { new BinTreeRightCrumb<T>(value, left) }.Concat(crumbs).ToList();
|
101
|
-
return new Zipper<T>(right.Value, right.Left, right.Right, newCrumbs);
|
102
|
-
}
|
103
|
-
|
104
|
-
public Zipper<T> Up()
|
105
|
-
{
|
106
|
-
if (crumbs.Count == 0)
|
107
|
-
return null;
|
108
|
-
|
109
|
-
var firstCrumb = crumbs[0];
|
110
|
-
var remainingCrumbs = crumbs.Skip(1).ToList();
|
111
|
-
|
112
|
-
if (firstCrumb is BinTreeLeftCrumb<T>)
|
113
|
-
return new Zipper<T>(firstCrumb.Value, new BinTree<T>(value, left, right), firstCrumb.Tree, remainingCrumbs);
|
114
|
-
|
115
|
-
if (firstCrumb is BinTreeRightCrumb<T>)
|
116
|
-
return new Zipper<T>(firstCrumb.Value, firstCrumb.Tree, new BinTree<T>(value, left, right), remainingCrumbs);
|
117
|
-
|
118
|
-
return null;
|
119
|
-
}
|
120
|
-
|
121
|
-
public BinTree<T> ToTree()
|
122
|
-
{
|
123
|
-
var tree = new BinTree<T>(value, left, right);
|
124
|
-
|
125
|
-
foreach (var crumb in crumbs)
|
126
|
-
{
|
127
|
-
if (crumb is BinTreeLeftCrumb<T>)
|
128
|
-
tree = new BinTree<T>(crumb.Value, new BinTree<T>(tree), crumb.Tree);
|
129
|
-
if (crumb is BinTreeRightCrumb<T>)
|
130
|
-
tree = new BinTree<T>(crumb.Value, crumb.Tree, new BinTree<T>(tree));
|
131
|
-
}
|
132
|
-
|
133
|
-
return tree;
|
134
|
-
}
|
135
|
-
|
136
|
-
public static Zipper<T> FromTree(BinTree<T> tree) => new Zipper<T>(tree.Value, tree.Left, tree.Right, new List<BinTreeCrumb<T>>());
|
137
|
-
}
|
data/tracks/csharp/build.cmd
DELETED
data/tracks/csharp/build.fsx
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
#r "./packages/FAKE/tools/FakeLib.dll"
|
2
|
-
|
3
|
-
open Fake
|
4
|
-
open Fake.DotNetCli
|
5
|
-
open System.Text
|
6
|
-
|
7
|
-
let project = environVarOrDefault "project" "*"
|
8
|
-
let buildDir = "./build/"
|
9
|
-
let sourceDir = "./exercises/"
|
10
|
-
let projectDirs = buildDir @@ project
|
11
|
-
|
12
|
-
let testFiles = !! (projectDirs @@ "*Test.cs")
|
13
|
-
let allProjects = !! (projectDirs @@ "*.csproj")
|
14
|
-
let defaultProjects =
|
15
|
-
!! (projectDirs @@ "*.csproj") --
|
16
|
-
(projectDirs @@ "DotDsl.csproj") --
|
17
|
-
(projectDirs @@ "Hangman.csproj") --
|
18
|
-
(projectDirs @@ "React.csproj")
|
19
|
-
let refactoringProjects =
|
20
|
-
!! (projectDirs @@ "TreeBuilding.csproj") ++
|
21
|
-
(projectDirs @@ "Ledger.csproj") ++
|
22
|
-
(projectDirs @@ "Markdown.csproj")
|
23
|
-
|
24
|
-
let restore project = DotNetCli.Restore (fun p -> { p with Project = project })
|
25
|
-
let build project = DotNetCli.Build (fun p -> { p with Project = project })
|
26
|
-
let test project = DotNetCli.Test (fun p -> { p with Project = project })
|
27
|
-
|
28
|
-
let restoreAndBuild project =
|
29
|
-
restore project
|
30
|
-
build project
|
31
|
-
|
32
|
-
let restoreAndTest project =
|
33
|
-
restore project
|
34
|
-
test project
|
35
|
-
|
36
|
-
Target "Clean" (fun _ ->
|
37
|
-
DeleteDir buildDir
|
38
|
-
)
|
39
|
-
|
40
|
-
Target "CopyExercises" (fun _ ->
|
41
|
-
CopyDir buildDir sourceDir allFiles
|
42
|
-
)
|
43
|
-
|
44
|
-
Target "BuildUsingStubImplementation" (fun _ ->
|
45
|
-
Seq.iter restoreAndBuild defaultProjects
|
46
|
-
)
|
47
|
-
|
48
|
-
Target "EnableAllTests" (fun _ ->
|
49
|
-
let skipProperty = "Skip\s*=\s*\"Remove to run test\""
|
50
|
-
RegexReplaceInFilesWithEncoding skipProperty "" Encoding.UTF8 testFiles
|
51
|
-
)
|
52
|
-
|
53
|
-
Target "TestRefactoringProjects" (fun _ ->
|
54
|
-
Seq.iter restoreAndTest refactoringProjects
|
55
|
-
)
|
56
|
-
|
57
|
-
Target "ReplaceStubWithExampleImplementation" (fun _ ->
|
58
|
-
let replaceStubWithExampleImplementation project =
|
59
|
-
let stubFile = filename project + "" |> changeExt ".cs"
|
60
|
-
let exampleFile = "Example.cs"
|
61
|
-
RegexReplaceInFileWithEncoding exampleFile stubFile Encoding.UTF8 project
|
62
|
-
|
63
|
-
Seq.iter replaceStubWithExampleImplementation allProjects
|
64
|
-
)
|
65
|
-
|
66
|
-
Target "TestUsingExampleImplementation" (fun _ ->
|
67
|
-
Seq.iter restoreAndTest allProjects
|
68
|
-
)
|
69
|
-
|
70
|
-
"Clean"
|
71
|
-
==> "CopyExercises"
|
72
|
-
==> "BuildUsingStubImplementation"
|
73
|
-
==> "EnableAllTests"
|
74
|
-
==> "TestRefactoringProjects"
|
75
|
-
==> "ReplaceStubWithExampleImplementation"
|
76
|
-
==> "TestUsingExampleImplementation"
|
77
|
-
|
78
|
-
RunTargetOrDefault "TestUsingExampleImplementation"
|
data/tracks/csharp/paket.lock
DELETED