trackler 2.2.1.170 → 2.2.1.171

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/simple-cipher/canonical-data.json +5 -4
  4. data/tracks/cfml/config.json +1 -0
  5. data/tracks/coffeescript/config.json +43 -87
  6. data/tracks/coffeescript/config/maintainers.json +8 -2
  7. data/tracks/common-lisp/config.json +1 -0
  8. data/tracks/coq/config.json +7 -15
  9. data/tracks/coq/config/maintainers.json +5 -5
  10. data/tracks/crystal/config.json +51 -99
  11. data/tracks/crystal/config/maintainers.json +8 -8
  12. data/tracks/d/config.json +58 -60
  13. data/tracks/d/config/maintainers.json +8 -8
  14. data/tracks/delphi/config.json +12 -0
  15. data/tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas +30 -3
  16. data/tracks/delphi/exercises/word-count/README.md +39 -0
  17. data/tracks/delphi/exercises/word-count/WordCount.dpr +60 -0
  18. data/tracks/delphi/exercises/word-count/uWordCountExample.pas +67 -0
  19. data/tracks/delphi/exercises/word-count/uWordCountTests.pas +247 -0
  20. data/tracks/elisp/config.json +1 -0
  21. data/tracks/erlang/config.json +1 -1
  22. data/tracks/fortran/config.json +16 -32
  23. data/tracks/fortran/config/maintainers.json +5 -5
  24. data/tracks/go/config.json +1 -0
  25. data/tracks/go/exercises/bank-account/bank_account_test.go +3 -3
  26. data/tracks/go/exercises/parallel-letter-frequency/parallel_letter_frequency_test.go +17 -1
  27. data/tracks/groovy/config.json +89 -89
  28. data/tracks/groovy/config/maintainers.json +6 -6
  29. data/tracks/haxe/config.json +17 -17
  30. data/tracks/haxe/config/maintainers.json +1 -1
  31. data/tracks/java/scripts/insert-ignores.sh +33 -11
  32. data/tracks/julia/config.json +1 -0
  33. data/tracks/lua/config.json +1 -0
  34. data/tracks/lua/docs/ABOUT.md +7 -3
  35. data/tracks/nim/config.json +14 -2
  36. data/tracks/nim/exercises/sum-of-multiples/README.md +15 -0
  37. data/tracks/nim/exercises/sum-of-multiples/example.nim +6 -0
  38. data/tracks/nim/exercises/sum-of-multiples/sum_of_multiples_test.nim +44 -0
  39. data/tracks/objective-c/config.json +1 -0
  40. data/tracks/ocaml/config.json +1 -0
  41. data/tracks/perl5/config.json +138 -258
  42. data/tracks/perl5/config/maintainers.json +8 -8
  43. data/tracks/pharo/.travis.yml +1 -1
  44. data/tracks/pharo/config.json +3 -4
  45. data/tracks/pharo/config/maintainers.json +1 -1
  46. data/tracks/pharo/exercises/.keep +0 -0
  47. data/tracks/php/config.json +191 -211
  48. data/tracks/php/config/maintainers.json +11 -11
  49. data/tracks/plsql/config.json +49 -49
  50. data/tracks/plsql/config/maintainers.json +5 -5
  51. data/tracks/pony/config.json +27 -26
  52. data/tracks/pony/config/maintainers.json +5 -5
  53. data/tracks/prolog/config.json +1 -0
  54. data/tracks/purescript/config.json +49 -51
  55. data/tracks/purescript/config/maintainers.json +11 -11
  56. data/tracks/racket/config.json +1 -0
  57. data/tracks/scala/config.json +1 -0
  58. data/tracks/scheme/config.json +1 -0
  59. data/tracks/swift/config.json +1 -0
  60. data/tracks/typescript/config.json +1 -0
  61. data/tracks/vbnet/config.json +16 -32
  62. data/tracks/vbnet/config/maintainers.json +5 -5
  63. data/tracks/vimscript/config.json +1 -0
  64. metadata +10 -2
@@ -0,0 +1,60 @@
1
+ program WordCount;
2
+
3
+ {$IFNDEF TESTINSIGHT}
4
+ {$APPTYPE CONSOLE}
5
+ {$ENDIF}{$STRONGLINKTYPES ON}
6
+ uses
7
+ System.SysUtils,
8
+ {$IFDEF TESTINSIGHT}
9
+ TestInsight.DUnitX,
10
+ {$ENDIF }
11
+ DUnitX.Loggers.Console,
12
+ DUnitX.Loggers.Xml.NUnit,
13
+ DUnitX.TestFramework,
14
+ uWordCountTests in 'uWordCountTests.pas',
15
+ uWordCount in 'uWordCount.pas';
16
+
17
+ var
18
+ runner : ITestRunner;
19
+ results : IRunResults;
20
+ logger : ITestLogger;
21
+ nunitLogger : ITestLogger;
22
+ begin
23
+ {$IFDEF TESTINSIGHT}
24
+ TestInsight.DUnitX.RunRegisteredTests;
25
+ exit;
26
+ {$ENDIF}
27
+ try
28
+ //Check command line options, will exit if invalid
29
+ TDUnitX.CheckCommandLine;
30
+ //Create the test runner
31
+ runner := TDUnitX.CreateRunner;
32
+ //Tell the runner to use RTTI to find Fixtures
33
+ runner.UseRTTI := True;
34
+ //tell the runner how we will log things
35
+ //Log to the console window
36
+ logger := TDUnitXConsoleLogger.Create(true);
37
+ runner.AddLogger(logger);
38
+ //Generate an NUnit compatible XML File
39
+ nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
40
+ runner.AddLogger(nunitLogger);
41
+ runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
42
+
43
+ //Run tests
44
+ results := runner.Execute;
45
+ if not results.AllPassed then
46
+ System.ExitCode := EXIT_ERRORS;
47
+
48
+ {$IFNDEF CI}
49
+ //We don't want this happening when running under CI.
50
+ if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
51
+ begin
52
+ System.Write('Done.. press <Enter> key to quit.');
53
+ System.Readln;
54
+ end;
55
+ {$ENDIF}
56
+ except
57
+ on E: Exception do
58
+ System.Writeln(E.ClassName, ': ', E.Message);
59
+ end;
60
+ end.
@@ -0,0 +1,67 @@
1
+ unit uWordCount;
2
+
3
+ interface
4
+ uses
5
+ System.Generics.Collections;
6
+
7
+ type
8
+ IWordCount = interface
9
+ ['{955DF34E-254D-44E1-B4F3-91F0DCF8B764}']
10
+ function countWords: TDictionary<string, integer>;
11
+ end;
12
+
13
+ TWordCount = class(TInterfacedObject, IWordCount)
14
+ private
15
+ FWords: string;
16
+ FWordDict: TDictionary<string, integer>;
17
+ public
18
+ constructor Create(aWords: string);
19
+ function countWords: TDictionary<string, integer>;
20
+ end;
21
+
22
+ function WordCount(aWords: string): IWordCount;
23
+
24
+ implementation
25
+
26
+ uses SysUtils, RegularExpressions;
27
+
28
+ function WordCount(aWords: string): IWordCount;
29
+ begin
30
+ result := TWordCount.Create(aWords);
31
+ end;
32
+
33
+ constructor TWordCount.Create(aWords: string);
34
+ begin
35
+ inherited Create;
36
+ FWords := aWords;
37
+ FWordDict := TDictionary<string, integer>.Create;
38
+ end;
39
+
40
+ function TWordCount.countWords: TDictionary<string, integer>;
41
+ var
42
+ aWords: TArray<string>;
43
+ aWord: string;
44
+ begin
45
+ // convert to lowercase and trim spaces
46
+ FWords := Trim(Lowercase(FWords));
47
+ // replace all separators with spaces
48
+ FWords := TRegEx.Replace(FWords, '(,|\\n|'' | ''|:)', ' ', [roNone]);
49
+ // get rid of extra characters
50
+ FWords := TRegEx.Replace(FWords, '[^0-9a-z '']', '', [roNone]);
51
+ // delete extra spaces
52
+ FWords := TRegEx.Replace(FWords, '\s+', ' ', [roNone]);
53
+ // splitting on spaces
54
+ aWords := FWords.Split([' ']);
55
+
56
+ for aWord in aWords do
57
+ begin
58
+ if (not FWordDict.ContainsKey(aWord)) then
59
+ FWordDict.Add(aWord, 1)
60
+ else
61
+ FWordDict.Items[aWord] := FWordDict.Items[aWord] + 1;
62
+ end;
63
+
64
+ result := FWordDict;
65
+ end;
66
+ end.
67
+
@@ -0,0 +1,247 @@
1
+ unit uWordCountTests;
2
+
3
+ interface
4
+ uses
5
+ System.Generics.Collections, DUnitX.TestFramework;
6
+
7
+ const
8
+ CanonicalVersion = '1.2.0';
9
+
10
+ type
11
+
12
+ [TestFixture]
13
+ WordCountTests = class(TObject)
14
+ private
15
+ procedure CompareDictionaries(Expected, Actual: TDictionary<String, integer>);
16
+ public
17
+ [Test]
18
+ procedure Validate_CompareDictionaries;
19
+
20
+ [Test]
21
+ // [Ignore('Comment the "[Ignore]" statement to run the test')]
22
+ procedure Count_one_word;
23
+
24
+ [Test]
25
+ [Ignore]
26
+ procedure Count_one_of_each_word;
27
+
28
+ [Test]
29
+ [Ignore]
30
+ procedure Multiple_occurrences_of_a_word;
31
+
32
+ [Test]
33
+ [Ignore]
34
+ procedure Handles_cramped_lists;
35
+
36
+ [Test]
37
+ [Ignore]
38
+ procedure Handles_expanded_lists;
39
+
40
+ [Test]
41
+ [Ignore]
42
+ procedure Ignore_punctuation;
43
+
44
+ [Test]
45
+ [Ignore]
46
+ procedure Include_numbers;
47
+
48
+ [Test]
49
+ [Ignore]
50
+ procedure Normalize_case;
51
+
52
+ [Test]
53
+ [Ignore]
54
+ procedure With_apostrophes;
55
+
56
+ [Test]
57
+ [Ignore]
58
+ procedure With_quotations;
59
+
60
+ [Test]
61
+ [Ignore]
62
+ procedure Multiple_spaces_not_detected_as_a_word;
63
+
64
+ end;
65
+
66
+ implementation
67
+
68
+ uses SysUtils, uWordCount;
69
+
70
+ procedure WordCountTests.CompareDictionaries(Expected, Actual: TDictionary<String, Integer>);
71
+ var expectedPair: TPair<string, Integer>;
72
+ begin
73
+ Assert.AreEqual(Expected.Count, Actual.Count);
74
+ for expectedPair in Expected do
75
+ begin
76
+ Assert.IsTrue(Actual.ContainsKey(expectedPair.Key));
77
+ Assert.AreEqual(expectedPair.Value, Actual[expectedPair.Key]);
78
+ end;
79
+ end;
80
+
81
+ procedure WordCountTests.Validate_CompareDictionaries;
82
+ var expected, actual: TDictionary<String, integer>;
83
+ begin
84
+ expected := TDictionary<String, integer>.Create;
85
+ expected.Add('r',5);
86
+ expected.Add('a',10);
87
+ expected.Add('n',15);
88
+ expected.Add('d',20);
89
+ expected.Add('o',25);
90
+ expected.Add('m',30);
91
+
92
+ actual := TDictionary<String, Integer>.create(expected);
93
+
94
+ CompareDictionaries(expected, actual);
95
+ end;
96
+
97
+ procedure WordCountTests.Count_one_word;
98
+ var expected, actual: TDictionary<String, integer>;
99
+ begin
100
+ expected := TDictionary<String, integer>.Create;
101
+ expected.Add('word',1);
102
+
103
+ actual := WordCount('word').countWords;
104
+
105
+ CompareDictionaries(expected, actual);
106
+ end;
107
+
108
+ procedure WordCountTests.Count_one_of_each_word;
109
+ var expected, actual: TDictionary<String, integer>;
110
+ begin
111
+ expected := TDictionary<String, integer>.Create;
112
+ expected.Add('one',1);
113
+ expected.Add('of',1);
114
+ expected.Add('each',1);
115
+
116
+ actual := WordCount('one of each').countWords;
117
+
118
+ CompareDictionaries(expected, actual);
119
+ end;
120
+
121
+ procedure WordCountTests.Multiple_occurrences_of_a_word;
122
+ var expected, actual: TDictionary<String, integer>;
123
+ begin
124
+ expected := TDictionary<String, integer>.Create;
125
+ expected.Add('one',1);
126
+ expected.Add('fish',4);
127
+ expected.Add('two',1);
128
+ expected.Add('red',1);
129
+ expected.Add('blue',1);
130
+
131
+ actual := WordCount('one fish two fish red fish blue fish').countWords;
132
+
133
+ CompareDictionaries(expected, actual);
134
+ end;
135
+
136
+ procedure WordCountTests.Handles_cramped_lists;
137
+ var expected, actual: TDictionary<String, integer>;
138
+ begin
139
+ expected := TDictionary<String, integer>.Create;
140
+ expected.Add('one',1);
141
+ expected.Add('two',1);
142
+ expected.Add('three',1);
143
+
144
+ actual := WordCount('one,two,three').countWords;
145
+
146
+ CompareDictionaries(expected, actual);
147
+ end;
148
+
149
+ procedure WordCountTests.Handles_expanded_lists;
150
+ var expected, actual: TDictionary<String, integer>;
151
+ begin
152
+ expected := TDictionary<String, integer>.Create;
153
+ expected.Add('one',1);
154
+ expected.Add('two',1);
155
+ expected.Add('three',1);
156
+
157
+ actual := WordCount('one,\ntwo,\nthree').countWords;
158
+
159
+ CompareDictionaries(expected, actual);
160
+ end;
161
+
162
+ procedure WordCountTests.Ignore_punctuation;
163
+ var expected, actual: TDictionary<String, integer>;
164
+ begin
165
+ expected := TDictionary<String, integer>.Create;
166
+ expected.Add('car',1);
167
+ expected.Add('carpet',1);
168
+ expected.Add('as',1);
169
+ expected.Add('java',1);
170
+ expected.Add('javascript',1);
171
+
172
+ actual := WordCount('car: carpet as java: javascript!!&@$%^&').countWords;
173
+
174
+ CompareDictionaries(expected, actual);
175
+ end;
176
+
177
+ procedure WordCountTests.Include_numbers;
178
+ var expected, actual: TDictionary<String, integer>;
179
+ begin
180
+ expected := TDictionary<String, integer>.Create;
181
+ expected.Add('testing',2);
182
+ expected.Add('1',1);
183
+ expected.Add('2',1);
184
+
185
+ actual := WordCount('testing, 1, 2 testing').countWords;
186
+
187
+ CompareDictionaries(expected, actual);
188
+ end;
189
+
190
+ procedure WordCountTests.Normalize_case;
191
+ var expected, actual: TDictionary<String, integer>;
192
+ begin
193
+ expected := TDictionary<String, integer>.Create;
194
+ expected.Add('go',3);
195
+ expected.Add('stop',2);
196
+
197
+ actual := WordCount('go Go GO Stop stop').countWords;
198
+
199
+ CompareDictionaries(expected, actual);
200
+ end;
201
+
202
+ procedure WordCountTests.With_apostrophes;
203
+ var expected, actual: TDictionary<String, integer>;
204
+ begin
205
+ expected := TDictionary<String, integer>.Create;
206
+ expected.Add('first',1);
207
+ expected.Add('don''t',2);
208
+ expected.Add('laugh',1);
209
+ expected.Add('then',1);
210
+ expected.Add('cry',1);
211
+
212
+ actual := WordCount('First: don''t laugh. Then: don''t cry.').countWords;
213
+
214
+ CompareDictionaries(expected, actual);
215
+ end;
216
+
217
+ procedure WordCountTests.With_quotations;
218
+ var expected, actual: TDictionary<String, integer>;
219
+ begin
220
+ expected := TDictionary<String, integer>.Create;
221
+ expected.Add('joe',1);
222
+ expected.Add('can''t',1);
223
+ expected.Add('tell',1);
224
+ expected.Add('between',1);
225
+ expected.Add('large',2);
226
+ expected.Add('and',1);
227
+
228
+ actual := WordCount('Joe can''t tell between ''large'' and large').countWords;
229
+
230
+ CompareDictionaries(expected, actual);
231
+ end;
232
+
233
+ procedure WordCountTests.Multiple_spaces_not_detected_as_a_word;
234
+ var expected, actual: TDictionary<String, integer>;
235
+ begin
236
+ expected := TDictionary<String, integer>.Create;
237
+ expected.Add('multiple',1);
238
+ expected.Add('whitespaces',1);
239
+
240
+ actual := WordCount(' multiple whitespaces').countWords;
241
+
242
+ CompareDictionaries(expected, actual);
243
+ end;
244
+
245
+ initialization
246
+ TDUnitX.RegisterTestFixture(WordCountTests);
247
+ end.
@@ -7,6 +7,7 @@
7
7
  "slug": "hello-world",
8
8
  "uuid": "c4fdc935-885b-44bd-84e4-fae4a09e8c39",
9
9
  "core": false,
10
+ "auto_approve": true,
10
11
  "unlocked_by": null,
11
12
  "difficulty": 1,
12
13
  "topics": null
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "language": "Erlang",
3
3
  "active": true,
4
- "blurb": "",
4
+ "blurb": "Erlang is a functional language, designed for use in real-time distributed systems. It's used within telecom networks, and is notable for simple message passing with lightweight independent processes.",
5
5
  "foregone": [
6
6
  "binary-search",
7
7
  "lens-person",
@@ -1,81 +1,65 @@
1
1
  {
2
2
  "language": "Fortran",
3
3
  "active": false,
4
- "test_pattern": ".*\\.fun",
4
+ "blurb": "",
5
5
  "solution_pattern": "example.f90",
6
+ "test_pattern": ".*\\.fun",
6
7
  "exercises": [
7
8
  {
8
- "uuid": "b71d9258-78ef-4986-b9ed-ebf93b72d399",
9
9
  "slug": "hello-world",
10
+ "uuid": "b71d9258-78ef-4986-b9ed-ebf93b72d399",
10
11
  "core": false,
11
12
  "unlocked_by": null,
12
13
  "difficulty": 1,
13
- "topics": [
14
-
15
- ]
14
+ "topics": []
16
15
  },
17
16
  {
18
- "uuid": "c0657767-1d7f-4262-b932-50ab53b9c220",
19
17
  "slug": "bob",
18
+ "uuid": "c0657767-1d7f-4262-b932-50ab53b9c220",
20
19
  "core": false,
21
20
  "unlocked_by": null,
22
21
  "difficulty": 1,
23
- "topics": [
24
-
25
- ]
22
+ "topics": []
26
23
  },
27
24
  {
28
- "uuid": "c4b23221-b6a8-452c-9816-c30501fc690f",
29
25
  "slug": "hamming",
26
+ "uuid": "c4b23221-b6a8-452c-9816-c30501fc690f",
30
27
  "core": false,
31
28
  "unlocked_by": null,
32
29
  "difficulty": 1,
33
- "topics": [
34
-
35
- ]
30
+ "topics": []
36
31
  },
37
32
  {
38
- "uuid": "6fa09622-b92d-42ae-aeba-b68717c0b51c",
39
33
  "slug": "rna-transcription",
34
+ "uuid": "6fa09622-b92d-42ae-aeba-b68717c0b51c",
40
35
  "core": false,
41
36
  "unlocked_by": null,
42
37
  "difficulty": 1,
43
- "topics": [
44
-
45
- ]
38
+ "topics": []
46
39
  },
47
40
  {
48
- "uuid": "15bab787-1566-45e9-9e26-0bb7f57bbcd5",
49
41
  "slug": "raindrops",
42
+ "uuid": "15bab787-1566-45e9-9e26-0bb7f57bbcd5",
50
43
  "core": false,
51
44
  "unlocked_by": null,
52
45
  "difficulty": 1,
53
- "topics": [
54
-
55
- ]
46
+ "topics": []
56
47
  },
57
48
  {
58
- "uuid": "dd6c972e-3c85-4a92-b8e5-d58ea3cadfa0",
59
49
  "slug": "difference-of-squares",
50
+ "uuid": "dd6c972e-3c85-4a92-b8e5-d58ea3cadfa0",
60
51
  "core": false,
61
52
  "unlocked_by": null,
62
53
  "difficulty": 1,
63
- "topics": [
64
-
65
- ]
54
+ "topics": []
66
55
  },
67
56
  {
68
- "uuid": "c9100446-6e8a-4171-9c1c-61f2b86ba24f",
69
57
  "slug": "pangram",
58
+ "uuid": "c9100446-6e8a-4171-9c1c-61f2b86ba24f",
70
59
  "core": false,
71
60
  "unlocked_by": null,
72
61
  "difficulty": 1,
73
- "topics": [
74
-
75
- ]
62
+ "topics": []
76
63
  }
77
- ],
78
- "foregone": [
79
-
80
64
  ]
81
65
  }